![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
Abstract class representing an element of PRM class. More...
#include <PRMClassElement.h>
Public Member Functions | |
Constructor & Destructor. | |
PRMClassElement (const std::string &name) | |
Default constructor of a PRMClassElement. More... | |
PRMClassElement (const PRMClassElement< GUM_SCALAR > &source) | |
Copy constructor. More... | |
virtual | ~PRMClassElement () |
Destructor of this class. 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 void | addParent (const PRMClassElement< GUM_SCALAR > &elt)=0 |
Add a parent to this element. More... | |
virtual void | addChild (const PRMClassElement< GUM_SCALAR > &elt)=0 |
Add a child to this element. More... | |
virtual PRMObject::prm_type | obj_type () const |
virtual ClassElementType | elt_type () const =0 |
Return the type of class element this object is. More... | |
Fast access to random variable's properties | |
virtual PRMType & | type ()=0 |
Return a reference over the gum::PRMType of this class element. More... | |
virtual const PRMType & | type () const =0 |
Return a constant reference over the gum::PRMType of this class element. More... | |
virtual PRMAttribute< GUM_SCALAR > * | getCastDescendant () const =0 |
Returns a proper cast descendant of this PRMAttribute. More... | |
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... | |
virtual const Potential< GUM_SCALAR > & | cpf () const =0 |
Return a reference over the gum::Potential of this class element. 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 | 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... | |
Abstract class representing an element of PRM class.
All class elements are nodes in the class's DAG and a unique name in their class.
Definition at line 60 of file PRMClassElement.h.
enum gum::prm::PRMClassElement::ClassElementType |
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.
|
explicit |
Default constructor of a PRMClassElement.
The PRMClassElement will automatically add itself to c.
name | The name of this element, must be unique in it's class. |
DupplicateElement | Raised if c contains already an element with the same name. |
Definition at line 35 of file PRMClassElement_tpl.h.
gum::prm::PRMClassElement< GUM_SCALAR >::PRMClassElement | ( | const PRMClassElement< GUM_SCALAR > & | source | ) |
Copy constructor.
Definition at line 40 of file PRMClassElement_tpl.h.
|
virtual |
Destructor of this class.
Definition at line 46 of file PRMClassElement_tpl.h.
|
pure virtual |
Add a child to this element.
This methos is called by gum::Class when a child is added to this element.
Implemented in gum::prm::PRMAggregate< GUM_SCALAR >, gum::prm::PRMAggregate< double >, gum::prm::PRMSlotChain< GUM_SCALAR >, gum::prm::PRMSlotChain< double >, gum::prm::PRMScalarAttribute< GUM_SCALAR >, gum::prm::PRMReferenceSlot< GUM_SCALAR >, gum::prm::PRMReferenceSlot< double >, gum::prm::PRMParameter< GUM_SCALAR >, gum::prm::PRMParameter< double >, gum::prm::PRMAttribute< GUM_SCALAR >, gum::prm::PRMAttribute< double >, gum::prm::PRMFormAttribute< GUM_SCALAR >, and gum::prm::PRMFuncAttribute< GUM_SCALAR >.
|
pure virtual |
Add a parent to this element.
This method is called by gum::Class when en parent is added to this elememnt.
Implemented in gum::prm::PRMAggregate< GUM_SCALAR >, gum::prm::PRMAggregate< double >, gum::prm::PRMSlotChain< GUM_SCALAR >, gum::prm::PRMSlotChain< double >, gum::prm::PRMScalarAttribute< GUM_SCALAR >, gum::prm::PRMReferenceSlot< GUM_SCALAR >, gum::prm::PRMReferenceSlot< double >, gum::prm::PRMParameter< GUM_SCALAR >, gum::prm::PRMParameter< double >, gum::prm::PRMAttribute< GUM_SCALAR >, gum::prm::PRMAttribute< double >, gum::prm::PRMFormAttribute< GUM_SCALAR >, and gum::prm::PRMFuncAttribute< GUM_SCALAR >.
|
virtual |
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.
|
pure virtual |
Return a reference over the gum::Potential of this class element.
OperationNotAllowed | Raised if this class element doesn't have any gum::Potential (like a gum::PRMReferenceSlot). Return a constant reference over the gum::Potential of this class element. |
OperationNotAllowed | Raised if the class element doesn't have any gum::Potential (like a gum::PRMReferenceSlot). |
Implemented in gum::prm::PRMAggregate< GUM_SCALAR >, gum::prm::PRMAggregate< double >, gum::prm::PRMSlotChain< GUM_SCALAR >, gum::prm::PRMSlotChain< double >, gum::prm::PRMReferenceSlot< GUM_SCALAR >, gum::prm::PRMReferenceSlot< double >, gum::prm::PRMScalarAttribute< GUM_SCALAR >, gum::prm::PRMParameter< GUM_SCALAR >, gum::prm::PRMParameter< double >, gum::prm::PRMAttribute< GUM_SCALAR >, gum::prm::PRMAttribute< double >, and gum::prm::PRMFormAttribute< GUM_SCALAR >.
|
pure virtual |
Return the type of class element this object is.
Implemented in gum::prm::PRMAggregate< GUM_SCALAR >, gum::prm::PRMAggregate< double >, gum::prm::PRMSlotChain< GUM_SCALAR >, gum::prm::PRMSlotChain< double >, gum::prm::PRMScalarAttribute< GUM_SCALAR >, gum::prm::PRMReferenceSlot< GUM_SCALAR >, gum::prm::PRMReferenceSlot< double >, gum::prm::PRMAttribute< GUM_SCALAR >, gum::prm::PRMAttribute< double >, gum::prm::PRMParameter< GUM_SCALAR >, gum::prm::PRMParameter< double >, and gum::prm::PRMFormAttribute< GUM_SCALAR >.
|
inlinestaticinherited |
|
inlinestatic |
Returns true if obj_ptr is of type PRMReferenceSlot.
Definition at line 103 of file PRMClassElement.h.
|
pure virtual |
Returns a proper cast descendant of this PRMAttribute.
A cast descendant is an PRMAttribute depending on this one which cast it in this->type().super().
The pointer is not deleted by this PRMAttribute, so delete it yourself after use.
A new cast descendant is created for each call of this method.
OperationNotAllowed | Raised if it is not possible to create a cast descendant for this PRMAttribute. |
Implemented in gum::prm::PRMAggregate< GUM_SCALAR >, gum::prm::PRMAggregate< double >, gum::prm::PRMSlotChain< GUM_SCALAR >, gum::prm::PRMSlotChain< double >, gum::prm::PRMReferenceSlot< GUM_SCALAR >, gum::prm::PRMReferenceSlot< double >, gum::prm::PRMScalarAttribute< GUM_SCALAR >, gum::prm::PRMAttribute< GUM_SCALAR >, gum::prm::PRMAttribute< double >, gum::prm::PRMParameter< GUM_SCALAR >, gum::prm::PRMParameter< double >, and gum::prm::PRMFormAttribute< GUM_SCALAR >.
INLINE NodeId gum::prm::PRMClassElement< GUM_SCALAR >::id | ( | ) | const |
Returns the NodeId of this element in it's class DAG.
Definition at line 51 of file PRMClassElement_tpl.h.
|
inlinestatic |
|
inlinestatic |
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().
|
inlinestatic |
|
inlinestatic |
Returns true if obj_ptr is of type PRMReferenceSlot.
Definition at line 126 of file PRMClassElement.h.
|
inlinestatic |
|
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 |
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().
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 const std::string & gum::prm::PRMClassElement< GUM_SCALAR >::safeName | ( | ) | const |
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.
|
virtual |
Used to assign the id of this element.
Definition at line 61 of file PRMClassElement_tpl.h.
|
pure virtual |
Return a reference over the gum::PRMType of this class element.
OperationNotAllowed | Raised if this class element doesn't have any gum::Potential (like a gum::PRMReferenceSlot). |
Implemented in gum::prm::PRMAggregate< GUM_SCALAR >, gum::prm::PRMAggregate< double >, gum::prm::PRMSlotChain< GUM_SCALAR >, gum::prm::PRMSlotChain< double >, gum::prm::PRMReferenceSlot< GUM_SCALAR >, gum::prm::PRMReferenceSlot< double >, gum::prm::PRMScalarAttribute< GUM_SCALAR >, gum::prm::PRMParameter< GUM_SCALAR >, gum::prm::PRMParameter< double >, gum::prm::PRMAttribute< GUM_SCALAR >, gum::prm::PRMAttribute< double >, and gum::prm::PRMFormAttribute< GUM_SCALAR >.
|
pure virtual |
Return a constant reference over the gum::PRMType of this class element.
OperationNotAllowed | Raised if this class element doesn't have any gum::Potential (like a gum::PRMReferenceSlot). |
Implemented in gum::prm::PRMAggregate< GUM_SCALAR >, gum::prm::PRMAggregate< double >, gum::prm::PRMSlotChain< GUM_SCALAR >, gum::prm::PRMSlotChain< double >, gum::prm::PRMReferenceSlot< GUM_SCALAR >, gum::prm::PRMReferenceSlot< double >, gum::prm::PRMScalarAttribute< GUM_SCALAR >, gum::prm::PRMParameter< GUM_SCALAR >, gum::prm::PRMParameter< double >, gum::prm::PRMAttribute< GUM_SCALAR >, gum::prm::PRMAttribute< double >, and gum::prm::PRMFormAttribute< GUM_SCALAR >.
|
private |
The node's id of this element.
Definition at line 269 of file PRMClassElement.h.
|
protected |
The safe name of this PRMClassElement.
Definition at line 265 of file PRMClassElement.h.