![]() |
aGrUM
0.20.3
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 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. More... | |
void | erase (const std::string &instantiation_func_name, const std::string &type_multidim) |
Removes a given entry from the register. More... | |
bool | exists (const std::string &instantiation_func_name, const std::string &type_multidim) const |
Indicates whether a given entry exists in the register. More... | |
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. More... | |
Static Public Member Functions | |
Named Constructors | |
static PartialInstantiationRegister4MultiDim & | Register () |
A named constructor that constructs one and only one Register per data type. More... | |
Public Types | |
typedef MultiDimImplementation< GUM_SCALAR > *(* | PartialInstantiationPtr) (const MultiDimImplementation< GUM_SCALAR > *, const HashTable< const DiscreteVariable *, Idx > &) |
The type of functions used by the register. More... | |
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 67 of file partialInstantiationRegister4MultiDim.h.
typedef MultiDimImplementation< GUM_SCALAR >*(* gum::PartialInstantiationRegister4MultiDim< GUM_SCALAR >::PartialInstantiationPtr) (const MultiDimImplementation< GUM_SCALAR > *, const HashTable< const DiscreteVariable *, Idx > &) |
The type of functions used by the register.
Definition at line 70 of file partialInstantiationRegister4MultiDim.h.
|
private |
The set of associations for a given partial instantiation type.
Definition at line 193 of file partialInstantiationRegister4MultiDim.h.
|
private |
Default constructor: creates an empty register.
|
private |
Copy operator: never to be used.
|
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.
|
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 204 of file partialInstantiationRegister4MultiDim.h.