![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
<agrum/PRM/classElementContainer.h> More...
#include <PRMClassElementContainer.h>
Public Member Functions | |
Protected constructors & destructor. | |
PRMClassElementContainer (const std::string &name) | |
Default constructor. More... | |
virtual | ~PRMClassElementContainer () |
Destructor. More... | |
Getters on the gum::PRMClassElement<GUM_SCALAR>. | |
virtual bool | belongsTo (const PRMClassElement< GUM_SCALAR > &elt) const |
Returns true if elt belongs to this PRMClassElementContainer. More... | |
virtual bool | exists (const std::string &name) const |
Returns true if a member with the given name exists in this PRMClassElementContainer or in the PRMClassElementContainer hierarchy. More... | |
virtual PRMClassElement< GUM_SCALAR > & | get (const std::string &name)=0 |
Getter on a member of this PRMClassElementContainer. More... | |
virtual const PRMClassElement< GUM_SCALAR > & | get (const std::string &name) const =0 |
Constant getter on a member of this PRMClassElementContainer. More... | |
virtual NodeId | add (PRMClassElement< GUM_SCALAR > *elt)=0 |
Add a PRMClassElement<GUM_SCALAR> to this PRMClassElementContainer. More... | |
virtual NodeId | overload (PRMClassElement< GUM_SCALAR > *elt)=0 |
Add a PRMClassElement<GUM_SCALAR> which overload an inherited PRMClassElement<GUM_SCALAR>. More... | |
virtual void | addArc (const std::string &tail, const std::string &head)=0 |
Add an arc between two PRMClassElement<GUM_SCALAR>. More... | |
virtual bool | isInputNode (const PRMClassElement< GUM_SCALAR > &elt) const |
Returns true if the node is an input node. More... | |
virtual void | setInputNode (const PRMClassElement< GUM_SCALAR > &elt, bool b) |
Set the input flag value of id at b. More... | |
virtual bool | isOutputNode (const PRMClassElement< GUM_SCALAR > &elt) const =0 |
Returns true if the node is an output node. More... | |
virtual void | setOutputNode (const PRMClassElement< GUM_SCALAR > &elt, bool b) |
Set the output flag value of id at b. More... | |
virtual bool | isInnerNode (const PRMClassElement< GUM_SCALAR > &elt) const |
Returns true if the node is an inner node. More... | |
Graphical operator | |
virtual const DAG & | containerDag () const |
Returns the gum::DAG of this PRMClassElementContainer. More... | |
virtual bool | exists (NodeId id) const |
Returns true if a member with the given id exists in this PRMClassElementContainer or in the PRMClassElementContainer hierarchy. More... | |
virtual PRMClassElement< GUM_SCALAR > & | get (NodeId id)=0 |
Getter on a member of this PRMClassElementContainer. More... | |
virtual const PRMClassElement< GUM_SCALAR > & | get (NodeId id) const =0 |
Constant getter on a member of this PRMClassElementContainer. More... | |
Getters & setters operators | |
virtual PRMClassElement< GUM_SCALAR > & | operator[] (NodeId id)=0 |
Getter on a member of this PRMClassElementContainer. More... | |
virtual const PRMClassElement< GUM_SCALAR > & | operator[] (NodeId id) const =0 |
Constant getter on a member of this PRMClassElementContainer. More... | |
virtual PRMClassElement< GUM_SCALAR > & | operator[] (const std::string &name)=0 |
Getter on a member of this PRMClassElementContainer. More... | |
virtual const PRMClassElement< GUM_SCALAR > & | operator[] (const std::string &name) const =0 |
Constant getter on a member of this PRMClassElementContainer. More... | |
Inheritance getters and setters | |
virtual bool | isSubTypeOf (const PRMClassElementContainer< GUM_SCALAR > &cec) const =0 |
Test if this PRMClassElementContainer is a subtype of cec. More... | |
virtual bool | isSuperTypeOf (const PRMClassElementContainer< GUM_SCALAR > &cec) const |
Test if this PRMClassElementContainer is a super type of cec. 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... | |
virtual prm_type | obj_type () const =0 |
Returns the type of this 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 | |
PRMClassElementContainer< GUM_SCALAR > & | operator= (const PRMClassElementContainer< GUM_SCALAR > &source) |
Copy operator. Don't use it. More... | |
PRMClassElementContainer (const PRMClassElementContainer< GUM_SCALAR > &source) | |
Copy constructor. Don't use it. More... | |
virtual const DAG & | dag_ () const =0 |
virtual DAG & | dag_ ()=0 |
Returns a non constant reference over this PRMClassElementContainer's DAG. More... | |
virtual void | findAllSubtypes_ (Set< PRMClassElementContainer< GUM_SCALAR > * > &set)=0 |
Fills set with all the subtypes of this PRMInterface, this includes extensions and implementations. More... | |
virtual std::pair< bool, bool > & | getIOFlag_ (const PRMClassElement< GUM_SCALAR > &elt) |
Returns the IO flags of a PRMClassElement<GUM_SCALAR>. More... | |
virtual const std::pair< bool, bool > & | getIOFlag_ (const PRMClassElement< GUM_SCALAR > &elt) const |
Returns the IO flags of a PRMClassElement<GUM_SCALAR>. More... | |
virtual void | setIOFlag_ (const PRMClassElement< GUM_SCALAR > &elt, const std::pair< bool, bool > &flags) |
Defines the IO flags of a PRMClassElement<GUM_SCALAR>. More... | |
virtual void | copyIOFlags_ (const PRMClassElementContainer< GUM_SCALAR > &c) |
Copy the IO Flags of c in this PRMClassElementContainer. More... | |
virtual void | updateDescendants_ (const PRMClassElement< GUM_SCALAR > &elt)=0 |
When a PRMClassElement<GUM_SCALAR> becomes an Output node we must update any the IO flags of every descendant of this PRMClassElementContainer. Note that after its declaration, input flags can not be changed and output flags can only become true. More... | |
Friends | |
class | PRMClassElementContainterIterator |
class | PRMClassElementContainterConstIterator |
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... | |
<agrum/PRM/classElementContainer.h>
Abstract class for classes containing gum::PRMClassElement<GUM_SCALAR>.
To print a PRMClassElementContainer you can use the following operator: gum::operator<<(std::ostream&, const PRMClassElementContainer&) which print the PRMClassElementContainer in the graphviz-dot format.
Definition at line 66 of file PRMClassElementContainer.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.
INLINE gum::prm::PRMClassElementContainer< GUM_SCALAR >::PRMClassElementContainer | ( | const std::string & | name | ) |
Default constructor.
Definition at line 44 of file PRMClassElementContainer_tpl.h.
|
virtual |
Destructor.
Definition at line 50 of file PRMClassElementContainer_tpl.h.
|
protected |
Copy constructor. Don't use it.
Definition at line 62 of file PRMClassElementContainer_tpl.h.
|
pure virtual |
Add a PRMClassElement<GUM_SCALAR> to this PRMClassElementContainer.
The pointer is "given" to this class, which will delete it when ~Class() is called.
The NodeId of elt is defined when it is added to this, discarding any previous value.
If you want to overload an inherited PRMClassElement<GUM_SCALAR> call Class::overload().
When adding an PRMAttribute or an PRMAggregate its type safe name is automatically added, the syntax is <type>name. So you can either use its type safe name or its real name. See the ref prm_typ_inh "type inheritance section" for further details.
elt | The PRMClassElement<GUM_SCALAR> added to this Class. |
DuplicateElement | Raised if elt's name is already used in this class. |
Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.
|
pure virtual |
Add an arc between two PRMClassElement<GUM_SCALAR>.
Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.
|
virtual |
Returns true if elt belongs to this PRMClassElementContainer.
elt | A PRMClassElement<GUM_SCALAR>. |
Definition at line 170 of file PRMClassElementContainer_tpl.h.
|
virtual |
Returns the gum::DAG of this PRMClassElementContainer.
Be very careful when using NodeId with PRMClassElement<GUM_SCALAR>: there is no guarantee that an inherited PRMClassElement<GUM_SCALAR> will have the same NodeId than its superclass counterpart.
When dealing with different classes and interfaces ALWAYS use safe-name as identifier.
Definition at line 178 of file PRMClassElementContainer_tpl.h.
|
protectedvirtual |
Copy the IO Flags of c in this PRMClassElementContainer.
c | A PRMClassElementContainer. |
Definition at line 36 of file PRMClassElementContainer_tpl.h.
|
protectedpure virtual |
|
protectedpure virtual |
Returns a non constant reference over this PRMClassElementContainer's DAG.
Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.
|
inlinestaticinherited |
|
virtual |
Returns true if a member with the given name exists in this PRMClassElementContainer or in the PRMClassElementContainer hierarchy.
Definition at line 162 of file PRMClassElementContainer_tpl.h.
|
virtual |
Returns true if a member with the given id exists in this PRMClassElementContainer or in the PRMClassElementContainer hierarchy.
id | A NodeId. |
Definition at line 157 of file PRMClassElementContainer_tpl.h.
|
protectedpure virtual |
Fills set with all the subtypes of this PRMInterface, this includes extensions and implementations.
Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.
|
pure virtual |
Getter on a member of this PRMClassElementContainer.
name | The member's name. |
NotFound | Raised if no attribute matches name. |
Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.
|
pure virtual |
Constant getter on a member of this PRMClassElementContainer.
name | The member's name. |
NotFound | Raised if no attribute matches name. |
Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.
|
pure virtual |
Getter on a member of this PRMClassElementContainer.
id | The member's id. |
NotFound | Raised if no attribute matches name. |
Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.
|
pure virtual |
Constant getter on a member of this PRMClassElementContainer.
id | The member's id. |
NotFound | Raised if no attribute matches name. |
Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.
|
protectedvirtual |
Returns the IO flags of a PRMClassElement<GUM_SCALAR>.
elt | The PRMClassElement<GUM_SCALAR>. |
NotFound | Raised if elt does not have any IO flags. |
Definition at line 128 of file PRMClassElementContainer_tpl.h.
|
protectedvirtual |
Returns the IO flags of a PRMClassElement<GUM_SCALAR>.
elt | The PRMClassElement<GUM_SCALAR>. |
NotFound | Raised if elt does not have any IO flags. |
Definition at line 138 of file PRMClassElementContainer_tpl.h.
Returns true if obj_ptr is of type Class.
Definition at line 109 of file PRMObject.h.
References gum::prm::PRMObject::PRMObject().
|
virtual |
Returns true if the node is an inner node.
PRMAttribute or PRMAggregate can either be input, output, both or internal nodes.
By defaut, attributes and aggregates are inner nodes.
elt | A PRMClassElement<GUM_SCALAR>. |
NotFound | Raised if NodeId does'nt match any PRMClassElement<GUM_SCALAR> in this. |
WrongClassElement | Raised if NodeId is neither an PRMAttribute nor an PRMAggregate. |
Definition at line 114 of file PRMClassElementContainer_tpl.h.
|
virtual |
Returns true if the node is an input node.
PRMAttribute or PRMAggregate can either be input, output, both or internal nodes.
By defaut, attributes and aggregates are inner nodes.
elt | A PRMClassElement<GUM_SCALAR>. |
Definition at line 70 of file PRMClassElementContainer_tpl.h.
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().
|
pure virtual |
Returns true if the node is an output node.
PRMAttribute or PRMAggregate can either be input, output, both or internal nodes.
By defaut, attributes and aggregates are inner nodes.
elt | A PRMClassElement<GUM_SCALAR>. |
Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.
|
pure virtual |
Test if this PRMClassElementContainer is a subtype of cec.
cec |
Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.
|
virtual |
Test if this PRMClassElementContainer is a super type of cec.
This returns cec.isSubTypeOf(*this).
cec |
Definition at line 122 of file PRMClassElementContainer_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().
|
pure virtualinherited |
Returns the type of this object.
Implemented in gum::prm::PRMClassElement< GUM_SCALAR >, gum::prm::PRMClassElement< double >, gum::prm::PRMType, gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, gum::prm::PRMInterface< double >, gum::prm::PRMSystem< GUM_SCALAR >, gum::prm::PRMSystem< double >, and gum::prm::PRMInstance< GUM_SCALAR >.
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().
|
protected |
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().
|
pure virtual |
Getter on a member of this PRMClassElementContainer.
id | The member's id. |
NotFound | Raised if no attribute matches name. |
Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.
|
pure virtual |
Constant getter on a member of this PRMClassElementContainer.
id | The member's id. |
NotFound | Raised if no attribute matches name. |
Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.
|
pure virtual |
Getter on a member of this PRMClassElementContainer.
name | The member's name. |
NotFound | Raised if no attribute matches name. |
Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.
|
pure virtual |
Constant getter on a member of this PRMClassElementContainer.
name | The member's name. |
NotFound | Raised if no attribute matches name. |
Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.
|
pure virtual |
Add a PRMClassElement<GUM_SCALAR> which overload an inherited PRMClassElement<GUM_SCALAR>.
The pointer is "given" to this class, which will delete it when ~PRMClassElementContainer() is called.
The NodeId of elt is defined when it is added to this, discarding any previous value. There is no guaranty that elt will have the same NodeId than the PRMClassElement<GUM_SCALAR> it overloaded.
You can only overload inherited PRMClassElement<GUM_SCALAR> and only if elt is a subtype of the inherited PRMClassElement<GUM_SCALAR>. Thus you can only overload PRMReferenceSlot and PRMAttribute. In the case of PRMAttribute you can overload an inherited PRMAttribute even if they are of the same type: this is useful when you want to redefine the dependencies of an PRMAttribute or its CPF. You can also overload an PRMAttribute with an PRMAggregate, as long as their respective PRMType allow it.
elt | The PRMClassElement<GUM_SCALAR> overloading an inherited PRMClassElement<GUM_SCALAR> in this PRMClassElementContainer. |
OperationNotAllowed | Raised if overloading is illegal. |
Implemented in gum::prm::PRMInterface< GUM_SCALAR >, gum::prm::PRMInterface< double >, gum::prm::PRMClass< GUM_SCALAR >, and gum::prm::PRMClass< double >.
|
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.
|
virtual |
Set the input flag value of id at b.
PRMAttribute or PRMAggregate can either be input, output, both or internal nodes.
By defaut, attributes and aggregates are inner nodes.
elt | A PRMClassElement<GUM_SCALAR>. |
b | The flag value. |
NotFound | Raised if id does'nt match any PRMClassElement<GUM_SCALAR> in this. |
WrongClassElement | Raised if NodeId is neither an PRMAttribute nor an PRMAggregate. |
Definition at line 78 of file PRMClassElementContainer_tpl.h.
|
protectedvirtual |
Defines the IO flags of a PRMClassElement<GUM_SCALAR>.
elt | The PRMClassElement<GUM_SCALAR>. |
flags | The IO flags of elt. Overwrite any existing flags. |
NotFound | Raised if elt does not have any IO flags. |
Definition at line 149 of file PRMClassElementContainer_tpl.h.
|
virtual |
Set the output flag value of id at b.
PRMAttribute or PRMAggregate can either be input, output, both or internal nodes.
By defaut, attributes and aggregates are inner nodes.
elt | A PRMClassElement<GUM_SCALAR>. |
b | The flag value. |
NotFound | Raised if id does'nt match any PRMClassElement<GUM_SCALAR> in this. |
WrongClassElement | Raised if NodeId is neither an PRMAttribute nor an PRMAggregate. |
Definition at line 94 of file PRMClassElementContainer_tpl.h.
|
protectedpure virtual |
When a PRMClassElement<GUM_SCALAR> becomes an Output node we must update any the IO flags of every descendant of this PRMClassElementContainer. Note that after its declaration, input flags can not be changed and output flags can only become true.
elt | A PRMClassElement<GUM_SCALAR>. |
Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.
|
friend |
Definition at line 68 of file PRMClassElementContainer.h.
|
friend |
Definition at line 67 of file PRMClassElementContainer.h.
|
private |
input / output flags, useful when inheriting or copying.
Definition at line 438 of file PRMClassElementContainer.h.