aGrUM  0.16.0
operatorRegister4MultiDim.h
Go to the documentation of this file.
1 
31 #ifndef GUM_OPERATOR_REGISTER_4_MULTI_DIM_H
32 #define GUM_OPERATOR_REGISTER_4_MULTI_DIM_H
33 
34 #include <agrum/core/hashTable.h>
35 #include <iostream>
36 #include <string>
37 #include <utility>
38 
39 namespace gum {
40 
41  // the base object used by combinations
42  template < typename GUM_SCALAR >
43  class MultiDimImplementation;
44 
45  // ===========================================================================
46  // === GUM_MULTI_DIM_OPERATOR_REGISTER ===
47  // ===========================================================================
48  // clang-format off
57  // clang-format on
58  template < typename GUM_SCALAR >
60  public:
62  typedef MultiDimImplementation< GUM_SCALAR >* (*OperatorPtr)(
64  const MultiDimImplementation< GUM_SCALAR >*);
65 
66  // ========================================================================
68  // ========================================================================
70 
96  void insert(const std::string& operation_name,
97  const std::string& type1,
98  const std::string& type2,
99  OperatorPtr newFunction);
100 
118  void erase(const std::string& operation_name,
119  const std::string& type1,
120  const std::string& type2);
121 
139  bool exists(const std::string& operation_name,
140  const std::string& type1,
141  const std::string& type2) const;
142 
164  OperatorPtr get(const std::string& operation_name,
165  const std::string& type1,
166  const std::string& type2) const;
167 
169  // ========================================================================
171  // ========================================================================
173 
181 
183 
184  private:
185  // ========================================================================
187  // ========================================================================
189 
192 
195 
198 
200 
204 
215  };
216 
218  template < typename GUM_SCALAR >
219  void registerOperator(
220  const std::string& operation_name,
221  const std::string& type1,
222  const std::string& type2,
224 
225 } /* namespace gum */
226 
227 // always include the implementations
229 
230 #endif /* GUM_OPERATOR_REGISTER_MULTI_DIM_H */
HashTable< std::pair< std::string, std::string >, OperatorPtr > OperatorSet
The set of associations for a given operation type.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
The class for generic Hash Tables.
Definition: hashTable.h:679
void registerOperator(const std::string &operation_name, const std::string &type1, const std::string &type2, typename OperatorRegister4MultiDim< GUM_SCALAR >::OperatorPtr function)
A function to more easily register new operators in MultiDims.
A container for registering binary functions on multiDimImplementations.
HashTable< std::string, OperatorSet *> __set
A mapping from pairs of types of MultiDimImplementations to operators.
bool exists(const std::string &operation_name, const std::string &type1, const std::string &type2) const
Indicates whether a given entry exists in the register.
void erase(const std::string &operation_name, const std::string &type1, const std::string &type2)
removes a given entry from the register
void insert(const std::string &operation_name, const std::string &type1, const std::string &type2, OperatorPtr newFunction)
adds a new entry into the register
static OperatorRegister4MultiDim< GUM_SCALAR > & Register()
A named constructor that constructs one and only one Register per data type.
MultiDimImplementation< GUM_SCALAR > *(* OperatorPtr)(const MultiDimImplementation< GUM_SCALAR > *, const MultiDimImplementation< GUM_SCALAR > *)
The type of functions used by the register.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
OperatorRegister4MultiDim()
Default constructor: creates an empty register.
<agrum/multidim/multiDimImplementation.h>
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
~OperatorRegister4MultiDim()
Destructor.