![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
A container for registering projection functions on multiDimImplementations, i.e., functions projecting tables over a subset of their variables. More...
#include <agrum/base/multidim/operators/projectionRegister4MultiDim.h>
Public Types | |
| using | ProjectionPtr |
| the type of functions used by the register | |
Public Member Functions | |
Accessors / Modifiers | |
| void | insert (const std::string &projection_name, const std::string &type_multidim, ProjectionPtr newFunction) |
| adds a new entry into the register | |
| 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 | |
| ProjectionPtr | get (const std::string &projection_name, const std::string &type_multidim) const |
| returns the specialized projection operator assigned to a given type of MultiDimImplementation | |
Static Public Member Functions | |
Named Constructors | |
| static ProjectionRegister4MultiDim & | Register () |
| a named constructor that constructs one and only one Register per data type | |
Private Types | |
| using | ProjectionSet = HashTable< std::string, ProjectionPtr > |
| The set of associations for a given projection type. | |
Private Member Functions | |
Constructors / Destructors | |
| ProjectionRegister4MultiDim () | |
| Default constructor: creates an empty register. | |
| ProjectionRegister4MultiDim (const ProjectionRegister4MultiDim &) | |
| Copy operator: never to be used. | |
| ~ProjectionRegister4MultiDim () | |
| Destructor. | |
Private Attributes | |
| HashTable< std::string, ProjectionSet * > | _set_ |
| A mapping from the types of MultiDimImplementations to projection operators. | |
A container for registering projection functions on multiDimImplementations, i.e., functions projecting tables over a subset of their variables.
Definition at line 82 of file projectionRegister4MultiDim.h.
| using gum::ProjectionRegister4MultiDim< GUM_SCALAR >::ProjectionPtr |
the type of functions used by the register
Definition at line 85 of file projectionRegister4MultiDim.h.
|
private |
The set of associations for a given projection type.
Definition at line 206 of file projectionRegister4MultiDim.h.
|
private |
Default constructor: creates an empty register.
Referenced by ProjectionRegister4MultiDim(), and Register().
|
private |
Copy operator: never to be used.
References ProjectionRegister4MultiDim().
|
private |
Destructor.
| void gum::ProjectionRegister4MultiDim< GUM_SCALAR >::erase | ( | const std::string & | projection_name, |
| const std::string & | type_multidim ) |
removes a given entry from the register
Removes the function, if any, that performs the projection described by projection_name, and that takes in argument a multiDim of type type_multidim
| projection_name | describes the name of the projection performed by the function to remove. Usual projection names are "min", "max", "sum", "product" |
| type_multidim | the real type of the multiDim taken in argument by the function to remove |
| bool gum::ProjectionRegister4MultiDim< GUM_SCALAR >::exists | ( | const std::string & | projection_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 projection described by projection_name, and that takes in argument a multiDim of type type_multidim.
| projection_name | describes the name of the projection performed by the function we look for. Usual projection names are "min", "max", "sum", "product" |
| type_multidim | the real type of the multiDim taken in argument by the function we look for |
| ProjectionPtr gum::ProjectionRegister4MultiDim< GUM_SCALAR >::get | ( | const std::string & | projection_name, |
| const std::string & | type_multidim ) const |
returns the specialized projection operator assigned to a given type of MultiDimImplementation
Returns the function, if any, that performs the projection described by projection_name, and that takes in argument a multiDim of type type_multidim
| projection_name | describes the name of the projection performed by the function we look for. Usual projection names are "min", "max", "sum", "product" |
| type_multidim | the real type of the multiDim taken in argument by the function we look for |
| NotFound | exception is thrown if the operator we look for does not exist within this register. |
| void gum::ProjectionRegister4MultiDim< GUM_SCALAR >::insert | ( | const std::string & | projection_name, |
| const std::string & | type_multidim, | ||
| ProjectionPtr | 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 set of discrete variables (to remove from the multidim) in arguments. This new function's purpose is to achieve the projection described by projection_name. For instance, if projection_name is "max", "min", "sum" or "product", the new function performs the usual algebraic operations.
| projection_name | describes the name of the operation performed by newFunction. Usual operation names are "min", "max", "sum", "product" |
| type_multidim | the real type of the multiDim taken in argument by function newFunction |
| newFunction | a pointer to the new function to register. 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 |
|
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 ProjectionRegister4MultiDim().
|
private |
A mapping from the types of MultiDimImplementations to projection 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 project this subtype of hypermatrix (the ProjectionPtr)
Definition at line 217 of file projectionRegister4MultiDim.h.