31 #ifndef DOXYGEN_SHOULD_SKIP_THIS 40 template <
typename GUM_SCALAR >
42 const std::string& projection_name,
43 const std::string& type_multidim,
44 typename CompleteProjectionRegister4MultiDim<
45 GUM_SCALAR >::CompleteProjectionPtr newFunction) {
47 CompleteProjectionSet* theset;
49 if (!__set.exists(projection_name)) {
50 theset = __set.insert(projection_name,
new CompleteProjectionSet).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 CompleteProjectionSet* 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 >
88 INLINE
typename CompleteProjectionRegister4MultiDim<
89 GUM_SCALAR >::CompleteProjectionPtr
91 const std::string& projection_name,
92 const std::string& type_multidim)
const {
93 CompleteProjectionSet* theset = __set[projection_name];
94 return theset-> operator[](type_multidim);
99 template <
typename GUM_SCALAR >
100 CompleteProjectionRegister4MultiDim< GUM_SCALAR >&
102 static CompleteProjectionRegister4MultiDim container;
104 # ifdef GUM_DEBUG_MODE 105 static bool first =
true;
112 __debug__::__inc_deletion(
"HashTable",
116 (
void*)&container.__set);
125 template <
typename GUM_SCALAR >
126 CompleteProjectionRegister4MultiDim<
127 GUM_SCALAR >::CompleteProjectionRegister4MultiDim() {}
130 template <
typename GUM_SCALAR >
131 CompleteProjectionRegister4MultiDim<
132 GUM_SCALAR >::~CompleteProjectionRegister4MultiDim() {
135 iter = __set.beginSafe();
136 iter != __set.endSafe();
142 template <
typename GUM_SCALAR >
145 const std::string& type_multidim,
146 typename CompleteProjectionRegister4MultiDim<
147 GUM_SCALAR >::CompleteProjectionPtr
function) {
149 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.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.