![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
A PRMSlotChain represents a sequence of gum::prm::PRMClassElement<GUM_SCALAR> where the n-1 first gum::prm::PRMClassElement<GUM_SCALAR> are gum::prm::PRMReferenceSlot and the last gum::prm::PRMClassElement<GUM_SCALAR> an gum::prm::PRMAttribute or an gum::prm::PRMAggregate. More...
#include <PRMObject.h>
Public Member Functions | |
Constructors & destructor | |
PRMSlotChain (const std::string &name, const Sequence< PRMClassElement< GUM_SCALAR > * > &chain) | |
Default constructor. More... | |
PRMSlotChain (Sequence< PRMClassElement< GUM_SCALAR > * > *chain, const std::string &name) | |
Tweak constructor. More... | |
PRMSlotChain (const PRMSlotChain< GUM_SCALAR > &source) | |
Copy constructor. More... | |
virtual | ~PRMSlotChain () |
Destructor. More... | |
Getters & setters | |
virtual PRMClassElement< GUM_SCALAR >::ClassElementType | elt_type () const |
See gum::PRMClassElement<GUM_SCALAR>::elt_type(). More... | |
virtual PRMType & | type () |
This is similar to the following call: this->lastElt().type() More... | |
virtual const PRMType & | type () const |
This is similar to the following call: this->lastElt().type() More... | |
virtual const Potential< GUM_SCALAR > & | cpf () const |
This is similar to the following call: this->lastElt().cpf() More... | |
bool | isMultiple () const |
Return true if this slot chain contains at least one multiple reference slot. More... | |
PRMClassElementContainer< GUM_SCALAR > & | end () |
Returns the PRMClassElement<GUM_SCALAR>Container over which this slot chain ends. More... | |
const PRMClassElementContainer< GUM_SCALAR > & | end () const |
Returns the PRMClassElement<GUM_SCALAR>Container over which this slot chain ends. More... | |
PRMClassElement< GUM_SCALAR > & | lastElt () |
Returns the last element of the slot chain, typically this is an gum::PRMAttribute or a gum::PRMAggregate. More... | |
const PRMClassElement< GUM_SCALAR > & | lastElt () const |
Returns the last element of the slot chain, typically this is an gum::PRMAttribute or a gum::PRMAggregate. More... | |
Sequence< PRMClassElement< GUM_SCALAR > *> & | chain () |
Return the sequence representing the chain of elements in this PRMSlotChain. More... | |
const Sequence< PRMClassElement< GUM_SCALAR > *> & | chain () const |
Return the sequence representing the chain of elements in this PRMSlotChain. More... | |
virtual void | addParent (const PRMClassElement< GUM_SCALAR > &elt) |
See gum::PRMClassElement<GUM_SCALAR>::addParent_(). More... | |
virtual void | addChild (const PRMClassElement< GUM_SCALAR > &elt) |
See gum::PRMClassElement<GUM_SCALAR>::addChild_(). More... | |
virtual PRMAttribute< GUM_SCALAR > * | getCastDescendant () const |
Raise a gum::OperationNotAllowed exception See gum::PRMClassElement<GUM_SCALAR>::getCastDescendant() More... | |
Getters & setters | |
NodeId | id () const |
Returns the NodeId of this element in it's class DAG. More... | |
virtual void | setId (NodeId id) |
Used to assign the id of this element. More... | |
virtual PRMObject::prm_type | obj_type () const |
Fast access to random variable's properties | |
const std::string & | safeName () const |
Returns the safe name of this PRMClassElement, if any. More... | |
virtual std::string | cast (const PRMType &t) const |
Returns the name of the cast descendant with PRMType t of this PRMClassElement. 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 Attributes | |
std::string | safeName_ |
The safe name of this PRMClassElement. More... | |
Built-in type | |
enum | ClassElementType { prm_attribute, prm_aggregate, prm_refslot, prm_slotchain, prm_parameter } |
Returns true if obj_ptr is of type PRMReferenceSlot. More... | |
static std::string | enum2str (ClassElementType type) |
Returns true if obj_ptr is of type PRMReferenceSlot. More... | |
static INLINE bool | isReferenceSlot (const PRMClassElement< GUM_SCALAR > &elt) |
Returns true if obj_ptr is of type PRMReferenceSlot. More... | |
static INLINE bool | isAttribute (const PRMClassElement< GUM_SCALAR > &elt) |
Returns true if obj_ptr is of type PRMAttribute. More... | |
static INLINE bool | isAggregate (const PRMClassElement< GUM_SCALAR > &elt) |
Return true if obj is of type PRMAggregate. More... | |
static INLINE bool | isSlotChain (const PRMClassElement< GUM_SCALAR > &elt) |
Return true if obj is of type PRMSlotChain. More... | |
static INLINE bool | isParameter (const PRMClassElement< GUM_SCALAR > &elt) |
Return true if obj is of type PRMParameter. 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 | enum2str (prm_type type) |
Returns the string representation of a PRMObject. 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 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... | |
Private members of PRMSlotChain. | |
Sequence< PRMClassElement< GUM_SCALAR > *> * | _chain_ |
The sequence of PRMClassElement<GUM_SCALAR> composing the slot chain. More... | |
bool | _isMultiple_ |
Flag indicating if this slot chain is multiple or not. More... | |
void | _copyLastElt_ () |
Copy the last element, this prevents unwanted DuplicateElement exceptions. More... | |
A PRMSlotChain represents a sequence of gum::prm::PRMClassElement<GUM_SCALAR> where the n-1 first gum::prm::PRMClassElement<GUM_SCALAR> are gum::prm::PRMReferenceSlot and the last gum::prm::PRMClassElement<GUM_SCALAR> an gum::prm::PRMAttribute or an gum::prm::PRMAggregate.
A PRMSlotChain behaves as an gum::prm::PRMAttribute or an gum::prm::PRMAggregate (depending the gum::prm::PRMClassElement<GUM_SCALAR> type of it's last element) regarding the following methods: gum::prm::PRMClassElement<GUM_SCALAR>::type() and gum::prm::PRMClassElement<GUM_SCALAR>::cpf().
Definition at line 226 of file PRMObject.h.
|
inherited |
Returns true if obj_ptr is of type PRMReferenceSlot.
Enumerator | |
---|---|
prm_attribute | |
prm_aggregate | |
prm_refslot | |
prm_slotchain | |
prm_parameter |
Definition at line 94 of file PRMClassElement.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.
gum::prm::PRMSlotChain< GUM_SCALAR >::PRMSlotChain | ( | const std::string & | name, |
const Sequence< PRMClassElement< GUM_SCALAR > * > & | chain | ||
) |
Default constructor.
Chain's n-1 first elements must be PRMReferenceSlot and the last element must either be an PRMAttribute or an PRMAggregate.
Warning: the last element in chain is copied !
name | The name of this PRMSlotChain. |
chain | The chain of gum::prm::PRMClassElement<GUM_SCALAR> in this PRMSlotChain. |
OperationNotAllowed | Raised if the chain contains less than two PRMClassElement<GUM_SCALAR>. |
WrongClassElement<GUM_SCALAR> | Raised contains invalid PRMClassElement<GUM_SCALAR>. |
Definition at line 34 of file PRMSlotChain_tpl.h.
gum::prm::PRMSlotChain< GUM_SCALAR >::PRMSlotChain | ( | Sequence< PRMClassElement< GUM_SCALAR > * > * | chain, |
const std::string & | name | ||
) |
Tweak constructor.
Chain's n-1 first elements must be PRMReferenceSlot and the last element must either be an PRMAttribute or an PRMAggregate.
Warning: the last element in chain is copied !
name | The name of this PRMSlotChain. |
chain | The chain given to this PRMSlotChain, it is deleted when PRMSlotChain::~PRMSlotChain() is called. |
OperationNotAllowed | Raised if the chain contains less than two PRMClassElement<GUM_SCALAR>. |
WrongClassElement<GUM_SCALAR> | Raised contains invalid PRMClassElement<GUM_SCALAR>. |
Definition at line 65 of file PRMSlotChain_tpl.h.
gum::prm::PRMSlotChain< GUM_SCALAR >::PRMSlotChain | ( | const PRMSlotChain< GUM_SCALAR > & | source | ) |
Copy constructor.
This creates a copy of the slot chain.
Definition at line 138 of file PRMSlotChain_tpl.h.
|
virtual |
Destructor.
Definition at line 131 of file PRMSlotChain_tpl.h.
|
private |
Copy the last element, this prevents unwanted DuplicateElement exceptions.
Definition at line 94 of file PRMSlotChain_tpl.h.
|
virtual |
See gum::PRMClassElement<GUM_SCALAR>::addChild_().
Implements gum::prm::PRMClassElement< GUM_SCALAR >.
Definition at line 210 of file PRMSlotChain_tpl.h.
|
virtual |
See gum::PRMClassElement<GUM_SCALAR>::addParent_().
Implements gum::prm::PRMClassElement< GUM_SCALAR >.
Definition at line 207 of file PRMSlotChain_tpl.h.
|
virtualinherited |
Returns the name of the cast descendant with PRMType t of this PRMClassElement.
t | The type in which we want to cast this PRMClassElement. |
OperationNotAllowed | If the cast is impossible. |
Definition at line 71 of file PRMClassElement_tpl.h.
INLINE Sequence< PRMClassElement< GUM_SCALAR > *> & gum::prm::PRMSlotChain< GUM_SCALAR >::chain | ( | ) |
Return the sequence representing the chain of elements in this PRMSlotChain.
Definition at line 196 of file PRMSlotChain_tpl.h.
INLINE const Sequence< PRMClassElement< GUM_SCALAR > *> & gum::prm::PRMSlotChain< GUM_SCALAR >::chain | ( | ) | const |
Return the sequence representing the chain of elements in this PRMSlotChain.
Definition at line 202 of file PRMSlotChain_tpl.h.
|
virtual |
This is similar to the following call: this->lastElt().cpf()
Implements gum::prm::PRMClassElement< GUM_SCALAR >.
Definition at line 169 of file PRMSlotChain_tpl.h.
|
virtual |
See gum::PRMClassElement<GUM_SCALAR>::elt_type().
Implements gum::prm::PRMClassElement< GUM_SCALAR >.
Definition at line 154 of file PRMSlotChain_tpl.h.
INLINE PRMClassElementContainer< GUM_SCALAR > & gum::prm::PRMSlotChain< GUM_SCALAR >::end | ( | ) |
Returns the PRMClassElement<GUM_SCALAR>Container over which this slot chain ends.
Definition at line 174 of file PRMSlotChain_tpl.h.
INLINE const PRMClassElementContainer< GUM_SCALAR > & gum::prm::PRMSlotChain< GUM_SCALAR >::end | ( | ) | const |
Returns the PRMClassElement<GUM_SCALAR>Container over which this slot chain ends.
Definition at line 180 of file PRMSlotChain_tpl.h.
|
inlinestaticinherited |
|
inlinestaticinherited |
Returns true if obj_ptr is of type PRMReferenceSlot.
Definition at line 103 of file PRMClassElement.h.
|
virtual |
Raise a gum::OperationNotAllowed exception See gum::PRMClassElement<GUM_SCALAR>::getCastDescendant()
Implements gum::prm::PRMClassElement< GUM_SCALAR >.
Definition at line 218 of file PRMSlotChain_tpl.h.
|
inherited |
Returns the NodeId of this element in it's class DAG.
Definition at line 51 of file PRMClassElement_tpl.h.
|
inlinestaticinherited |
|
inlinestaticinherited |
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().
Returns true if obj_ptr is of type PRMInterface.
Definition at line 112 of file PRMObject.h.
References gum::prm::PRMObject::PRMObject().
INLINE bool gum::prm::PRMSlotChain< GUM_SCALAR >::isMultiple | ( | ) | const |
Return true if this slot chain contains at least one multiple reference slot.
Definition at line 213 of file PRMSlotChain_tpl.h.
|
inlinestaticinherited |
|
inlinestaticinherited |
Returns true if obj_ptr is of type PRMReferenceSlot.
Definition at line 126 of file PRMClassElement.h.
|
inlinestaticinherited |
INLINE PRMClassElement< GUM_SCALAR > & gum::prm::PRMSlotChain< GUM_SCALAR >::lastElt | ( | ) |
Returns the last element of the slot chain, typically this is an gum::PRMAttribute or a gum::PRMAggregate.
Definition at line 186 of file PRMSlotChain_tpl.h.
INLINE const PRMClassElement< GUM_SCALAR > & gum::prm::PRMSlotChain< GUM_SCALAR >::lastElt | ( | ) | const |
Returns the last element of the slot chain, typically this is an gum::PRMAttribute or a gum::PRMAggregate.
Definition at line 191 of file PRMSlotChain_tpl.h.
|
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().
|
virtualinherited |
Implements gum::prm::PRMObject.
Definition at line 56 of file PRMClassElement_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().
|
private |
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.
|
inherited |
Returns the safe name of this PRMClassElement, if any.
This will only work if this PRMClassElement is an PRMAttribute or an PRMAggregate.
NotFound& | Raised if this PRMClassElement does not have any safe name. |
Definition at line 66 of file PRMClassElement_tpl.h.
|
virtualinherited |
Used to assign the id of this element.
Definition at line 61 of file PRMClassElement_tpl.h.
|
virtual |
This is similar to the following call: this->lastElt().type()
Implements gum::prm::PRMClassElement< GUM_SCALAR >.
Definition at line 159 of file PRMSlotChain_tpl.h.
|
virtual |
This is similar to the following call: this->lastElt().type()
Implements gum::prm::PRMClassElement< GUM_SCALAR >.
Definition at line 164 of file PRMSlotChain_tpl.h.
|
private |
The sequence of PRMClassElement<GUM_SCALAR> composing the slot chain.
Definition at line 207 of file PRMSlotChain.h.
|
private |
Flag indicating if this slot chain is multiple or not.
Definition at line 210 of file PRMSlotChain.h.
|
protectedinherited |
The safe name of this PRMClassElement.
Definition at line 265 of file PRMClassElement.h.