![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
A container for registering partial instantiation functions on multiDimImplementations, i.e., functions assigning values to subsets of the variables of some tables. More...
#include <partialInstantiationRegister4MultiDim.h>
Public Types | |
| using | PartialInstantiationPtr |
| The type of functions used by the register. | |
Public Member Functions | |
Accessors / Modifiers | |
| void | insert (const std::string &instantiation_func_name, const std::string &type_multidim, PartialInstantiationPtr newFunction) |
| Adds a new entry into the register. | |
| void | erase (const std::string &instantiation_func_name, const std::string &type_multidim) |
| Removes a given entry from the register. | |
| bool | exists (const std::string &instantiation_func_name, const std::string &type_multidim) const |
| Indicates whether a given entry exists in the register. | |
| PartialInstantiationPtr | get (const std::string &instantiation_func_name, const std::string &type_multidim) const |
| Returns the specialized partial instantiation operator assigned to a given type of MultiDimImplementation. | |
Static Public Member Functions | |
Named Constructors | |
| static PartialInstantiationRegister4MultiDim & | Register () |
| A named constructor that constructs one and only one Register per data type. | |
Private Types | |
| using | PartialInstantiationSet = HashTable< std::string, PartialInstantiationPtr > |
| The set of associations for a given partial instantiation type. | |
Private Member Functions | |
Constructors / Destructors | |
| PartialInstantiationRegister4MultiDim () | |
| Default constructor: creates an empty register. | |
| PartialInstantiationRegister4MultiDim (const PartialInstantiationRegister4MultiDim &) | |
| Copy operator: never to be used. | |
| ~PartialInstantiationRegister4MultiDim () | |
| Class destructor. | |
Private Attributes | |
| HashTable< std::string, PartialInstantiationSet * > | _set_ |
| A mapping from the types of MultiDimImplementations to partial instantiation operators. | |
A container for registering partial instantiation functions on multiDimImplementations, i.e., functions assigning values to subsets of the variables of some tables.
| GUM_SCALAR | The type of scalars stored in the multidimensional table. |
Definition at line 87 of file partialInstantiationRegister4MultiDim.h.
| using gum::PartialInstantiationRegister4MultiDim< GUM_SCALAR >::PartialInstantiationPtr |
The type of functions used by the register.
Definition at line 90 of file partialInstantiationRegister4MultiDim.h.
|
private |
The set of associations for a given partial instantiation type.
Definition at line 213 of file partialInstantiationRegister4MultiDim.h.
|
private |
Default constructor: creates an empty register.
Referenced by PartialInstantiationRegister4MultiDim(), and Register().
|
private |
Copy operator: never to be used.
References PartialInstantiationRegister4MultiDim().
|
private |
Class destructor.
| void gum::PartialInstantiationRegister4MultiDim< GUM_SCALAR >::erase | ( | const std::string & | instantiation_func_name, |
| const std::string & | type_multidim ) |
Removes a given entry from the register.
Removes the function, if any, that performs the instantiation described by instantiation_func_name, and that takes in argument a multiDim of type type_multidim.
| instantiation_func_name | The name of the instantiation performed by the function to remove. |
| type_multidim | The real type of the multiDim taken in argument by the function to remove. |
| bool gum::PartialInstantiationRegister4MultiDim< GUM_SCALAR >::exists | ( | const std::string & | instantiation_func_name, |
| const std::string & | type_multidim ) const |
Indicates whether a given entry exists in the register.
Indicates if the register contains a function that performs the instantiation described by instantiation_func_name, and that takes in argument a multiDim of type type_multidim.
| instantiation_func_name | The name of the instantiation performed by the function we look for. |
| type_multidim | The real type of the multiDim taken in argument by the function we look for. |
| PartialInstantiationPtr gum::PartialInstantiationRegister4MultiDim< GUM_SCALAR >::get | ( | const std::string & | instantiation_func_name, |
| const std::string & | type_multidim ) const |
Returns the specialized partial instantiation operator assigned to a given type of MultiDimImplementation.
| instantiation_func_name | describes the name of the partial instantiation performed by the function we look for. |
| type_multidim | the real type of the multiDim taken in argument by the function we look for |
| NotFound | Raised if the operator we look for does not exist within this register. |
| void gum::PartialInstantiationRegister4MultiDim< GUM_SCALAR >::insert | ( | const std::string & | instantiation_func_name, |
| const std::string & | type_multidim, | ||
| PartialInstantiationPtr | newFunction ) |
Adds a new entry into the register.
This method inserts a new function (newFunction) taking a multiDim of type type_multidim (which actually inherit from MultiDimImplementation) and a hashTable assigning to some variables their values (actually the index of their values) in arguments. This new function's purpose is to achieve the instantiation of the variables of the hashtable within the multiDim. As such, it returns the table without these variables.
Note that although newFunction actually performs an operation on multiDims of type type_multidim, it should be declared as taking in argument two MultiDimImplementations. This constraint is imposed by the C++ typing system.
| instantiation_func_name | The name of the instantiation function. |
| type_multidim | The real type of the multiDim taken in argument by function newFunction. |
| newFunction | A pointer to the new function to register. |
|
static |
A named constructor that constructs one and only one Register per data type.
Note that this constructor prevents the famous init order fiasco.
References PartialInstantiationRegister4MultiDim().
|
private |
A mapping from the types of MultiDimImplementations to partial instantiation operators.
In this type, the strings represent the very types of the MultiDimImplementations that will be combined. Hence, to a subtype of MultiDimImplementation is associated a function to partially instantiate this subtype of hypermatrix (the PartialInstantiationPtr).
Definition at line 224 of file partialInstantiationRegister4MultiDim.h.