![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
A PRMSystem is a container of PRMInstance and describe a relational skeleton. More...
#include <PRMObject.h>
Public Member Functions | |
Constructors & destructor. | |
PRMSystem (const std::string &name) | |
Default constructor. More... | |
virtual | ~PRMSystem () |
Destructor. More... | |
Getters & setters over the relational skeleton. | |
const DiGraph & | skeleton () const |
Returns the relation skeleton of this PRMSystem. More... | |
PRMInstance< GUM_SCALAR > & | get (NodeId id) |
Returns an PRMInstance given it's NodeId in the relational skeleton. More... | |
const PRMInstance< GUM_SCALAR > & | get (NodeId id) const |
Returns an PRMInstance given it's NodeId in the relational skeleton. More... | |
NodeId | get (const PRMInstance< GUM_SCALAR > &i) const |
Returns the relation skeleton of this PRMSystem. More... | |
Getters & setters over PRMInstance and array of PRMInstance. | |
virtual PRMObject::prm_type | obj_type () const |
Returns the PRM type of this object. More... | |
Size | size () const |
Returns the number of PRMInstance in this PRMSystem. More... | |
bool | exists (const std::string &name) const |
Retruns true either if name is an instance or an array in this PRMSystem. More... | |
bool | isInstantiated (const PRMClass< GUM_SCALAR > &c) const |
Returns true if the given Class<GUM_SCALAR> has at least one PRMInstance in this PRMSystem. More... | |
bool | isInstance (const std::string &name) const |
Returns true if an PRMInstance with the given name exists. More... | |
bool | isArray (const std::string &name) const |
Returns true if an array with the given name exists. More... | |
void | groundedBN (BayesNetFactory< GUM_SCALAR > &factory) const |
Returns the grounded Bayesian network of this system. More... | |
void | instantiate () |
Instantiate all the PRMInstance in this PRMSystem. More... | |
PRMInstance handling. | |
PRMInstance< GUM_SCALAR > & | get (const std::string &name) |
Returns a reference over an PRMInstance given it's name. More... | |
const PRMInstance< GUM_SCALAR > & | get (const std::string &name) const |
Returns a constant reference over an PRMInstance given it's name. More... | |
const Set< PRMInstance< GUM_SCALAR > *> & | get (const PRMClass< GUM_SCALAR > &type) const |
Returns the sequence of all instances of the given type. More... | |
NodeId | add (PRMInstance< GUM_SCALAR > *i) |
Add an PRMInstance to this system. More... | |
Array handling. | |
const Sequence< PRMInstance< GUM_SCALAR > *> & | getArray (const std::string &name) const |
Returns the sequence of instances of a given array. More... | |
PRMClassElementContainer< GUM_SCALAR > & | getArrayType (const std::string &name) |
Returns the type of the given array. More... | |
const PRMClassElementContainer< GUM_SCALAR > & | getArrayType (const std::string &name) const |
Returns the type of the given array. More... | |
NodeId | add (const std::string &array, PRMInstance< GUM_SCALAR > *i) |
Add an PRMInstance to an array in this system. If the array doesn't exists it is created. More... | |
NodeId | add (const std::string &array, PRMInstance< GUM_SCALAR > &i) |
Add an PRMInstance to an array in this system. If the array doesn't exists it is created. More... | |
void | addArray (const std::string &array, PRMClassElementContainer< GUM_SCALAR > &type) |
Add an array of instances in this system. If the array doesn't exists it is created. More... | |
Getters & setters. | |
const std::string & | name () const |
Returns the name of this object. More... | |
void | name (const std::string &name) |
Change the name of the PRM Object. More... | |
Operators | |
bool | operator== (const PRMObject &obj) const |
To PRMObject are equal if they have the same name (which is unique). More... | |
bool | operator!= (const PRMObject &obj) const |
To PRMObject are equal if they have the same name (which is unique). More... | |
Protected Member Functions | |
PRMSystem (const PRMSystem< GUM_SCALAR > &from) | |
Copy constructor. Don't use it. More... | |
PRMSystem< GUM_SCALAR > & | operator= (const PRMSystem< GUM_SCALAR > &from)=delete |
Copy operator. Don't use it. More... | |
Ground BN private methods. | |
void | _groundRef_ (const PRMInstance< GUM_SCALAR > &instance, BayesNetFactory< GUM_SCALAR > &factory) const |
Method which ground PRMReferenceSlot of an PRMInstance and add arcs in the IBayesNet. More... | |
void | _groundAttr_ (const PRMInstance< GUM_SCALAR > &instance, BayesNetFactory< GUM_SCALAR > &factory) const |
Method which ground Atttributes and Aggregators of an PRMInstance. More... | |
void | _groundPotential_ (const PRMInstance< GUM_SCALAR > &instance, const PRMAttribute< GUM_SCALAR > &attr, BayesNetFactory< GUM_SCALAR > &factory) const |
Method which copy node's Potential of an PRMInstance to the grounded Bayesian network. More... | |
void | _groundAgg_ (const PRMClassElement< GUM_SCALAR > &elt, const std::string &name, BayesNetFactory< GUM_SCALAR > &factory) const |
Ground an aggregator with the given name in the grounded IBayesNet. More... | |
Built-in types. | |
enum | prm_type : char { prm_type::ALL, prm_type::CLASS, prm_type::PRM_INTERFACE, prm_type::CLASS_ELT, prm_type::TYPE, prm_type::SYSTEM, prm_type::INSTANCE } |
Enumeration of the different types of objects handled by a PRM. More... | |
static std::string | LEFT_CAST () |
Enumeration of the different types of objects handled by a PRM. More... | |
static std::string | RIGHT_CAST () |
Enumeration of the different types of objects handled by a PRM. More... | |
static std::string | enum2str (prm_type type) |
Returns the string representation of a PRMObject. More... | |
static INLINE bool | isClass (const PRMObject &obj) |
Returns true if obj_ptr is of type Class. More... | |
static INLINE bool | isInterface (const PRMObject &obj) |
Returns true if obj_ptr is of type PRMInterface. More... | |
static INLINE bool | isInstance (const PRMObject &obj) |
Returns true if obj_ptr is of type PRMInstance. More... | |
Iterators. | |
typedef NodeProperty< PRMInstance< GUM_SCALAR > *>::iterator | iterator |
Iterator over the PRMInstance of this PRMSystem. More... | |
typedef NodeProperty< PRMInstance< GUM_SCALAR > *>::const_iterator | const_iterator |
Constant Iterator over the PRMInstance of this PRMSystem. More... | |
typedef Sequence< PRMInstance< GUM_SCALAR > *>::iterator | array_iterator |
Iterator over the PRMInstance in an array in this PRMSystem. More... | |
typedef Sequence< PRMInstance< GUM_SCALAR > *>::const_iterator | const_array_iterator |
Iterator over the PRMInstance in an array in this PRMSystem. More... | |
iterator | begin () |
Returns an iterator over the instances in this system. More... | |
const iterator & | end () |
Returns a iterator at the end of the set of PRMInstance in this PRMSystem. More... | |
const_iterator | begin () const |
Returns a constant iterator over the instances in this system. More... | |
const const_iterator & | end () const |
Returns a constant iterator at the end of the set of PRMInstance in this PRMSystem. More... | |
array_iterator | begin (const std::string &a) |
Returns an iterator at the beginning of the Sequence of PRMInstance in the array named a;. More... | |
const array_iterator & | end (const std::string &a) |
Returns an iterator at the end of the Sequence of PRMInstance in the array named a. More... | |
const_array_iterator | begin (const std::string &a) const |
Returns an iterator at the beginning of the Sequence of PRMInstance in the array named a;. More... | |
const const_array_iterator & | end (const std::string &a) const |
Returns an iterator at the end of the Sequence of PRMInstance in the array named a. More... | |
Private PRMInstance handling methods and members. | |
typedef std::pair< PRMClassElementContainer< GUM_SCALAR > *, Sequence< PRMInstance< GUM_SCALAR > *> *> | model_pair |
Typedef of the pair of a Class<GUM_SCALAR> and the sequence of it's instantiation. More... | |
DiGraph | skeleton_ |
The relational skeleton of this PRMSystem. More... | |
NodeProperty< PRMInstance< GUM_SCALAR > *> | nodeIdMap_ |
The mapping between PRMInstance and their NodeId in the relational skeleton of this PRMSystem. More... | |
HashTable< std::string, PRMInstance< GUM_SCALAR > *> | nameMap_ |
The mapping between PRMInstance and their names. More... | |
HashTable< PRMClass< GUM_SCALAR > *, Set< PRMInstance< GUM_SCALAR > *> *> | instanceMap_ |
Mapping between a class and all it's PRMInstance in this system. More... | |
HashTable< std::string, model_pair > | arrayMap_ |
Mapping between arrays and their name. The first element of the pair is the type of the array. More... | |
A PRMSystem is a container of PRMInstance and describe a relational skeleton.
Definition at line 234 of file PRMObject.h.
typedef Sequence< PRMInstance< GUM_SCALAR >* >::iterator gum::prm::PRMSystem< GUM_SCALAR >::array_iterator |
Iterator over the PRMInstance in an array in this PRMSystem.
Definition at line 222 of file PRMSystem.h.
typedef Sequence< PRMInstance< GUM_SCALAR >* >::const_iterator gum::prm::PRMSystem< GUM_SCALAR >::const_array_iterator |
Iterator over the PRMInstance in an array in this PRMSystem.
Definition at line 235 of file PRMSystem.h.
typedef NodeProperty< PRMInstance< GUM_SCALAR >* >::const_iterator gum::prm::PRMSystem< GUM_SCALAR >::const_iterator |
Constant Iterator over the PRMInstance of this PRMSystem.
Definition at line 212 of file PRMSystem.h.
typedef NodeProperty< PRMInstance< GUM_SCALAR >* >::iterator gum::prm::PRMSystem< GUM_SCALAR >::iterator |
Iterator over the PRMInstance of this PRMSystem.
Definition at line 202 of file PRMSystem.h.
|
protected |
Typedef of the pair of a Class<GUM_SCALAR> and the sequence of it's instantiation.
Definition at line 277 of file PRMSystem.h.
|
stronginherited |
Enumeration of the different types of objects handled by a PRM.
The "all" type is used to tell that we want any kind of PRMType (useful with iterators for example). No PRMObject will ever have "all" as type.
Enumerator | |
---|---|
ALL | |
CLASS | |
PRM_INTERFACE | |
CLASS_ELT | |
TYPE | |
SYSTEM | |
INSTANCE |
Definition at line 68 of file PRMObject.h.
|
explicit |
Default constructor.
Definition at line 41 of file PRMSystem_tpl.h.
|
virtual |
Destructor.
Definition at line 46 of file PRMSystem_tpl.h.
|
protected |
Copy constructor. Don't use it.
Definition at line 60 of file PRMSystem_tpl.h.
|
protected |
Ground an aggregator with the given name in the grounded IBayesNet.
elt | The aggregator grounded. |
name | The aggregator's name in the grounded IBayesNet. |
factory | The factory used to build the grounded IBayesNet. |
Definition at line 139 of file PRMSystem_tpl.h.
|
protected |
Method which ground Atttributes and Aggregators of an PRMInstance.
instance | The PRMInstance grounded by this method. |
factory | The factory used to build the grounded IBayesNet. |
Definition at line 105 of file PRMSystem_tpl.h.
|
protected |
Method which copy node's Potential of an PRMInstance to the grounded Bayesian network.
instance | The PRMInstance currently grounded. |
attr | The PRMAttribute<GUM_SCALAR> for which the Potential is grounded. |
factory | The factory used to build the grounded IBayesNet. |
Definition at line 291 of file PRMSystem_tpl.h.
|
protected |
Method which ground PRMReferenceSlot of an PRMInstance and add arcs in the IBayesNet.
instance | The PRMInstance grounded by this method. |
factory | The factory used to build the grounded IBayesNet. |
Definition at line 238 of file PRMSystem_tpl.h.
NodeId gum::prm::PRMSystem< GUM_SCALAR >::add | ( | PRMInstance< GUM_SCALAR > * | i | ) |
Add an PRMInstance to this system.
DuplicateElement | Raised if an PRMInstance with the same name already exists. |
Definition at line 67 of file PRMSystem_tpl.h.
INLINE NodeId gum::prm::PRMSystem< GUM_SCALAR >::add | ( | const std::string & | array, |
PRMInstance< GUM_SCALAR > * | i | ||
) |
Add an PRMInstance to an array in this system. If the array doesn't exists it is created.
PRMTypeError | Raised if i is not of the good type. |
DuplicateElement | Raised if an PRMInstance with same name already exists. |
Definition at line 469 of file PRMSystem_tpl.h.
INLINE NodeId gum::prm::PRMSystem< GUM_SCALAR >::add | ( | const std::string & | array, |
PRMInstance< GUM_SCALAR > & | i | ||
) |
Add an PRMInstance to an array in this system. If the array doesn't exists it is created.
PRMTypeError | Raised if i is not of the good type. |
DuplicateElement | Raised if an PRMInstance with same name already exists. |
Definition at line 344 of file PRMSystem_tpl.h.
INLINE void gum::prm::PRMSystem< GUM_SCALAR >::addArray | ( | const std::string & | array, |
PRMClassElementContainer< GUM_SCALAR > & | type | ||
) |
Add an array of instances in this system. If the array doesn't exists it is created.
DuplicateElement | Raised if an existing array with the same name already exists. |
Definition at line 485 of file PRMSystem_tpl.h.
INLINE PRMSystem< GUM_SCALAR >::iterator gum::prm::PRMSystem< GUM_SCALAR >::begin | ( | ) |
Returns an iterator over the instances in this system.
Definition at line 497 of file PRMSystem_tpl.h.
INLINE PRMSystem< GUM_SCALAR >::const_iterator gum::prm::PRMSystem< GUM_SCALAR >::begin | ( | ) | const |
Returns a constant iterator over the instances in this system.
Definition at line 507 of file PRMSystem_tpl.h.
INLINE PRMSystem< GUM_SCALAR >::array_iterator gum::prm::PRMSystem< GUM_SCALAR >::begin | ( | const std::string & | a | ) |
Returns an iterator at the beginning of the Sequence of PRMInstance in the array named a;.
NotFound | Raised if no array matches a. |
Definition at line 519 of file PRMSystem_tpl.h.
INLINE PRMSystem< GUM_SCALAR >::const_array_iterator gum::prm::PRMSystem< GUM_SCALAR >::begin | ( | const std::string & | a | ) | const |
Returns an iterator at the beginning of the Sequence of PRMInstance in the array named a;.
NotFound | Raised if no array matches a. |
Definition at line 535 of file PRMSystem_tpl.h.
INLINE const PRMSystem< GUM_SCALAR >::iterator & gum::prm::PRMSystem< GUM_SCALAR >::end | ( | ) |
Returns a iterator at the end of the set of PRMInstance in this PRMSystem.
Definition at line 502 of file PRMSystem_tpl.h.
INLINE const PRMSystem< GUM_SCALAR >::const_iterator & gum::prm::PRMSystem< GUM_SCALAR >::end | ( | ) | const |
Returns a constant iterator at the end of the set of PRMInstance in this PRMSystem.
Definition at line 513 of file PRMSystem_tpl.h.
INLINE const PRMSystem< GUM_SCALAR >::array_iterator & gum::prm::PRMSystem< GUM_SCALAR >::end | ( | const std::string & | a | ) |
Returns an iterator at the end of the Sequence of PRMInstance in the array named a.
NotFound | Raised if no array matches a. |
Definition at line 527 of file PRMSystem_tpl.h.
INLINE const PRMSystem< GUM_SCALAR >::const_array_iterator & gum::prm::PRMSystem< GUM_SCALAR >::end | ( | const std::string & | a | ) | const |
Returns an iterator at the end of the Sequence of PRMInstance in the array named a.
NotFound | Raised if no array matches a. |
Definition at line 543 of file PRMSystem_tpl.h.
|
inlinestaticinherited |
INLINE bool gum::prm::PRMSystem< GUM_SCALAR >::exists | ( | const std::string & | name | ) | const |
Retruns true either if name is an instance or an array in this PRMSystem.
Definition at line 550 of file PRMSystem_tpl.h.
INLINE PRMInstance< GUM_SCALAR > & gum::prm::PRMSystem< GUM_SCALAR >::get | ( | NodeId | id | ) |
Returns an PRMInstance given it's NodeId in the relational skeleton.
NotFound | Raised if no PRMInstance matches the given NodeId. |
Definition at line 355 of file PRMSystem_tpl.h.
INLINE const PRMInstance< GUM_SCALAR > & gum::prm::PRMSystem< GUM_SCALAR >::get | ( | NodeId | id | ) | const |
Returns an PRMInstance given it's NodeId in the relational skeleton.
NotFound | Raised if no PRMInstance matches the given NodeId. |
Definition at line 364 of file PRMSystem_tpl.h.
INLINE NodeId gum::prm::PRMSystem< GUM_SCALAR >::get | ( | const PRMInstance< GUM_SCALAR > & | i | ) | const |
Returns the relation skeleton of this PRMSystem.
Definition at line 373 of file PRMSystem_tpl.h.
INLINE PRMInstance< GUM_SCALAR > & gum::prm::PRMSystem< GUM_SCALAR >::get | ( | const std::string & | name | ) |
Returns a reference over an PRMInstance given it's name.
NotFound | Raised if the no PRMInstance matches name. |
Definition at line 414 of file PRMSystem_tpl.h.
INLINE const PRMInstance< GUM_SCALAR > & gum::prm::PRMSystem< GUM_SCALAR >::get | ( | const std::string & | name | ) | const |
Returns a constant reference over an PRMInstance given it's name.
NotFound | Raised if the no PRMInstance matches name. |
Definition at line 424 of file PRMSystem_tpl.h.
INLINE const Set< PRMInstance< GUM_SCALAR > *> & gum::prm::PRMSystem< GUM_SCALAR >::get | ( | const PRMClass< GUM_SCALAR > & | type | ) | const |
Returns the sequence of all instances of the given type.
NotFound | Raised if there is instantiation of type. |
Definition at line 435 of file PRMSystem_tpl.h.
INLINE const Sequence< PRMInstance< GUM_SCALAR > *> & gum::prm::PRMSystem< GUM_SCALAR >::getArray | ( | const std::string & | name | ) | const |
Returns the sequence of instances of a given array.
NotFound | Raised if no array matches name. |
Definition at line 446 of file PRMSystem_tpl.h.
INLINE PRMClassElementContainer< GUM_SCALAR > & gum::prm::PRMSystem< GUM_SCALAR >::getArrayType | ( | const std::string & | name | ) |
Returns the type of the given array.
NotFound | Raised if no array matches name. |
Definition at line 454 of file PRMSystem_tpl.h.
INLINE const PRMClassElementContainer< GUM_SCALAR > & gum::prm::PRMSystem< GUM_SCALAR >::getArrayType | ( | const std::string & | name | ) | const |
Returns the type of the given array.
NotFound | Raised if no array matches name. |
Definition at line 462 of file PRMSystem_tpl.h.
void gum::prm::PRMSystem< GUM_SCALAR >::groundedBN | ( | BayesNetFactory< GUM_SCALAR > & | factory | ) | const |
Returns the grounded Bayesian network of this system.
factory | The factory used to build the grounded Bayesian network. |
Definition at line 88 of file PRMSystem_tpl.h.
INLINE void gum::prm::PRMSystem< GUM_SCALAR >::instantiate | ( | ) |
Instantiate all the PRMInstance in this PRMSystem.
Definition at line 407 of file PRMSystem_tpl.h.
INLINE bool gum::prm::PRMSystem< GUM_SCALAR >::isArray | ( | const std::string & | name | ) | const |
Returns true if an array with the given name exists.
Definition at line 402 of file PRMSystem_tpl.h.
Returns true if obj_ptr is of type Class.
Definition at line 109 of file PRMObject.h.
References gum::prm::PRMObject::PRMObject().
Returns true if obj_ptr is of type PRMInstance.
Definition at line 117 of file PRMObject.h.
References gum::prm::PRMObject::PRMObject().
INLINE bool gum::prm::PRMSystem< GUM_SCALAR >::isInstance | ( | const std::string & | name | ) | const |
Returns true if an PRMInstance with the given name exists.
Definition at line 397 of file PRMSystem_tpl.h.
INLINE bool gum::prm::PRMSystem< GUM_SCALAR >::isInstantiated | ( | const PRMClass< GUM_SCALAR > & | c | ) | const |
Returns true if the given Class<GUM_SCALAR> has at least one PRMInstance in this PRMSystem.
Definition at line 392 of file PRMSystem_tpl.h.
Returns true if obj_ptr is of type PRMInterface.
Definition at line 112 of file PRMObject.h.
References gum::prm::PRMObject::PRMObject().
|
inlinestaticinherited |
Enumeration of the different types of objects handled by a PRM.
The "all" type is used to tell that we want any kind of PRMType (useful with iterators for example). No PRMObject will ever have "all" as type.
Definition at line 79 of file PRMObject.h.
|
inherited |
Returns the name of this object.
Definition at line 34 of file PRMObject_inl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
inherited |
Change the name of the PRM Object.
Definition at line 38 of file PRMObject_inl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
virtual |
Returns the PRM type of this object.
Implements gum::prm::PRMObject.
Definition at line 382 of file PRMSystem_tpl.h.
To PRMObject are equal if they have the same name (which is unique).
Definition at line 46 of file PRMObject_inl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
protecteddelete |
Copy operator. Don't use it.
To PRMObject are equal if they have the same name (which is unique).
Definition at line 42 of file PRMObject_inl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
inlinestaticinherited |
Enumeration of the different types of objects handled by a PRM.
The "all" type is used to tell that we want any kind of PRMType (useful with iterators for example). No PRMObject will ever have "all" as type.
Definition at line 80 of file PRMObject.h.
INLINE Size gum::prm::PRMSystem< GUM_SCALAR >::size | ( | ) | const |
Returns the number of PRMInstance in this PRMSystem.
Definition at line 387 of file PRMSystem_tpl.h.
INLINE const DiGraph & gum::prm::PRMSystem< GUM_SCALAR >::skeleton | ( | ) | const |
Returns the relation skeleton of this PRMSystem.
Definition at line 350 of file PRMSystem_tpl.h.
|
protected |
Mapping between arrays and their name. The first element of the pair is the type of the array.
Definition at line 281 of file PRMSystem.h.
|
protected |
Mapping between a class and all it's PRMInstance in this system.
Definition at line 271 of file PRMSystem.h.
|
protected |
The mapping between PRMInstance and their names.
Definition at line 268 of file PRMSystem.h.
|
protected |
The mapping between PRMInstance and their NodeId in the relational skeleton of this PRMSystem.
Definition at line 265 of file PRMSystem.h.
|
protected |
The relational skeleton of this PRMSystem.
Definition at line 261 of file PRMSystem.h.