28 #ifndef DOXYGEN_SHOULD_SKIP_THIS 37 template <
typename GUM_SCALAR >
39 const std::string& projection_name,
40 const std::string& type_multidim,
41 typename CompleteProjectionRegister4MultiDim<
42 GUM_SCALAR >::CompleteProjectionPtr newFunction) {
44 CompleteProjectionSet* theset;
46 if (!__set.exists(projection_name)) {
47 theset = __set.insert(projection_name,
new CompleteProjectionSet).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 CompleteProjectionSet* 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 >
85 INLINE
typename CompleteProjectionRegister4MultiDim<
86 GUM_SCALAR >::CompleteProjectionPtr
88 const std::string& projection_name,
89 const std::string& type_multidim)
const {
90 CompleteProjectionSet* theset = __set[projection_name];
91 return theset-> operator[](type_multidim);
96 template <
typename GUM_SCALAR >
97 CompleteProjectionRegister4MultiDim< GUM_SCALAR >&
99 static CompleteProjectionRegister4MultiDim container;
101 # ifdef GUM_DEBUG_MODE 102 static bool first =
true;
109 __debug__::__inc_deletion(
"HashTable",
113 (
void*)&container.__set);
122 template <
typename GUM_SCALAR >
123 CompleteProjectionRegister4MultiDim<
124 GUM_SCALAR >::CompleteProjectionRegister4MultiDim() {}
127 template <
typename GUM_SCALAR >
128 CompleteProjectionRegister4MultiDim<
129 GUM_SCALAR >::~CompleteProjectionRegister4MultiDim() {
132 iter = __set.beginSafe();
133 iter != __set.endSafe();
139 template <
typename GUM_SCALAR >
142 const std::string& type_multidim,
143 typename CompleteProjectionRegister4MultiDim<
144 GUM_SCALAR >::CompleteProjectionPtr
function) {
146 projection_name, type_multidim,
function);
static CompleteProjectionRegister4MultiDim & Register()
A named constructor that constructs one and only one Register per data type.
void erase(const std::string &projection_name, const std::string &type_multidim)
Removes a given entry from the register.
bool exists(const std::string &projection_name, const std::string &type_multidim) const
Indicates whether a given entry exists in the register.
gum is the global namespace for all aGrUM entities
void registerCompleteProjection(const std::string &projection_name, const std::string &type_multidim, typename CompleteProjectionRegister4MultiDim< GUM_SCALAR >::CompleteProjectionPtr function)
A function to more easily register new projection functions in MultiDims.
void insert(const std::string &projection_name, const std::string &type_multidim, CompleteProjectionPtr newFunction)
Adds a new entry into the register.
CompleteProjectionPtr 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.
A container for registering complete projection functions on multiDimImplementations, i.e., projections over all variables.