28 #ifndef DOXYGEN_SHOULD_SKIP_THIS 37 template <
typename GUM_SCALAR >
39 const std::string& projection_name,
40 const std::string& type_multidim,
44 ProjectionSet* theset;
46 if (!__set.exists(projection_name)) {
47 theset = __set.insert(projection_name,
new ProjectionSet).second;
48 # ifdef GUM_DEBUG_MODE 52 __debug__::__inc_deletion(
53 "HashTable", __FILE__, __LINE__,
"destructor of", (
void*)theset);
56 theset = __set[projection_name];
59 theset->insert(type_multidim, newFunction);
63 template <
typename GUM_SCALAR >
65 const std::string& projection_name,
const std::string& type_multidim) {
66 if (!__set.exists(projection_name))
return;
68 ProjectionSet* theset = __set[projection_name];
70 theset->erase(type_multidim);
74 template <
typename GUM_SCALAR >
76 const std::string& projection_name,
const std::string& type_multidim)
const {
77 if (!__set.exists(projection_name))
return false;
79 return __set[projection_name].exists(type_multidim);
84 template <
typename GUM_SCALAR >
87 const std::string& projection_name,
88 const std::string& type_multidim)
const {
89 ProjectionSet* theset = __set[projection_name];
90 return theset->operator[](type_multidim);
95 template <
typename GUM_SCALAR >
96 ProjectionRegister4MultiDim< GUM_SCALAR >&
98 static ProjectionRegister4MultiDim container;
100 # ifdef GUM_DEBUG_MODE 101 static bool first =
true;
108 __debug__::__inc_deletion(
"HashTable",
112 (
void*)&container.__set);
121 template <
typename GUM_SCALAR >
125 template <
typename GUM_SCALAR >
130 iter != __set.endSafe();
136 template <
typename GUM_SCALAR >
138 const std::string& projection_name,
139 const std::string& type_multidim,
142 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
A container for registering projection functions on multiDimImplementations.
void erase(const std::string &projection_name, const std::string &type_multidim)
removes a given entry from the register
gum is the global namespace for all aGrUM entities
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.