aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
gum::PartialInstantiationRegister4MultiDim< GUM_SCALAR > Class Template Reference

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>

+ Collaboration diagram for gum::PartialInstantiationRegister4MultiDim< GUM_SCALAR >:

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 PartialInstantiationRegister4MultiDimRegister ()
 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...
 

Detailed Description

template<typename GUM_SCALAR>
class gum::PartialInstantiationRegister4MultiDim< GUM_SCALAR >

A container for registering partial instantiation functions on multiDimImplementations, i.e., functions assigning values to subsets of the variables of some tables.

Warning
Doxygen does not like spanning command on multiple line, so we could not configure it with the correct include directive. Use the following code snippet to include this file.
#include <agrum/tools/multidim/partialInstantiationRegister4MultiDim.h>
Template Parameters
GUM_SCALARThe type of scalars stored in the multidimensional table.

Definition at line 67 of file partialInstantiationRegister4MultiDim.h.

Member Typedef Documentation

◆ PartialInstantiationPtr

template<typename GUM_SCALAR >
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.

◆ PartialInstantiationSet

template<typename GUM_SCALAR >
typedef HashTable< std::string, PartialInstantiationPtr > gum::PartialInstantiationRegister4MultiDim< GUM_SCALAR >::PartialInstantiationSet
private

The set of associations for a given partial instantiation type.

Definition at line 193 of file partialInstantiationRegister4MultiDim.h.

Constructor & Destructor Documentation

◆ PartialInstantiationRegister4MultiDim() [1/2]

template<typename GUM_SCALAR >
gum::PartialInstantiationRegister4MultiDim< GUM_SCALAR >::PartialInstantiationRegister4MultiDim ( )
private

Default constructor: creates an empty register.

◆ PartialInstantiationRegister4MultiDim() [2/2]

template<typename GUM_SCALAR >
gum::PartialInstantiationRegister4MultiDim< GUM_SCALAR >::PartialInstantiationRegister4MultiDim ( const PartialInstantiationRegister4MultiDim< GUM_SCALAR > &  )
private

Copy operator: never to be used.

◆ ~PartialInstantiationRegister4MultiDim()

template<typename GUM_SCALAR >
gum::PartialInstantiationRegister4MultiDim< GUM_SCALAR >::~PartialInstantiationRegister4MultiDim ( )
private

Class destructor.

Member Function Documentation

◆ erase()

template<typename GUM_SCALAR >
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.

Parameters
instantiation_func_nameThe name of the instantiation performed by the function to remove.
type_multidimThe real type of the multiDim taken in argument by the function to remove.

◆ exists()

template<typename GUM_SCALAR >
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.

Parameters
instantiation_func_nameThe name of the instantiation performed by the function we look for.
type_multidimThe real type of the multiDim taken in argument by the function we look for.
Returns
Returns true if a given entry exists in the register.

◆ get()

template<typename GUM_SCALAR >
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.

Parameters
instantiation_func_namedescribes the name of the partial instantiation performed by the function we look for.
type_multidimthe real type of the multiDim taken in argument by the function we look for
Returns
Returns The function, if any, that performs the partial instantiation described by instantiation_name, and that takes in argument a multiDim of type type_multidim.
Exceptions
NotFoundRaised if the operator we look for does not exist within this register.

◆ insert()

template<typename GUM_SCALAR >
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.

Parameters
instantiation_func_nameThe name of the instantiation function.
type_multidimThe real type of the multiDim taken in argument by function newFunction.
newFunctionA pointer to the new function to register.

◆ Register()

template<typename GUM_SCALAR >
static PartialInstantiationRegister4MultiDim& gum::PartialInstantiationRegister4MultiDim< GUM_SCALAR >::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.

Member Data Documentation

◆ _set_

template<typename GUM_SCALAR >
HashTable< std::string, PartialInstantiationSet* > gum::PartialInstantiationRegister4MultiDim< GUM_SCALAR >::_set_
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.


The documentation for this class was generated from the following file: