![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
A container for registering binary functions on multiDimImplementations. More...
#include <agrum/multdim/operators/operatorRegister4MultiDim.h>
Public Member Functions | |
Accessors / Modifiers | |
void | insert (const std::string &operation_name, const std::string &type1, const std::string &type2, OperatorPtr newFunction) |
adds a new entry into the register More... | |
void | erase (const std::string &operation_name, const std::string &type1, const std::string &type2) |
removes a given entry from the register More... | |
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. More... | |
OperatorPtr | get (const std::string &operation_name, const std::string &type1, const std::string &type2) const |
returns the specialized operator assigned to a given pair of MultiDimImplementations More... | |
Static Public Member Functions | |
Named Constructors | |
static OperatorRegister4MultiDim< GUM_SCALAR > & | Register () |
A named constructor that constructs one and only one Register per data type. More... | |
Public Types | |
typedef MultiDimImplementation< GUM_SCALAR > *(* | OperatorPtr) (const MultiDimImplementation< GUM_SCALAR > *, const MultiDimImplementation< GUM_SCALAR > *) |
The type of functions used by the register. More... | |
A container for registering binary functions on multiDimImplementations.
Definition at line 58 of file operatorRegister4MultiDim.h.
typedef MultiDimImplementation< GUM_SCALAR >*(* gum::OperatorRegister4MultiDim< GUM_SCALAR >::OperatorPtr) (const MultiDimImplementation< GUM_SCALAR > *, const MultiDimImplementation< GUM_SCALAR > *) |
The type of functions used by the register.
Definition at line 61 of file operatorRegister4MultiDim.h.
|
private |
The set of associations for a given operation type.
Definition at line 200 of file operatorRegister4MultiDim.h.
|
private |
Default constructor: creates an empty register.
|
private |
Copy operator: never to be used.
|
private |
Destructor.
void gum::OperatorRegister4MultiDim< GUM_SCALAR >::erase | ( | const std::string & | operation_name, |
const std::string & | type1, | ||
const std::string & | type2 | ||
) |
removes a given entry from the register
removes the function, if any, that performs the operation described by operation_name, and that takes in argument a multiDim of type type1 and one multiDim of type type2
operation_name | describes the name of the operation performed by the function to remove. Usual operation names are "+", "*", "/", "-", "max", "min" |
type1 | the real type of the first multiDim taken in argument by the function to remove |
type2 | the real type of the second multiDim taken in argument by the function to remove. |
bool gum::OperatorRegister4MultiDim< GUM_SCALAR >::exists | ( | const std::string & | operation_name, |
const std::string & | type1, | ||
const std::string & | type2 | ||
) | const |
Indicates whether a given entry exists in the register.
Indicates if the register contains a function that performs the operation described by operation_name, and that takes in argument a multiDim of type type1 and one multiDim of type type2
operation_name | describes the name of the operation performed by the function we look for. Usual operation names are "+", "*", "/", "-", "max", "min" |
type1 | the real type of the first multiDim taken in argument by the function we look for |
type2 | the real type of the second multiDim taken in argument by the function we look for |
OperatorPtr gum::OperatorRegister4MultiDim< GUM_SCALAR >::get | ( | const std::string & | operation_name, |
const std::string & | type1, | ||
const std::string & | type2 | ||
) | const |
returns the specialized operator assigned to a given pair of MultiDimImplementations
returns the function, if any, that performs the operation described by operation_name, and that takes in argument a multiDim of type type1 and one multiDim of type type2
operation_name | describes the name of the operation performed by the function we look for. Usual operation names are "+", "*", "/", "-", "max", "min" |
type1 | the real type of the first multiDim taken in argument by the function we look for |
type2 | the real type of the second 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::OperatorRegister4MultiDim< GUM_SCALAR >::insert | ( | const std::string & | operation_name, |
const std::string & | type1, | ||
const std::string & | type2, | ||
OperatorPtr | newFunction | ||
) |
adds a new entry into the register
This method inserts a new function (newFunction) taking two multiDim in arguments of types type1 and type2 respectively (which actually inherit from MultiDimImplementation). This new function's purpose is to achieve the operator described by operation_name. For instance, if operator_name is "+", "-", "/" or "*", the new function performs the usual algebraic operations.
operation_name | describes the name of the operation performed by newFunction. Usual operation names are "+", "*", "/", "-", "max", "min" |
type1 | the real type of the first multiDim taken in argument by function newFunction |
type2 | the real type of the second 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 types type1 and type2, 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.
|
private |
A mapping from pairs of types of MultiDimImplementations to operators.
In this type, the strings represent the very types of the MultiDimImplementations that will be combined. To a pair of strings, hence to a pair of types of MultiDimImplementations, is associated a function to combine them (the OperatorPtr).
Definition at line 211 of file operatorRegister4MultiDim.h.