53#ifndef DOXYGEN_SHOULD_SKIP_THIS
62 template <
typename GUM_ELEMENT >
64 std::string_view operation_name,
65 std::string_view type1,
66 std::string_view type2,
71 if (!_set_.exists(operation_name)) {
72 theset = _set_.insert(std::string{operation_name},
new OperatorSet).second;
77 __debug__::_inc_deletion_(
"HashTable", __FILE__, __LINE__,
"destructor of", (
void*)theset);
80 theset = _set_[operation_name];
83 std::pair< std::string, std::string > thepair(type1, type2);
85 theset->insert(thepair, newFunction);
89 template <
typename GUM_ELEMENT >
91 std::string_view type1,
92 std::string_view type2) {
93 if (!_set_.exists(operation_name))
return;
95 OperatorSet* theset = _set_[operation_name];
97 theset->erase(std::pair< std::string, std::string >(std::string{type1}, std::string{type2}));
101 template <
typename GUM_ELEMENT >
103 std::string_view type1,
104 std::string_view type2)
const {
105 if (!_set_.exists(operation_name))
return false;
106 const OperatorSet& theset = *(_set_[operation_name]);
107 const std::pair< std::string, std::string > key(std::string{type1}, std::string{type2});
108 return theset.exists(key);
113 template <
typename GUM_ELEMENT >
116 std::string_view type1,
117 std::string_view type2)
const {
118 const OperatorSet& theset = *(_set_[operation_name]);
119 const std::pair< std::string, std::string > key(std::string{type1}, std::string{type2});
125 template <
typename GUM_ELEMENT >
130# ifdef GUM_DEBUG_MODE
131 static std::atomic_flag first = ATOMIC_FLAG_INIT;
132 if (!first.test_and_set()) {
136 __debug__::_inc_deletion_(
"HashTable",
140 (
void*)&container._set_);
148 template <
typename GUM_ELEMENT >
152 template <
typename GUM_ELEMENT >
156 iter != _set_.endSafe();
162 template <
typename GUM_ELEMENT >
164 std::string_view type1,
165 std::string_view type2,
HashTableIteratorSafe< Key, Val > iterator_safe
Types for STL compliance.
A container for registering binary functions on multiDimImplementations.
static OperatorRegister4MultiDim< GUM_ELEMENT > & Register()
A named constructor that constructs one and only one Register per data type.
void insert(std::string_view operation_name, std::string_view type1, std::string_view type2, OperatorPtr newFunction)
adds a new entry into the register
OperatorPtr get(std::string_view operation_name, std::string_view type1, std::string_view type2) const
returns the specialized operator assigned to a given pair of MultiDimImplementations
void erase(std::string_view operation_name, std::string_view type1, std::string_view type2)
removes a given entry from the register
bool exists(std::string_view operation_name, std::string_view type1, std::string_view type2) const
Indicates whether a given entry exists in the register.
MultiDimImplementation< GUM_ELEMENT > *(*)(const MultiDimImplementation< GUM_ELEMENT > *, const MultiDimImplementation< GUM_ELEMENT > *) OperatorPtr
The type of functions used by the register.
~OperatorRegister4MultiDim()
Destructor.
OperatorRegister4MultiDim()
Default constructor: creates an empty register.
gum is the global namespace for all aGrUM entities
void registerOperator(std::string_view operation_name, std::string_view type1, std::string_view type2, typename OperatorRegister4MultiDim< GUM_ELEMENT >::OperatorPtr function)
A function to more easily register new operators in MultiDims.
A container for registering binary functions on multiDimImplementations.