datapool.hh
Go to the documentation of this file.
/* -*- mia-c++ -*-
*
* This file is part of MIA - a toolbox for medical image analysis
* Copyright (c) Leipzig, Madrid 1999-2017 Gert Wollny
*
* MIA is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MIA; if not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef mia_core_datapool_hh
#define mia_core_datapool_hh
#include <map>
#include <boost/any.hpp>
#include <mia/core/parallel.hh>
NS_MIA_BEGIN
class EXPORT_CORE CDatapool
{
public:
void add(const std::string& key, boost::any value);
boost::any get(const std::string& key) const;
boost::any get_and_remove(const std::string& key);
void remove(const std::string& key);
bool has_key(const std::string& key) const;
static CDatapool& instance();
bool has_unused_data() const;
void clear();
private:
CDatapool();
CDatapool(const CDatapool& other);
typedef std::map<std::string, boost::any> Anymap;
typedef Anymap::const_iterator const_iterator;
const_iterator get_iterator(const std::string& key) const;
Anymap m_map;
typedef std::map<std::string, bool> Usagemap;
mutable Usagemap m_usage;
static CRecursiveMutex m_mutex;
};
NS_MIA_END
#endif
CDatapool::clear
void clear()
CDatapool::get
boost::any get(const std::string &key) const
CDatapool::has_key
bool has_key(const std::string &key) const
CDatapool::remove
void remove(const std::string &key)
CDatapool::get_and_remove
boost::any get_and_remove(const std::string &key)
CDatapool::instance
static CDatapool & instance()
CDatapool::has_unused_data
bool has_unused_data() const
CDatapool::add
void add(const std::string &key, boost::any value)
NS_MIA_BEGIN
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
Definition defines.hh:33
EXPORT_CORE
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
Definition defines.hh:101
NS_MIA_END
#define NS_MIA_END
conveniance define to end the mia namespace
Definition defines.hh:36
parallel.hh
CRecursiveMutex
std::recursive_mutex CRecursiveMutex
Definition parallelcxx11.hh:35