31 #ifndef DOXYGEN_SHOULD_SKIP_THIS 40 template <
typename GUM_SCALAR >
42 const std::string& projection_name,
43 const std::string& type_multidim,
47 ProjectionSet* theset;
49 if (!__set.exists(projection_name)) {
50 theset = __set.insert(projection_name,
new ProjectionSet).second;
51 # ifdef GUM_DEBUG_MODE 55 __debug__::__inc_deletion(
56 "HashTable", __FILE__, __LINE__,
"destructor of", (
void*)theset);
59 theset = __set[projection_name];
62 theset->insert(type_multidim, newFunction);
66 template <
typename GUM_SCALAR >
68 const std::string& projection_name,
const std::string& type_multidim) {
69 if (!__set.exists(projection_name))
return;
71 ProjectionSet* theset = __set[projection_name];
73 theset->erase(type_multidim);
77 template <
typename GUM_SCALAR >
79 const std::string& projection_name,
const std::string& type_multidim)
const {
80 if (!__set.exists(projection_name))
return false;
82 return __set[projection_name].exists(type_multidim);
87 template <
typename GUM_SCALAR >
90 const std::string& projection_name,
91 const std::string& type_multidim)
const {
92 ProjectionSet* theset = __set[projection_name];
93 return theset->operator[](type_multidim);
98 template <
typename GUM_SCALAR >
99 ProjectionRegister4MultiDim< GUM_SCALAR >&
101 static ProjectionRegister4MultiDim container;
103 # ifdef GUM_DEBUG_MODE 104 static bool first =
true;
111 __debug__::__inc_deletion(
"HashTable",
115 (
void*)&container.__set);
124 template <
typename GUM_SCALAR >
128 template <
typename GUM_SCALAR >
133 iter != __set.endSafe();
139 template <
typename GUM_SCALAR >
141 const std::string& projection_name,
142 const std::string& type_multidim,
145 projection_name, type_multidim,
function);
static ProjectionRegister4MultiDim & Register()
a named constructor that constructs one and only one Register per data type
MultiDimImplementation< GUM_SCALAR > *(* ProjectionPtr)(const MultiDimImplementation< GUM_SCALAR > *, const Set< const DiscreteVariable * > &)
the type of functions used by the register
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void erase(const std::string &projection_name, const std::string &type_multidim)
removes a given entry from the register
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
bool exists(const std::string &projection_name, const std::string &type_multidim) const
indicates whether a given entry exists in the register
ProjectionPtr get(const std::string &projection_name, const std::string &type_multidim) const
returns the specialized projection operator assigned to a given type of MultiDimImplementation ...
HashTableIteratorSafe< Key, Val > iterator_safe
Types for STL compliance.
void registerProjection(const std::string &projection_name, const std::string &type_multidim, typename ProjectionRegister4MultiDim< GUM_SCALAR >::ProjectionPtr function)
A function to more easily register new projection functions in MultiDims.
void insert(const std::string &projection_name, const std::string &type_multidim, ProjectionPtr newFunction)
adds a new entry into the register
~ProjectionRegister4MultiDim()
Destructor.
ProjectionRegister4MultiDim()
Default constructor: creates an empty register.