aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
gum::prm::PRMInterface< GUM_SCALAR > Class Template Reference

An PRMInterface is implemented by a Class<GUM_SCALAR> and defines a set of PRMReferenceSlot<GUM_SCALAR> and PRMAttribute<GUM_SCALAR> which the implementing Class<GUM_SCALAR> must contain. More...

#include <PRMInterface.h>

Inheritance diagram for gum::prm::PRMInterface< GUM_SCALAR >:
Collaboration diagram for gum::prm::PRMInterface< GUM_SCALAR >:

Public Member Functions

Constructor & destructor.
 PRMInterface (std::string_view name)
 Default constructor.
 PRMInterface (std::string_view name, PRMInterface< GUM_SCALAR > &super, bool delayInheritance=false)
 Constructor for building a subclass of super.
 PRMInterface (const PRMInterface< GUM_SCALAR > &source)
 Copy constructor.
 ~PRMInterface () override
 Destructor.
Graphical model getters and setters
PRMObject::prm_type obj_type () const override
 Implementation of pure virtual method of PRMObject.
PRMClassElement< GUM_SCALAR > & get (NodeId id) override
 See gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(NodeId).
const PRMClassElement< GUM_SCALAR > & get (NodeId id) const override
 Se gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(NodeId).
void addArc (std::string_view tail, std::string_view head) override
 An Interfance doesn't have any arc, this will raise an OperationNotAllowed exception.
PRMClassElement<GUM_SCALAR> getters and setters
bool isOutputNode (const PRMClassElement< GUM_SCALAR > &elt) const override
 See gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(const std::string&).
PRMClassElement< GUM_SCALAR > & get (std::string_view name) override
 See gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(const std::string&).
const PRMClassElement< GUM_SCALAR > & get (std::string_view name) const override
 See gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(const std::string&).
const Set< PRMAttribute< GUM_SCALAR > * > & attributes () const
 Returns the set of PRMAttribute<GUM_SCALAR> of this Class<GUM_SCALAR>.
const Set< PRMReferenceSlot< GUM_SCALAR > * > & referenceSlots () const
 Returns the set of PRMAggregate of this Class<GUM_SCALAR>.
NodeId add (PRMClassElement< GUM_SCALAR > *elt) override
 See gum::prm::PRMClassElementContainer<GUM_SCALAR>::add(PRMClassElement<GUM_SCALAR>*).
NodeId overload (PRMClassElement< GUM_SCALAR > *elt) override
 Add a new PRMClassElement<GUM_SCALAR> which overload an inherited PRMClassElement<GUM_SCALAR>.
Inheritance methods
bool isSubTypeOf (const PRMClassElementContainer< GUM_SCALAR > &cec) const override
 Test if this PRMInterface is a sub PRMInterface of cec.
PRMInterface< GUM_SCALAR > & super ()
 Returns the superInterface of this PRMInterface.
const PRMInterface< GUM_SCALAR > & super () const
 Returns the superInterface of this PRMInterface.
Set< PRMClass< GUM_SCALAR > * > & implementations ()
 Returns the set of Class<GUM_SCALAR> implementing this PRMInterface.
const Set< PRMClass< GUM_SCALAR > * > & implementations () const
 Returns the set of Class<GUM_SCALAR> implementing this PRMInterface.
void inheritInterface ()
 Inherits from this interface super interface, this should only be done when this inteface inheritance was delayed.
Getters & setters operators
PRMClassElement< GUM_SCALAR > & operator[] (NodeId id) override
 See gum::prm::PRMClassElementContainer<GUM_SCALAR>::operator[](NodeId).
const PRMClassElement< GUM_SCALAR > & operator[] (NodeId id) const override
 See gum::prm::PRMClassElementContainer<GUM_SCALAR>::operator[](NodeId).
PRMClassElement< GUM_SCALAR > & operator[] (std::string_view name) override
 See gum::prm::PRMClassElementContainer<GUM_SCALAR>::operator[](const std::string&).
const PRMClassElement< GUM_SCALAR > & operator[] (std::string_view name) const override
 See gum::prm::PRMClassElementContainer<GUM_SCALAR>::operator[](const std::string&).
Getters on the gum::PRMClassElement<GUM_SCALAR>.
virtual bool belongsTo (const PRMClassElement< GUM_SCALAR > &elt) const
 Returns true if elt belongs to this PRMClassElementContainer.
virtual bool exists (std::string_view name) const
 Returns true if a member with the given name exists in this PRMClassElementContainer or in the PRMClassElementContainer hierarchy.
virtual bool isInputNode (const PRMClassElement< GUM_SCALAR > &elt) const
 Returns true if the node is an input node.
virtual void setInputNode (const PRMClassElement< GUM_SCALAR > &elt, bool b)
 Set the input flag value of id at b.
virtual void setOutputNode (const PRMClassElement< GUM_SCALAR > &elt, bool b)
 Set the output flag value of id at b.
virtual bool isInnerNode (const PRMClassElement< GUM_SCALAR > &elt) const
 Returns true if the node is an inner node.
Graphical operator
virtual bool exists (NodeId id) const
 Returns true if a member with the given id exists in this PRMClassElementContainer or in the PRMClassElementContainer hierarchy.
virtual const DAGcontainerDag () const
 Returns the gum::DAG of this PRMClassElementContainer.
Inheritance getters and setters
virtual bool isSuperTypeOf (const PRMClassElementContainer< GUM_SCALAR > &cec) const
 Test if this PRMClassElementContainer is a super type of cec.
Getters & setters.
const std::string & name () const
 Returns the name of this object.
void name (std::string_view name)
 Change the name of the PRM Object.
Operators
bool operator== (const PRMObject &obj) const
 To PRMObject are equal if they have the same name (which is unique).
bool operator!= (const PRMObject &obj) const
 To PRMObject are equal if they have the same name (which is unique).

Protected Member Functions

const DAGdag_ () const override
 Returns a constant reference over this PRMInterface's DAG.
DAGdag_ () override
 Returns a non constant reference over this PRMInterface's DAG.
void findAllSubtypes_ (Set< PRMClassElementContainer< GUM_SCALAR > * > &set) override
 Fills set with all the subtypes of this PRMInterface, this includes extensions and implementations.
void updateDescendants_ (const PRMClassElement< GUM_SCALAR > &elt) override
 See gum::prm::PRMClassElementContainer<GUM_SCALAR>(const PRMClassElement<GUM_SCALAR>&).
virtual std::pair< bool, bool > & getIOFlag_ (const PRMClassElement< GUM_SCALAR > &elt)
 Returns the IO flags of a PRMClassElement<GUM_SCALAR>.
virtual const std::pair< bool, bool > & getIOFlag_ (const PRMClassElement< GUM_SCALAR > &elt) const
 Returns the IO flags of a PRMClassElement<GUM_SCALAR>.
virtual void setIOFlag_ (const PRMClassElement< GUM_SCALAR > &elt, const std::pair< bool, bool > &flags)
 Defines the IO flags of a PRMClassElement<GUM_SCALAR>.
virtual void copyIOFlags_ (const PRMClassElementContainer< GUM_SCALAR > &c)
 Copy the IO Flags of c in this PRMClassElementContainer.

Private Member Functions

PRMInterface< GUM_SCALAR > & operator= (const PRMInterface< GUM_SCALAR > &source)
 Copy operator. Don't use it.
void _inheritInterface_ (const PRMInterface< GUM_SCALAR > &i)
 Proceed with the copy of i in this.

Private Attributes

HashTable< std::string, std::pair< bool, bool > > _IOFlags_
 input / output flags, useful when inheriting or copying.
Graphical model members
DAG _dag_
 The dag representing dependencies between formal attributes and slots.
NodeProperty< PRMClassElement< GUM_SCALAR > * > _nodeIdMap_
 Mapping between node's id and their name (being an attribute or a slot). Used for fast access to a member given it's node id.
PRMClassElement<GUM_SCALAR> members
HashTable< std::string, PRMClassElement< GUM_SCALAR > * > _nameMap_
 Mapping between a member's name and itself. Used for fast access to a member given it's name.
Set< PRMAttribute< GUM_SCALAR > * > _attributes_
 The sequence of PRMAttribute<GUM_SCALAR>s.
Set< PRMReferenceSlot< GUM_SCALAR > * > _referenceSlots_
 The sequence of PRMReferenceSlot<GUM_SCALAR>.
Private members.
std::string _name_

Friends

class PRMClass< GUM_SCALAR >

Iterators

using ClassEltIterator = typename NodeProperty< PRMClassElement< GUM_SCALAR >* >::iterator
using const_ClassEltIterator
ClassEltIterator begin ()
const ClassEltIteratorend ()
const_ClassEltIterator begin () const
const const_ClassEltIteratorend () const

Built-in types.

enum class  prm_type : char {
  ALL , CLASS , PRM_INTERFACE , CLASS_ELT ,
  TYPE , SYSTEM , 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.
static std::string RIGHT_CAST ()
 Enumeration of the different types of objects handled by a PRM.
static std::string enum2str (prm_type type)
 Returns the string representation of a PRMObject.
static INLINE bool isClass (const PRMObject &obj)
 Returns true if obj_ptr is of type Class.
static INLINE bool isInterface (const PRMObject &obj)
 Returns true if obj_ptr is of type PRMInterface.
static INLINE bool isInstance (const PRMObject &obj)
 Returns true if obj_ptr is of type PRMInstance.

Inheritance members

PRMInterface< GUM_SCALAR > * _superInterface_
 The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this. Note that this is first searched for gum::PRMClassElement<GUM_SCALAR>.
Set< PRMClass< GUM_SCALAR > * > _implementations_
 The set of Class<GUM_SCALAR> which implements this PRMInterface.
Set< PRMInterface< GUM_SCALAR > * > _extensions_
 The set of Class<GUM_SCALAR> which implements this PRMInterface.
void _addImplementation_ (PRMClass< GUM_SCALAR > *c)
 Add an Class<GUM_SCALAR> to the set of Class<GUM_SCALAR> which implements this PRMInterface.
void _addExtension_ (PRMInterface< GUM_SCALAR > *c)
 Add an Class<GUM_SCALAR> to the set of Class<GUM_SCALAR> which implements this PRMInterface.
bool _checkOverloadLegality_ (const PRMClassElement< GUM_SCALAR > *overloaded, const PRMClassElement< GUM_SCALAR > *overloader)
 The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this. Note that this is first searched for gum::PRMClassElement<GUM_SCALAR>.
void _overloadAttribute_ (PRMAttribute< GUM_SCALAR > *overloader, PRMAttribute< GUM_SCALAR > *overloaded)
 The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this. Note that this is first searched for gum::PRMClassElement<GUM_SCALAR>.
void _overloadReferenceSlot_ (PRMReferenceSlot< GUM_SCALAR > *overloader, PRMReferenceSlot< GUM_SCALAR > *overloaded)
 The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this. Note that this is first searched for gum::PRMClassElement<GUM_SCALAR>.
void _addCastDescendants_ (PRMAttribute< GUM_SCALAR > *start, PRMAttribute< GUM_SCALAR > *end)
 The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this. Note that this is first searched for gum::PRMClassElement<GUM_SCALAR>.

Detailed Description

template<GUM_Numeric GUM_SCALAR>
class gum::prm::PRMInterface< GUM_SCALAR >

An PRMInterface is implemented by a Class<GUM_SCALAR> and defines a set of PRMReferenceSlot<GUM_SCALAR> and PRMAttribute<GUM_SCALAR> which the implementing Class<GUM_SCALAR> must contain.

See also
PRM Class<GUM_SCALAR> PRMClassElement<GUM_SCALAR>

Definition at line 82 of file PRMInterface.h.

Member Typedef Documentation

◆ ClassEltIterator

template<GUM_Numeric GUM_SCALAR>
using gum::prm::PRMInterface< GUM_SCALAR >::ClassEltIterator = typename NodeProperty< PRMClassElement< GUM_SCALAR >* >::iterator

Definition at line 297 of file PRMInterface.h.

◆ const_ClassEltIterator

template<GUM_Numeric GUM_SCALAR>
using gum::prm::PRMInterface< GUM_SCALAR >::const_ClassEltIterator
Initial value:
HashTable< NodeId, VAL > NodeProperty
Property on graph elements.

Definition at line 301 of file PRMInterface.h.

Member Enumeration Documentation

◆ prm_type

enum class gum::prm::PRMObject::prm_type : char
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 90 of file PRMObject.h.

90: char { ALL, CLASS, PRM_INTERFACE, CLASS_ELT, TYPE, SYSTEM, INSTANCE };

Constructor & Destructor Documentation

◆ PRMInterface() [1/3]

template<GUM_Numeric GUM_SCALAR>
gum::prm::PRMInterface< GUM_SCALAR >::PRMInterface ( std::string_view name)
explicit

Default constructor.

Parameters
nameThe interface name.

Definition at line 57 of file PRMInterface_tpl.h.

57 :
60 }
PRMClassElementContainer(std::string_view name)
Default constructor.
An PRMInterface is implemented by a Class<GUM_SCALAR> and defines a set of PRMReferenceSlot<GUM_SCALA...
PRMInterface< GUM_SCALAR > * _superInterface_
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this....
PRMInterface(std::string_view name)
Default constructor.
const std::string & name() const
Returns the name of this object.

References gum::prm::PRMClassElementContainer< GUM_SCALAR >::PRMClassElementContainer(), PRMInterface(), _superInterface_, and gum::prm::PRMObject::name().

Referenced by PRMInterface(), PRMInterface(), PRMInterface(), ~PRMInterface(), _addExtension_(), _inheritInterface_(), isSubTypeOf(), operator=(), PRMClass< GUM_SCALAR >, super(), and super().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PRMInterface() [2/3]

template<GUM_Numeric GUM_SCALAR>
gum::prm::PRMInterface< GUM_SCALAR >::PRMInterface ( std::string_view name,
PRMInterface< GUM_SCALAR > & super,
bool delayInheritance = false )

Constructor for building a subclass of super.

Parameters
nameThe sub-interface name.
superThe super PRMInterface of this.
delayInheritanceIf true, inheritance will be delayed.

Definition at line 63 of file PRMInterface_tpl.h.

65 :
69 }
void _inheritInterface_(const PRMInterface< GUM_SCALAR > &i)
Proceed with the copy of i in this.
PRMInterface< GUM_SCALAR > & super()
Returns the superInterface of this PRMInterface.

References gum::prm::PRMClassElementContainer< GUM_SCALAR >::PRMClassElementContainer(), PRMInterface(), _inheritInterface_(), _superInterface_, gum::prm::PRMObject::name(), and super().

Here is the call graph for this function:

◆ PRMInterface() [3/3]

template<GUM_Numeric GUM_SCALAR>
gum::prm::PRMInterface< GUM_SCALAR >::PRMInterface ( const PRMInterface< GUM_SCALAR > & source)

Copy constructor.

Definition at line 72 of file PRMInterface_tpl.h.

72 :
76 GUM_ERROR(FatalError, "don't copy an interface")
77 }
DAG _dag_
The dag representing dependencies between formal attributes and slots.
#define GUM_ERROR(type, msg)
Definition exceptions.h:76

References gum::prm::PRMClassElementContainer< GUM_SCALAR >::PRMClassElementContainer(), PRMInterface(), _dag_, _superInterface_, GUM_ERROR, and gum::prm::PRMObject::name().

Here is the call graph for this function:

◆ ~PRMInterface()

template<GUM_Numeric GUM_SCALAR>
gum::prm::PRMInterface< GUM_SCALAR >::~PRMInterface ( )
override

Destructor.

Definition at line 80 of file PRMInterface_tpl.h.

80 {
82
83 for (const auto& elt: _nodeIdMap_) {
84 delete elt.second;
85 }
86 }
NodeProperty< PRMClassElement< GUM_SCALAR > * > _nodeIdMap_
Mapping between node's id and their name (being an attribute or a slot). Used for fast access to a me...

References PRMInterface(), and _nodeIdMap_.

Here is the call graph for this function:

Member Function Documentation

◆ _addCastDescendants_()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::PRMInterface< GUM_SCALAR >::_addCastDescendants_ ( PRMAttribute< GUM_SCALAR > * start,
PRMAttribute< GUM_SCALAR > * end )
private

The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this. Note that this is first searched for gum::PRMClassElement<GUM_SCALAR>.

Definition at line 250 of file PRMInterface_tpl.h.

251 {
254
255 while (parent->type().superType() != end->type()) {
256 child = parent->getCastDescendant();
257 child->setId(nextNodeId());
258 _dag_.addNodeWithId(child->id());
259 _nodeIdMap_.insert(child->id(), child);
260 // Only use child's safe name when adding to the name map!
261 _nameMap_.insert(child->safeName(), child);
262 _attributes_.insert(child);
263 // Do ! use Class<GUM_SCALAR>::insertArc(), child's CPF is already
264 // initialized properly
265 parent = child;
266 }
267
268 parent->setAsCastDescendant(end);
269 }
Set< PRMAttribute< GUM_SCALAR > * > _attributes_
The sequence of PRMAttribute<GUM_SCALAR>s.
HashTable< std::string, PRMClassElement< GUM_SCALAR > * > _nameMap_
Mapping between a member's name and itself. Used for fast access to a member given it's name.
const ClassEltIterator & end()

References _attributes_, _dag_, _nameMap_, _nodeIdMap_, end(), gum::prm::PRMAttribute< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMClassElement< GUM_SCALAR >::id(), gum::prm::nextNodeId(), gum::prm::PRMClassElement< GUM_SCALAR >::safeName(), gum::prm::PRMAttribute< GUM_SCALAR >::setAsCastDescendant(), gum::prm::PRMClassElement< GUM_SCALAR >::setId(), gum::prm::PRMType::superType(), and gum::prm::PRMAttribute< GUM_SCALAR >::type().

Referenced by _overloadAttribute_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _addExtension_()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::PRMInterface< GUM_SCALAR >::_addExtension_ ( PRMInterface< GUM_SCALAR > * c)
private

Add an Class<GUM_SCALAR> to the set of Class<GUM_SCALAR> which implements this PRMInterface.

Definition at line 374 of file PRMInterface_tpl.h.

374 {
375 _extensions_.insert(i);
376 }
Set< PRMInterface< GUM_SCALAR > * > _extensions_
The set of Class<GUM_SCALAR> which implements this PRMInterface.

References PRMInterface(), and _extensions_.

Here is the call graph for this function:

◆ _addImplementation_()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::PRMInterface< GUM_SCALAR >::_addImplementation_ ( PRMClass< GUM_SCALAR > * c)
private

Add an Class<GUM_SCALAR> to the set of Class<GUM_SCALAR> which implements this PRMInterface.

Definition at line 369 of file PRMInterface_tpl.h.

369 {
370 _implementations_.insert(c);
371 }
Set< PRMClass< GUM_SCALAR > * > _implementations_
The set of Class<GUM_SCALAR> which implements this PRMInterface.

References _implementations_, and PRMClass< GUM_SCALAR >.

Here is the call graph for this function:

◆ _checkOverloadLegality_()

template<GUM_Numeric GUM_SCALAR>
bool gum::prm::PRMInterface< GUM_SCALAR >::_checkOverloadLegality_ ( const PRMClassElement< GUM_SCALAR > * overloaded,
const PRMClassElement< GUM_SCALAR > * overloader )
private

The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this. Note that this is first searched for gum::PRMClassElement<GUM_SCALAR>.

Definition at line 272 of file PRMInterface_tpl.h.

274 {
275 if (overloaded->elt_type() != overloader->elt_type()) { return false; }
276
278 if (!overloader->type().isSubTypeOf(overloaded->type())) { return false; }
279 } else if (overloaded->elt_type() == PRMClassElement< GUM_SCALAR >::prm_refslot) {
280 auto ref_overloader = static_cast< const PRMReferenceSlot< GUM_SCALAR >* >(overloader);
281 auto ref_overloaded = static_cast< const PRMReferenceSlot< GUM_SCALAR >* >(overloaded);
282 if (!ref_overloader->slotType().isSubTypeOf(ref_overloaded->slotType())) { return false; }
283 } else {
284 return false;
285 }
286 return true;
287 }
bool isSubTypeOf(const PRMClassElementContainer< GUM_SCALAR > &cec) const override
Test if this PRMInterface is a sub PRMInterface of cec.

References gum::prm::PRMClassElement< GUM_SCALAR >::elt_type(), gum::prm::PRMType::isSubTypeOf(), gum::prm::PRMClassElement< GUM_SCALAR >::prm_attribute, gum::prm::PRMClassElement< GUM_SCALAR >::prm_refslot, gum::prm::PRMReferenceSlot< GUM_SCALAR >::slotType(), and gum::prm::PRMClassElement< GUM_SCALAR >::type().

Referenced by overload().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _inheritInterface_()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::PRMInterface< GUM_SCALAR >::_inheritInterface_ ( const PRMInterface< GUM_SCALAR > & i)
private

Proceed with the copy of i in this.

Definition at line 94 of file PRMInterface_tpl.h.

94 {
95 // Copying attributes
96 for (const auto i_attr: i._attributes_) {
98 attr->setId(i_attr->id());
99 _nodeIdMap_.insert(attr->id(), attr);
100 _attributes_.insert(attr);
101
102 if (i._nameMap_[i_attr->name()] == i._nameMap_[i_attr->safeName()]) {
103 _nameMap_.insert(attr->name(), attr);
104 }
105
106 _nameMap_.insert(attr->safeName(), attr);
107 _dag_.addNodeWithId(attr->id());
108 }
109
110 // Copying reference slots
111 for (const auto i_ref: i._referenceSlots_) {
113 i_ref->name(),
114 const_cast< PRMClassElementContainer< GUM_SCALAR >& >(i_ref->slotType()),
115 i_ref->isArray());
116
117 ref->setId(i_ref->id());
118 _nodeIdMap_.insert(ref->id(), ref);
119 _referenceSlots_.insert(ref);
120
121 if (i._nameMap_.exists(ref->name())) { _nameMap_.insert(ref->name(), ref); }
122
123 _nameMap_.insert(ref->safeName(), ref);
124 _dag_.addNodeWithId(ref->id());
125 }
126 }
Set< PRMReferenceSlot< GUM_SCALAR > * > _referenceSlots_
The sequence of PRMReferenceSlot<GUM_SCALAR>.

References gum::prm::PRMClassElementContainer< GUM_SCALAR >::PRMClassElementContainer(), PRMInterface(), _attributes_, _dag_, _nameMap_, _nodeIdMap_, and _referenceSlots_.

Referenced by PRMInterface(), and inheritInterface().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _overloadAttribute_()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::PRMInterface< GUM_SCALAR >::_overloadAttribute_ ( PRMAttribute< GUM_SCALAR > * overloader,
PRMAttribute< GUM_SCALAR > * overloaded )
private

The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this. Note that this is first searched for gum::PRMClassElement<GUM_SCALAR>.

Definition at line 208 of file PRMInterface_tpl.h.

209 {
210 if (overloader->type() != overloaded->type()) {
211 overloader->setId(nextNodeId());
212 _dag_.addNodeWithId(overloader->id());
213 _nodeIdMap_.insert(overloader->id(), overloader);
215 _nameMap_.insert(overloader->safeName(), overloader);
216 _attributes_.insert(overloader);
218 } else {
219 overloader->setId(overloaded->id());
222 _nameMap_[overloader->safeName()] = overloader;
224 _attributes_.insert(overloader);
225 // Swapping types, ugly but necessary to preserve the
226 // PRMType<GUM_SCALAR>
227 // pointer of overloaded
229 delete overloaded;
230 }
231 }
NodeId overload(PRMClassElement< GUM_SCALAR > *elt) override
Add a new PRMClassElement<GUM_SCALAR> which overload an inherited PRMClassElement<GUM_SCALAR>.
void _addCastDescendants_(PRMAttribute< GUM_SCALAR > *start, PRMAttribute< GUM_SCALAR > *end)
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this....

References _addCastDescendants_(), _attributes_, _dag_, _nameMap_, _nodeIdMap_, gum::prm::PRMClassElement< GUM_SCALAR >::id(), gum::prm::PRMObject::name(), gum::prm::nextNodeId(), gum::prm::PRMAttribute< GUM_SCALAR >::overload(), gum::prm::PRMClassElement< GUM_SCALAR >::safeName(), gum::prm::PRMClassElement< GUM_SCALAR >::setId(), and gum::prm::PRMAttribute< GUM_SCALAR >::type().

Referenced by overload().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _overloadReferenceSlot_()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::PRMInterface< GUM_SCALAR >::_overloadReferenceSlot_ ( PRMReferenceSlot< GUM_SCALAR > * overloader,
PRMReferenceSlot< GUM_SCALAR > * overloaded )
private

The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this. Note that this is first searched for gum::PRMClassElement<GUM_SCALAR>.

Definition at line 234 of file PRMInterface_tpl.h.

236 {
237 // Adding overloading reference
238 overloader->setId(overloaded->id());
241 _nameMap_.insert(overloader->safeName(), overloader);
243 // Removing overloaded PRMReferenceSlot<GUM_SCALAR>
245 _nameMap_.erase(overloaded->safeName());
246 delete overloaded;
247 }

References _nameMap_, _nodeIdMap_, _referenceSlots_, gum::prm::PRMClassElement< GUM_SCALAR >::id(), gum::prm::PRMObject::name(), gum::prm::PRMClassElement< GUM_SCALAR >::safeName(), and gum::prm::PRMClassElement< GUM_SCALAR >::setId().

Referenced by overload().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add()

template<GUM_Numeric GUM_SCALAR>
NodeId gum::prm::PRMInterface< GUM_SCALAR >::add ( PRMClassElement< GUM_SCALAR > * elt)
overridevirtual

See gum::prm::PRMClassElementContainer<GUM_SCALAR>::add(PRMClassElement<GUM_SCALAR>*).

Implements gum::prm::PRMClassElementContainer< GUM_SCALAR >.

Definition at line 129 of file PRMInterface_tpl.h.

129 {
130 if (_nameMap_.exists(elt->name())) {
132 "name '" << elt->name() << "' is already used by another ClassElement");
133 }
134
137 _nameMap_.insert(attr->name(), attr);
138
139 while (true) {
140 attr->setId(nextNodeId());
141 _dag_.addNodeWithId(attr->id());
142 _nodeIdMap_.insert(attr->id(), attr);
143 _nameMap_.insert(attr->safeName(), attr);
144 _attributes_.insert(attr);
145
146 if (attr->type().isSubType()) {
147 attr = attr->getCastDescendant();
148 } else {
149 break;
150 }
151 }
153 elt->setId(nextNodeId());
154 _dag_.addNodeWithId(elt->id());
155 _nodeIdMap_.insert(elt->id(), elt);
156 _referenceSlots_.insert(static_cast< PRMReferenceSlot< GUM_SCALAR >* >(elt));
157 _nameMap_.insert(elt->name(), elt);
158 _nameMap_.insert(elt->safeName(), elt);
159 } else {
160 GUM_ERROR(WrongClassElement, "illegal ClassElement<GUM_SCALAR> for an Interface")
161 }
162
163 return elt->id();
164 }

References _attributes_, _dag_, _nameMap_, _nodeIdMap_, _referenceSlots_, gum::prm::PRMAttribute< GUM_SCALAR >::getCastDescendant(), GUM_ERROR, gum::prm::PRMClassElement< GUM_SCALAR >::id(), gum::prm::PRMClassElement< GUM_SCALAR >::isAttribute(), gum::prm::PRMClassElement< GUM_SCALAR >::isReferenceSlot(), gum::prm::PRMType::isSubType(), gum::prm::PRMObject::name(), gum::prm::nextNodeId(), gum::prm::PRMClassElement< GUM_SCALAR >::safeName(), gum::prm::PRMClassElement< GUM_SCALAR >::setId(), and gum::prm::PRMAttribute< GUM_SCALAR >::type().

Here is the call graph for this function:

◆ addArc()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::PRMInterface< GUM_SCALAR >::addArc ( std::string_view tail,
std::string_view head )
overridevirtual

An Interfance doesn't have any arc, this will raise an OperationNotAllowed exception.

Parameters
tailThe tail of the added arc.
headThe head of the added arc.
Exceptions
OperationNotAllowedSystematically throws an OperationNotAllowed.

Implements gum::prm::PRMClassElementContainer< GUM_SCALAR >.

Definition at line 352 of file PRMInterface_tpl.h.

352 {
353 GUM_ERROR(OperationNotAllowed, "an Interface does ! have arcs")
354 }

References GUM_ERROR.

◆ attributes()

template<GUM_Numeric GUM_SCALAR>
const Set< PRMAttribute< GUM_SCALAR > * > & gum::prm::PRMInterface< GUM_SCALAR >::attributes ( ) const

Returns the set of PRMAttribute<GUM_SCALAR> of this Class<GUM_SCALAR>.

Returns
Returns the set of PRMAttribute<GUM_SCALAR> of this Class<GUM_SCALAR>.

Definition at line 444 of file PRMInterface_tpl.h.

444 {
445 return _attributes_;
446 }

References _attributes_.

◆ begin() [1/2]

template<GUM_Numeric GUM_SCALAR>
PRMInterface< GUM_SCALAR >::ClassEltIterator gum::prm::PRMInterface< GUM_SCALAR >::begin ( )

Definition at line 330 of file PRMInterface_tpl.h.

330 {
331 return _nodeIdMap_.begin();
332 }

References _nodeIdMap_.

◆ begin() [2/2]

template<GUM_Numeric GUM_SCALAR>
PRMInterface< GUM_SCALAR >::const_ClassEltIterator gum::prm::PRMInterface< GUM_SCALAR >::begin ( ) const

Definition at line 341 of file PRMInterface_tpl.h.

341 {
342 return _nodeIdMap_.begin();
343 }

References _nodeIdMap_.

◆ belongsTo()

template<GUM_Numeric GUM_SCALAR>
bool gum::prm::PRMClassElementContainer< GUM_SCALAR >::belongsTo ( const PRMClassElement< GUM_SCALAR > & elt) const
virtualinherited

Returns true if elt belongs to this PRMClassElementContainer.

Parameters
eltA PRMClassElement<GUM_SCALAR>.
Returns
true if elt beglons to this PRMClassElementContainer.

Definition at line 191 of file PRMClassElementContainer_tpl.h.

192 {
193 try {
194 return &elt == &(get(elt.safeName()));
195 } catch (NotFound const&) { return false; }
196 }
<agrum/PRM/classElementContainer.h>
virtual PRMClassElement< GUM_SCALAR > & get(std::string_view name)=0
Getter on a member of this PRMClassElementContainer.

References get(), and gum::prm::PRMClassElement< GUM_SCALAR >::safeName().

Here is the call graph for this function:

◆ containerDag()

template<GUM_Numeric GUM_SCALAR>
const DAG & gum::prm::PRMClassElementContainer< GUM_SCALAR >::containerDag ( ) const
virtualinherited

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.

Returns
the DAG of this PRMClassElementContainer.

Definition at line 199 of file PRMClassElementContainer_tpl.h.

199 {
200 return dag_();
201 }
virtual const DAG & dag_() const =0

References dag_().

Referenced by gum::prm::ClassDependencyGraph< GUM_SCALAR >::_addArcs_(), gum::prm::PRMClass< GUM_SCALAR >::_inheritClass_(), gum::prm::ClassBayesNet< GUM_SCALAR >::_init_(), gum::prm::SVE< GUM_SCALAR >::_initLiftedNodes_(), gum::prm::SVED< GUM_SCALAR >::_initLiftedNodes_(), gum::prm::PRMClass< GUM_SCALAR >::_overloadReference_(), gum::prm::PRMFactory< GUM_SCALAR >::addAttribute(), gum::prm::PRMClass< GUM_SCALAR >::completeInheritance(), exists(), and operator<<().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ copyIOFlags_()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::PRMClassElementContainer< GUM_SCALAR >::copyIOFlags_ ( const PRMClassElementContainer< GUM_SCALAR > & c)
protectedvirtualinherited

Copy the IO Flags of c in this PRMClassElementContainer.

Parameters
cA PRMClassElementContainer.

Definition at line 58 of file PRMClassElementContainer_tpl.h.

59 {
60 for (const auto& flag: c._IOFlags_)
61 setIOFlag_(get(flag.first), flag.second);
62 }
HashTable< std::string, std::pair< bool, bool > > _IOFlags_
input / output flags, useful when inheriting or copying.
virtual void setIOFlag_(const PRMClassElement< GUM_SCALAR > &elt, const std::pair< bool, bool > &flags)
Defines the IO flags of a PRMClassElement<GUM_SCALAR>.

References PRMClassElementContainer(), _IOFlags_, get(), and setIOFlag_().

Referenced by gum::prm::PRMClass< GUM_SCALAR >::_inheritClass_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dag_() [1/2]

template<GUM_Numeric GUM_SCALAR>
const DAG & gum::prm::PRMInterface< GUM_SCALAR >::dag_ ( ) const
overrideprotectedvirtual

Returns a constant reference over this PRMInterface's DAG.

Implements gum::prm::PRMClassElementContainer< GUM_SCALAR >.

Definition at line 405 of file PRMInterface_tpl.h.

405 {
406 return _dag_;
407 }

References _dag_.

◆ dag_() [2/2]

template<GUM_Numeric GUM_SCALAR>
DAG & gum::prm::PRMInterface< GUM_SCALAR >::dag_ ( )
overrideprotectedvirtual

Returns a non constant reference over this PRMInterface's DAG.

Implements gum::prm::PRMClassElementContainer< GUM_SCALAR >.

Definition at line 410 of file PRMInterface_tpl.h.

410 {
411 return _dag_;
412 }

References _dag_.

◆ end() [1/2]

template<GUM_Numeric GUM_SCALAR>
const PRMInterface< GUM_SCALAR >::ClassEltIterator & gum::prm::PRMInterface< GUM_SCALAR >::end ( )

Definition at line 335 of file PRMInterface_tpl.h.

335 {
336 return _nodeIdMap_.end();
337 }

References _nodeIdMap_.

Referenced by _addCastDescendants_().

Here is the caller graph for this function:

◆ end() [2/2]

template<GUM_Numeric GUM_SCALAR>
const PRMInterface< GUM_SCALAR >::const_ClassEltIterator & gum::prm::PRMInterface< GUM_SCALAR >::end ( ) const

Definition at line 347 of file PRMInterface_tpl.h.

347 {
348 return _nodeIdMap_.end();
349 }

References _nodeIdMap_.

◆ enum2str()

INLINE std::string gum::prm::PRMObject::enum2str ( prm_type type)
staticinherited

Returns the string representation of a PRMObject.

Definition at line 75 of file PRMObject_inl.h.

75 {
76 switch (type) {
77 case prm_type::CLASS : return "PRMType::CLASS";
78
79 case prm_type::CLASS_ELT : return "PRMType::CLASS_ELT";
80
81 case prm_type::TYPE : return "PRMType::TYPE";
82
83 case prm_type::SYSTEM : return "PRMType::SYSTEM";
84
85 case prm_type::INSTANCE : return "PRMType::INSTANCE";
86
87 case prm_type::PRM_INTERFACE : return "PRMType::PRM_INTERFACE";
88
89 default : return "unknown";
90 }
91 }

References CLASS, CLASS_ELT, INSTANCE, PRM_INTERFACE, SYSTEM, and TYPE.

Referenced by gum::prm::operator<<().

Here is the caller graph for this function:

◆ exists() [1/2]

template<GUM_Numeric GUM_SCALAR>
bool gum::prm::PRMClassElementContainer< GUM_SCALAR >::exists ( NodeId id) const
virtualinherited

Returns true if a member with the given id exists in this PRMClassElementContainer or in the PRMClassElementContainer hierarchy.

Parameters
idA NodeId.
Returns
true if id matches a PRMClassElement<GUM_SCALAR>.

Definition at line 178 of file PRMClassElementContainer_tpl.h.

178 {
179 return containerDag().exists(id);
180 }
bool exists(const NodeId id) const
alias for existsNode
virtual const DAG & containerDag() const
Returns the gum::DAG of this PRMClassElementContainer.

References containerDag().

Here is the call graph for this function:

◆ exists() [2/2]

template<GUM_Numeric GUM_SCALAR>
bool gum::prm::PRMClassElementContainer< GUM_SCALAR >::exists ( std::string_view name) const
virtualinherited

Returns true if a member with the given name exists in this PRMClassElementContainer or in the PRMClassElementContainer hierarchy.

Definition at line 183 of file PRMClassElementContainer_tpl.h.

183 {
184 try {
185 get(name);
186 return true;
187 } catch (NotFound const&) { return false; }
188 }

References get(), and gum::prm::PRMObject::name().

Referenced by gum::prm::PRMFactory< GUM_SCALAR >::_addParent_(), gum::prm::PRMFactory< GUM_SCALAR >::_buildSlotChain_(), gum::prm::PRMClass< GUM_SCALAR >::_checkInterface_(), gum::prm::PRMFactory< GUM_SCALAR >::_checkInterfaceImplementation_(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkLocalParent_(), gum::prm::o3prm::O3SystemFactory< GUM_SCALAR >::_checkParameters_(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkRawCPT_(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkSlotChainLink_(), gum::prm::ClassBayesNet< GUM_SCALAR >::_init_(), gum::prm::PRMFactory< GUM_SCALAR >::_retrieveInputs_(), gum::prm::PRMFactory< GUM_SCALAR >::addNoisyOrCompound(), gum::prm::PRMFactory< GUM_SCALAR >::continueAggregator(), gum::prm::PRMFactory< GUM_SCALAR >::continueAttribute(), gum::prm::PRMClass< GUM_SCALAR >::overload(), gum::prm::PRMInterface< GUM_SCALAR >::overload(), setInputNode(), setOutputNode(), and gum::prm::PRMFactory< GUM_SCALAR >::startAttribute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findAllSubtypes_()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::PRMInterface< GUM_SCALAR >::findAllSubtypes_ ( Set< PRMClassElementContainer< GUM_SCALAR > * > & set)
overrideprotectedvirtual

Fills set with all the subtypes of this PRMInterface, this includes extensions and implementations.

Implements gum::prm::PRMClassElementContainer< GUM_SCALAR >.

Definition at line 465 of file PRMInterface_tpl.h.

466 {
467 for (const auto impl: _implementations_) {
468 set.insert(impl);
470 }
471
472 for (const auto ext: _extensions_) {
473 set.insert(ext);
475 }
476 }
void findAllSubtypes_(Set< PRMClassElementContainer< GUM_SCALAR > * > &set) override
Fills set with all the subtypes of this PRMInterface, this includes extensions and implementations.

References gum::prm::PRMClassElementContainer< GUM_SCALAR >::PRMClassElementContainer(), _extensions_, and _implementations_.

Here is the call graph for this function:

◆ get() [1/4]

template<GUM_Numeric GUM_SCALAR>
const PRMClassElement< GUM_SCALAR > & gum::prm::PRMInterface< GUM_SCALAR >::get ( NodeId id) const
overridevirtual

Se gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(NodeId).

Implements gum::prm::PRMClassElementContainer< GUM_SCALAR >.

Definition at line 422 of file PRMInterface_tpl.h.

422 {
423 auto p = _nodeIdMap_.tryGet(id);
424 if (!p) { GUM_ERROR(NotFound, "no ClassElement<GUM_SCALAR> with the given NodeId") }
425 return **p;
426 }

References _nodeIdMap_, and GUM_ERROR.

◆ get() [2/4]

template<GUM_Numeric GUM_SCALAR>
PRMClassElement< GUM_SCALAR > & gum::prm::PRMInterface< GUM_SCALAR >::get ( NodeId id)
overridevirtual

See gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(NodeId).

Implements gum::prm::PRMClassElementContainer< GUM_SCALAR >.

Definition at line 415 of file PRMInterface_tpl.h.

415 {
416 auto p = _nodeIdMap_.tryGet(id);
417 if (!p) { GUM_ERROR(NotFound, "no ClassElement<GUM_SCALAR> with the given NodeId") }
418 return **p;
419 }

References _nodeIdMap_, and GUM_ERROR.

Referenced by gum::prm::PRMClass< GUM_SCALAR >::_checkInterface_(), gum::prm::PRMClass< GUM_SCALAR >::_checkRefInterface_(), operator[](), operator[](), operator[](), and operator[]().

Here is the caller graph for this function:

◆ get() [3/4]

template<GUM_Numeric GUM_SCALAR>
const PRMClassElement< GUM_SCALAR > & gum::prm::PRMInterface< GUM_SCALAR >::get ( std::string_view name) const
overridevirtual

See gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(const std::string&).

Implements gum::prm::PRMClassElementContainer< GUM_SCALAR >.

Definition at line 437 of file PRMInterface_tpl.h.

437 {
438 auto p = _nameMap_.tryGet(name);
439 if (!p) { GUM_ERROR(NotFound, "no ClassElement<GUM_SCALAR> with the given name") }
440 return **p;
441 }

References _nameMap_, GUM_ERROR, and gum::prm::PRMObject::name().

Here is the call graph for this function:

◆ get() [4/4]

template<GUM_Numeric GUM_SCALAR>
PRMClassElement< GUM_SCALAR > & gum::prm::PRMInterface< GUM_SCALAR >::get ( std::string_view name)
overridevirtual

See gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(const std::string&).

Implements gum::prm::PRMClassElementContainer< GUM_SCALAR >.

Definition at line 429 of file PRMInterface_tpl.h.

429 {
430 auto p = _nameMap_.tryGet(name);
431 if (!p) { GUM_ERROR(NotFound, "no ClassElement<GUM_SCALAR> with the given name") }
432 return **p;
433 }

References _nameMap_, GUM_ERROR, and gum::prm::PRMObject::name().

Here is the call graph for this function:

◆ getIOFlag_() [1/2]

template<GUM_Numeric GUM_SCALAR>
std::pair< bool, bool > & gum::prm::PRMClassElementContainer< GUM_SCALAR >::getIOFlag_ ( const PRMClassElement< GUM_SCALAR > & elt)
protectedvirtualinherited

Returns the IO flags of a PRMClassElement<GUM_SCALAR>.

Parameters
eltThe PRMClassElement<GUM_SCALAR>.
Returns
elt's IO flags.
Exceptions
NotFoundRaised if elt does not have any IO flags.

Definition at line 151 of file PRMClassElementContainer_tpl.h.

152 {
153 auto p = _IOFlags_.tryGet(elt.safeName());
154 if (!p) GUM_ERROR(NotFound, "this ClassElement<GUM_SCALAR> does not have any IO flags")
155 return *p;
156 }

References _IOFlags_, GUM_ERROR, and gum::prm::PRMClassElement< GUM_SCALAR >::safeName().

Referenced by gum::prm::PRMClass< GUM_SCALAR >::_addIOInterfaceFlags_(), gum::prm::PRMClass< GUM_SCALAR >::isOutputNode(), and gum::prm::PRMInterface< GUM_SCALAR >::isOutputNode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIOFlag_() [2/2]

template<GUM_Numeric GUM_SCALAR>
const std::pair< bool, bool > & gum::prm::PRMClassElementContainer< GUM_SCALAR >::getIOFlag_ ( const PRMClassElement< GUM_SCALAR > & elt) const
protectedvirtualinherited

Returns the IO flags of a PRMClassElement<GUM_SCALAR>.

Parameters
eltThe PRMClassElement<GUM_SCALAR>.
Returns
elt's IO flags.
Exceptions
NotFoundRaised if elt does not have any IO flags.

Definition at line 159 of file PRMClassElementContainer_tpl.h.

160 {
161 auto p = _IOFlags_.tryGet(elt.safeName());
162 if (!p) GUM_ERROR(NotFound, "this ClassElement<GUM_SCALAR> does not have any IO flags")
163 return *p;
164 }

References _IOFlags_, GUM_ERROR, and gum::prm::PRMClassElement< GUM_SCALAR >::safeName().

Here is the call graph for this function:

◆ implementations() [1/2]

template<GUM_Numeric GUM_SCALAR>
Set< PRMClass< GUM_SCALAR > * > & gum::prm::PRMInterface< GUM_SCALAR >::implementations ( )

Returns the set of Class<GUM_SCALAR> implementing this PRMInterface.

Definition at line 455 of file PRMInterface_tpl.h.

455 {
456 return _implementations_;
457 }

References _implementations_.

◆ implementations() [2/2]

template<GUM_Numeric GUM_SCALAR>
const Set< PRMClass< GUM_SCALAR > * > & gum::prm::PRMInterface< GUM_SCALAR >::implementations ( ) const

Returns the set of Class<GUM_SCALAR> implementing this PRMInterface.

Definition at line 460 of file PRMInterface_tpl.h.

460 {
461 return _implementations_;
462 }

References _implementations_.

◆ inheritInterface()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::PRMInterface< GUM_SCALAR >::inheritInterface ( )

Inherits from this interface super interface, this should only be done when this inteface inheritance was delayed.

Definition at line 89 of file PRMInterface_tpl.h.

89 {
91 }

References _inheritInterface_(), and _superInterface_.

Here is the call graph for this function:

◆ isClass()

INLINE bool gum::prm::PRMObject::isClass ( const PRMObject & obj)
staticinherited

Returns true if obj_ptr is of type Class.

Definition at line 93 of file PRMObject_inl.h.

93 {
94 return obj.obj_type() == prm_type::CLASS;
95 }

References PRMObject().

Referenced by gum::prm::PRMClass< GUM_SCALAR >::scope(), and gum::prm::PRMFactory< GUM_SCALAR >::startAttribute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isInnerNode()

template<GUM_Numeric GUM_SCALAR>
bool gum::prm::PRMClassElementContainer< GUM_SCALAR >::isInnerNode ( const PRMClassElement< GUM_SCALAR > & elt) const
virtualinherited

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.

Parameters
eltA PRMClassElement<GUM_SCALAR>.
Returns
true if elt is an inner node.
Exceptions
NotFoundRaised if NodeId does'nt match any PRMClassElement<GUM_SCALAR> in this.
WrongClassElementRaised if NodeId is neither an PRMAttribute nor an PRMAggregate.

Definition at line 137 of file PRMClassElementContainer_tpl.h.

138 {
139 auto p = _IOFlags_.tryGet(elt.safeName());
140 if (!p) return true;
141 return !(p->first || p->second);
142 }

References _IOFlags_, and gum::prm::PRMClassElement< GUM_SCALAR >::safeName().

Referenced by gum::prm::SVE< GUM_SCALAR >::_initLiftedNodes_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isInputNode()

template<GUM_Numeric GUM_SCALAR>
bool gum::prm::PRMClassElementContainer< GUM_SCALAR >::isInputNode ( const PRMClassElement< GUM_SCALAR > & elt) const
virtualinherited

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.

Parameters
eltA PRMClassElement<GUM_SCALAR>.
Returns
Returns true if id is an input node.

Definition at line 89 of file PRMClassElementContainer_tpl.h.

90 {
91 auto p = _IOFlags_.tryGet(elt.safeName());
92 if (!p) return false;
93 return p->first;
94 }

References _IOFlags_, and gum::prm::PRMClassElement< GUM_SCALAR >::safeName().

Here is the call graph for this function:

◆ isInstance()

INLINE bool gum::prm::PRMObject::isInstance ( const PRMObject & obj)
staticinherited

Returns true if obj_ptr is of type PRMInstance.

Definition at line 101 of file PRMObject_inl.h.

101 {
102 return obj.obj_type() == prm_type::INSTANCE;
103 }

References PRMObject(), INSTANCE, and obj_type().

Here is the call graph for this function:

◆ isInterface()

INLINE bool gum::prm::PRMObject::isInterface ( const PRMObject & obj)
staticinherited

Returns true if obj_ptr is of type PRMInterface.

Definition at line 97 of file PRMObject_inl.h.

97 {
98 return obj.obj_type() == prm_type::PRM_INTERFACE;
99 }

◆ isOutputNode()

template<GUM_Numeric GUM_SCALAR>
bool gum::prm::PRMInterface< GUM_SCALAR >::isOutputNode ( const PRMClassElement< GUM_SCALAR > & elt) const
overridevirtual

See gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(const std::string&).

Implements gum::prm::PRMClassElementContainer< GUM_SCALAR >.

Definition at line 479 of file PRMInterface_tpl.h.

479 {
480 try {
481 if (!this->getIOFlag_(elt).second) {
482 for (auto i: _implementations_) {
483 if (i->isOutputNode(elt)) { return true; }
484 }
485
486 if (_superInterface_ && _superInterface_->isOutputNode(elt)) { return true; }
487
488 } else {
489 return true;
490 }
491 } catch (NotFound const&) {}
492 return false;
493 }
virtual std::pair< bool, bool > & getIOFlag_(const PRMClassElement< GUM_SCALAR > &elt)
Returns the IO flags of a PRMClassElement<GUM_SCALAR>.
bool isOutputNode(const PRMClassElement< GUM_SCALAR > &elt) const override
See gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(conststd::string&).

References _implementations_, _superInterface_, and gum::prm::PRMClassElementContainer< GUM_SCALAR >::getIOFlag_().

Here is the call graph for this function:

◆ isSubTypeOf()

template<GUM_Numeric GUM_SCALAR>
bool gum::prm::PRMInterface< GUM_SCALAR >::isSubTypeOf ( const PRMClassElementContainer< GUM_SCALAR > & cec) const
overridevirtual

Test if this PRMInterface is a sub PRMInterface of cec.

PRMInterface can not be a sub PRMInterface of a Class<GUM_SCALAR>, so if cec is a Class<GUM_SCALAR> this method will return false.

If cec is an PRMInterface then this PRMInterface is a sub PRMInterface of cec if they are equal or there exists a super PRMInterface of this PRMInterface which is equal to cec.

Parameters
cecThe PRMClassElementContainer<GUM_SCALAR> for which we determine if this PRMInterface is a sub PRMInterface of it.
Returns
Returns true if this Class<GUM_SCALAR> is a subclass of cec.

Implements gum::prm::PRMClassElementContainer< GUM_SCALAR >.

Definition at line 290 of file PRMInterface_tpl.h.

291 {
292 switch (cec.obj_type()) {
294 return false;
295 }
296
298 const PRMInterface* current = this;
299
300 while (current != 0) {
301 if (current == &(cec)) return true;
302
304 }
305
306 return false;
307 }
308
309 default : {
310 GUM_ERROR(FatalError, "unknown ClassElementContainer<GUM_SCALAR>")
311 }
312 }
313 }
PRMObject::prm_type obj_type() const override
Implementation of pure virtual method of PRMObject.

References gum::prm::PRMClassElementContainer< GUM_SCALAR >::PRMClassElementContainer(), PRMInterface(), _superInterface_, gum::prm::PRMObject::CLASS, GUM_ERROR, gum::prm::PRMObject::obj_type(), and gum::prm::PRMObject::PRM_INTERFACE.

Here is the call graph for this function:

◆ isSuperTypeOf()

template<GUM_Numeric GUM_SCALAR>
bool gum::prm::PRMClassElementContainer< GUM_SCALAR >::isSuperTypeOf ( const PRMClassElementContainer< GUM_SCALAR > & cec) const
virtualinherited

Test if this PRMClassElementContainer is a super type of cec.

This returns cec.isSubTypeOf(*this).

Parameters
cec
Returns
return true if this PRMClassElementContainer is a super type of cec.

Definition at line 145 of file PRMClassElementContainer_tpl.h.

146 {
147 return cec.isSubTypeOf(*this);
148 }
virtual bool isSubTypeOf(const PRMClassElementContainer< GUM_SCALAR > &cec) const =0
Test if this PRMClassElementContainer is a subtype of cec.

References PRMClassElementContainer(), and isSubTypeOf().

Here is the call graph for this function:

◆ LEFT_CAST()

INLINE std::string gum::prm::PRMObject::LEFT_CAST ( )
staticinherited

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 71 of file PRMObject_inl.h.

71{ return "("; }

Referenced by gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), gum::prm::PRMReferenceSlot< GUM_SCALAR >::PRMReferenceSlot(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::PRMScalarAttribute(), gum::prm::PRMSlotChain< GUM_SCALAR >::PRMSlotChain(), gum::prm::PRMClassElement< GUM_SCALAR >::cast(), and gum::prm::decomposePath().

Here is the caller graph for this function:

◆ name() [1/2]

INLINE const std::string & gum::prm::PRMObject::name ( ) const
inherited

Returns the name of this object.

Definition at line 57 of file PRMObject_inl.h.

57{ return _name_; }
std::string _name_
Definition PRMObject.h:193

References _name_.

Referenced by gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), gum::prm::PRMAttribute< GUM_SCALAR >::PRMAttribute(), gum::prm::PRMClass< GUM_SCALAR >::PRMClass(), gum::prm::PRMClass< GUM_SCALAR >::PRMClass(), gum::prm::PRMClass< GUM_SCALAR >::PRMClass(), gum::prm::PRMClass< GUM_SCALAR >::PRMClass(), gum::prm::PRMClassElement< GUM_SCALAR >::PRMClassElement(), gum::prm::PRMClassElement< GUM_SCALAR >::PRMClassElement(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::PRMClassElementContainer(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), gum::prm::PRMFuncAttribute< GUM_SCALAR >::PRMFuncAttribute(), gum::prm::PRMInstance< GUM_SCALAR >::PRMInstance(), gum::prm::PRMInterface< GUM_SCALAR >::PRMInterface(), gum::prm::PRMInterface< GUM_SCALAR >::PRMInterface(), gum::prm::PRMInterface< GUM_SCALAR >::PRMInterface(), PRMObject(), gum::prm::PRMParameter< GUM_SCALAR >::PRMParameter(), gum::prm::PRMParameter< GUM_SCALAR >::PRMParameter(), gum::prm::PRMReferenceSlot< GUM_SCALAR >::PRMReferenceSlot(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::PRMScalarAttribute(), gum::prm::PRMSlotChain< GUM_SCALAR >::PRMSlotChain(), gum::prm::PRMSlotChain< GUM_SCALAR >::PRMSlotChain(), gum::prm::PRMSlotChain< GUM_SCALAR >::PRMSlotChain(), gum::prm::PRMSystem< GUM_SCALAR >::PRMSystem(), gum::prm::__print_attribute__(), gum::prm::__print_instance__(), gum::prm::SVE< GUM_SCALAR >::_addDelayedVariable_(), gum::prm::PRMClass< GUM_SCALAR >::_addIOInterfaceFlags_(), gum::prm::PRMFactory< GUM_SCALAR >::_addParent_(), gum::prm::PRMInstance< GUM_SCALAR >::_addReferingInstance_(), gum::prm::PRMClass< GUM_SCALAR >::_checkInterface_(), gum::prm::PRMFactory< GUM_SCALAR >::_checkInterfaceImplementation_(), gum::prm::PRMClass< GUM_SCALAR >::_checkInterfaces_(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkRawCPT_(), gum::prm::PRMClass< GUM_SCALAR >::_checkRefInterface_(), gum::prm::PRMClass< GUM_SCALAR >::_checkRefInterfaces_(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkRuleCPTSumsTo1_(), gum::prm::PRMInstance< GUM_SCALAR >::_copyAggregates_(), gum::prm::PRMInstance< GUM_SCALAR >::_copyAttribute_(), gum::prm::PRMSlotChain< GUM_SCALAR >::_copyLastElt_(), gum::prm::PRMSystem< GUM_SCALAR >::_groundAgg_(), gum::prm::PRMSystem< GUM_SCALAR >::_groundRef_(), gum::prm::PRMSystem< GUM_SCALAR >::_groundTensor_(), gum::prm::PRMSystem< double >::_groundTensor_(), gum::prm::PRMClass< GUM_SCALAR >::_inheritClass_(), gum::prm::PRMClass< GUM_SCALAR >::_overloadAttribute_(), gum::prm::PRMInterface< GUM_SCALAR >::_overloadAttribute_(), gum::prm::PRMClass< GUM_SCALAR >::_overloadParameter_(), gum::prm::PRMClass< GUM_SCALAR >::_overloadReference_(), gum::prm::PRMInterface< GUM_SCALAR >::_overloadReferenceSlot_(), gum::prm::gspan::StrictSearch< GUM_SCALAR >::_str_(), gum::prm::gspan::StrictSearch< GUM_SCALAR >::_str_(), gum::prm::gspan::StrictSearch< GUM_SCALAR >::_str_(), gum::prm::StructuredInference< GUM_SCALAR >::_str_(), gum::prm::StructuredInference< GUM_SCALAR >::_str_(), gum::prm::StructuredInference< GUM_SCALAR >::_str_(), gum::prm::PRMClass< GUM_SCALAR >::add(), gum::prm::PRMInterface< GUM_SCALAR >::add(), gum::prm::PRMSystem< GUM_SCALAR >::add(), gum::prm::PRMFactory< GUM_SCALAR >::addAggregator(), gum::prm::PRMFormAttribute< GUM_SCALAR >::addParent(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::addParent(), gum::prm::PRMClassElement< GUM_SCALAR >::cast(), gum::prm::PRMClass< GUM_SCALAR >::completeInheritance(), gum::prm::PRMFormAttribute< GUM_SCALAR >::copy(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::copy(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::exists(), gum::prm::PRMInstance< GUM_SCALAR >::exists(), gum::prm::PRMSystem< GUM_SCALAR >::exists(), gum::prm::o3prmr::O3prmrInterpreter::findAttributeName(), gum::prm::o3prmr::O3prmrInterpreter::findInstanceName(), gum::prm::PRMClass< GUM_SCALAR >::get(), gum::prm::PRMClass< GUM_SCALAR >::get(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::get(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::get(), gum::prm::PRMInstance< GUM_SCALAR >::get(), gum::prm::PRMInstance< GUM_SCALAR >::get(), gum::prm::PRMInterface< GUM_SCALAR >::get(), gum::prm::PRMInterface< GUM_SCALAR >::get(), gum::prm::PRMSystem< GUM_SCALAR >::get(), gum::prm::PRMSystem< GUM_SCALAR >::get(), gum::prm::PRMSystem< GUM_SCALAR >::getArray(), gum::prm::PRMSystem< GUM_SCALAR >::getArrayType(), gum::prm::PRMSystem< GUM_SCALAR >::getArrayType(), gum::prm::PRMAggregate< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMFormAttribute< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMSystem< GUM_SCALAR >::groundedBN(), gum::prm::PRMClass< GUM_SCALAR >::inheritAggregates(), gum::prm::PRMSystem< GUM_SCALAR >::isArray(), gum::prm::PRMClass< GUM_SCALAR >::isCastDescendant(), gum::prm::PRMSystem< GUM_SCALAR >::isInstance(), name(), gum::prm::PRMType::name(), gum::prm::PRMFormAttribute< GUM_SCALAR >::newFactory(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::newFactory(), operator!=(), operator<<(), gum::prm::PRMClass< GUM_SCALAR >::operator=(), operator==(), gum::prm::PRMType::operator==(), gum::prm::PRMClass< GUM_SCALAR >::operator[](), gum::prm::PRMClass< GUM_SCALAR >::operator[](), gum::prm::PRMClassElementContainer< GUM_SCALAR >::operator[](), gum::prm::PRMClassElementContainer< GUM_SCALAR >::operator[](), gum::prm::PRMInterface< GUM_SCALAR >::operator[](), gum::prm::PRMInterface< GUM_SCALAR >::operator[](), gum::prm::PRMClass< GUM_SCALAR >::overload(), gum::prm::PRMInterface< GUM_SCALAR >::overload(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::PRMClassElementContainterConstIterator, gum::prm::PRMFormAttribute< GUM_SCALAR >::setAsCastDescendant(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::setAsCastDescendant(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::setInputNode(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::setOutputNode(), gum::prm::PRMFactory< GUM_SCALAR >::startClass(), gum::prm::PRMFactory< GUM_SCALAR >::startInterface(), and gum::prm::PRMFactory< GUM_SCALAR >::startSystem().

◆ name() [2/2]

INLINE void gum::prm::PRMObject::name ( std::string_view name)
inherited

Change the name of the PRM Object.

Warning
Don't do this unless you know what you are doing !

Definition at line 61 of file PRMObject_inl.h.

61{ _name_ = name; }

References _name_, and name().

Here is the call graph for this function:

◆ obj_type()

template<GUM_Numeric GUM_SCALAR>
PRMObject::prm_type gum::prm::PRMInterface< GUM_SCALAR >::obj_type ( ) const
overridevirtual

Implementation of pure virtual method of PRMObject.

Implements gum::prm::PRMObject.

Definition at line 400 of file PRMInterface_tpl.h.

400 {
402 }

References gum::prm::PRMObject::PRM_INTERFACE.

◆ operator!=()

INLINE bool gum::prm::PRMObject::operator!= ( const PRMObject & obj) const
inherited

To PRMObject are equal if they have the same name (which is unique).

Definition at line 69 of file PRMObject_inl.h.

69{ return _name_ != obj.name(); }

References PRMObject(), _name_, and name().

Here is the call graph for this function:

◆ operator=()

template<GUM_Numeric GUM_SCALAR>
PRMInterface< GUM_SCALAR > & gum::prm::PRMInterface< GUM_SCALAR >::operator= ( const PRMInterface< GUM_SCALAR > & source)
private

Copy operator. Don't use it.

References PRMInterface().

Here is the call graph for this function:

◆ operator==()

INLINE bool gum::prm::PRMObject::operator== ( const PRMObject & obj) const
inherited

To PRMObject are equal if they have the same name (which is unique).

Definition at line 65 of file PRMObject_inl.h.

65{ return _name_ == obj.name(); }

References PRMObject(), _name_, and name().

Here is the call graph for this function:

◆ operator[]() [1/4]

template<GUM_Numeric GUM_SCALAR>
const PRMClassElement< GUM_SCALAR > & gum::prm::PRMInterface< GUM_SCALAR >::operator[] ( NodeId id) const
overridevirtual

See gum::prm::PRMClassElementContainer<GUM_SCALAR>::operator[](NodeId).

Implements gum::prm::PRMClassElementContainer< GUM_SCALAR >.

Definition at line 384 of file PRMInterface_tpl.h.

384 {
385 return get(id);
386 }
PRMClassElement< GUM_SCALAR > & get(NodeId id) override
See gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(NodeId).

References get().

Here is the call graph for this function:

◆ operator[]() [2/4]

template<GUM_Numeric GUM_SCALAR>
PRMClassElement< GUM_SCALAR > & gum::prm::PRMInterface< GUM_SCALAR >::operator[] ( NodeId id)
overridevirtual

See gum::prm::PRMClassElementContainer<GUM_SCALAR>::operator[](NodeId).

Implements gum::prm::PRMClassElementContainer< GUM_SCALAR >.

Definition at line 379 of file PRMInterface_tpl.h.

379 {
380 return get(id);
381 }

References get().

Here is the call graph for this function:

◆ operator[]() [3/4]

template<GUM_Numeric GUM_SCALAR>
const PRMClassElement< GUM_SCALAR > & gum::prm::PRMInterface< GUM_SCALAR >::operator[] ( std::string_view name) const
overridevirtual

See gum::prm::PRMClassElementContainer<GUM_SCALAR>::operator[](const std::string&).

Implements gum::prm::PRMClassElementContainer< GUM_SCALAR >.

Definition at line 395 of file PRMInterface_tpl.h.

395 {
396 return get(name);
397 }

References get(), and gum::prm::PRMObject::name().

Here is the call graph for this function:

◆ operator[]() [4/4]

template<GUM_Numeric GUM_SCALAR>
PRMClassElement< GUM_SCALAR > & gum::prm::PRMInterface< GUM_SCALAR >::operator[] ( std::string_view name)
overridevirtual

See gum::prm::PRMClassElementContainer<GUM_SCALAR>::operator[](const std::string&).

Implements gum::prm::PRMClassElementContainer< GUM_SCALAR >.

Definition at line 389 of file PRMInterface_tpl.h.

389 {
390 return get(name);
391 }

References get(), and gum::prm::PRMObject::name().

Here is the call graph for this function:

◆ overload()

template<GUM_Numeric GUM_SCALAR>
NodeId gum::prm::PRMInterface< GUM_SCALAR >::overload ( PRMClassElement< GUM_SCALAR > * elt)
overridevirtual

Add a new PRMClassElement<GUM_SCALAR> which overload an inherited PRMClassElement<GUM_SCALAR>.

The pointer is "given" to this class, which will delete it when ~Class<GUM_SCALAR>() is called.

The NodeId of elt is defined when it is added to this, discarding any previous value. There is no garanty 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>. You do not define dependencies in an PRMInterface so it is useless to overload an PRMAttribute<GUM_SCALAR> with another sharing the same type, and if tried it will raise an OperationNotAllowed exception.

Parameters
eltThe new PRMClassElement<GUM_SCALAR> overloading an inherited PRMClassElement<GUM_SCALAR> in this.
Returns
the NodeId assigned to elt.
Exceptions
NotFoundRaised if no overloaded PRMClassElement<GUM_SCALAR> is found.
OperationNotAllowedRaised if the overloading is impossible.

Implements gum::prm::PRMClassElementContainer< GUM_SCALAR >.

Definition at line 167 of file PRMInterface_tpl.h.

167 {
168 if (!_superInterface_)
169 GUM_ERROR(OperationNotAllowed, "overload is possible only with sub interfaces")
170
171 if (!super().exists(overloader->name()))
172 GUM_ERROR(OperationNotAllowed, "found no ClassElement<GUM_SCALAR> to overload")
173
176 GUM_ERROR(DuplicateElement, "duplicate ClassElement '" << overloader->name() << "'")
177
179 GUM_ERROR(OperationNotAllowed, "illegal overload")
180
186 break;
187 }
188
193 break;
194 }
195
199 "Element " << overloader->name() << " can not be overloaded")
200 default :
201 GUM_ERROR(FatalError, "Unknown ClassElement<GUM_SCALAR> type for " << overloader->name())
202 }
203
204 return overloader->id();
205 }
virtual bool exists(std::string_view name) const
Returns true if a member with the given name exists in this PRMClassElementContainer or in the PRMCla...
void _overloadReferenceSlot_(PRMReferenceSlot< GUM_SCALAR > *overloader, PRMReferenceSlot< GUM_SCALAR > *overloaded)
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this....
void _overloadAttribute_(PRMAttribute< GUM_SCALAR > *overloader, PRMAttribute< GUM_SCALAR > *overloaded)
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this....
bool _checkOverloadLegality_(const PRMClassElement< GUM_SCALAR > *overloaded, const PRMClassElement< GUM_SCALAR > *overloader)
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this....

References _checkOverloadLegality_(), _nameMap_, _overloadAttribute_(), _overloadReferenceSlot_(), _superInterface_, gum::prm::PRMClassElement< GUM_SCALAR >::elt_type(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::exists(), GUM_ERROR, gum::prm::PRMClassElement< GUM_SCALAR >::id(), gum::prm::PRMObject::name(), gum::prm::PRMClassElement< GUM_SCALAR >::prm_aggregate, gum::prm::PRMClassElement< GUM_SCALAR >::prm_attribute, gum::prm::PRMClassElement< GUM_SCALAR >::prm_refslot, gum::prm::PRMClassElement< GUM_SCALAR >::prm_slotchain, and super().

Here is the call graph for this function:

◆ referenceSlots()

template<GUM_Numeric GUM_SCALAR>
const Set< PRMReferenceSlot< GUM_SCALAR > * > & gum::prm::PRMInterface< GUM_SCALAR >::referenceSlots ( ) const

Returns the set of PRMAggregate of this Class<GUM_SCALAR>.

Returns
Returns the set of PRMAggregate of this Class<GUM_SCALAR>.

Definition at line 450 of file PRMInterface_tpl.h.

450 {
451 return _referenceSlots_;
452 }

References _referenceSlots_.

◆ RIGHT_CAST()

INLINE std::string gum::prm::PRMObject::RIGHT_CAST ( )
staticinherited

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 73 of file PRMObject_inl.h.

73{ return ")"; }

Referenced by gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), gum::prm::PRMReferenceSlot< GUM_SCALAR >::PRMReferenceSlot(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::PRMScalarAttribute(), gum::prm::PRMSlotChain< GUM_SCALAR >::PRMSlotChain(), gum::prm::PRMClassElement< GUM_SCALAR >::cast(), and gum::prm::decomposePath().

Here is the caller graph for this function:

◆ setInputNode()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::PRMClassElementContainer< GUM_SCALAR >::setInputNode ( const PRMClassElement< GUM_SCALAR > & elt,
bool b )
virtualinherited

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.

Parameters
eltA PRMClassElement<GUM_SCALAR>.
bThe flag value.
Exceptions
NotFoundRaised if id does'nt match any PRMClassElement<GUM_SCALAR> in this.
WrongClassElementRaised if NodeId is neither an PRMAttribute nor an PRMAggregate.

Definition at line 97 of file PRMClassElementContainer_tpl.h.

99 {
100 if (!exists(elt.safeName())) {
101 GUM_ERROR(NotFound, ": <" + elt.safeName() + "> is not in <" + name() + ">")
104 if (auto p = _IOFlags_.tryGet(elt.safeName())) {
105 p->first = b;
106 } else {
107 setIOFlag_(elt, std::make_pair(b, false));
108 }
109 } else {
110 GUM_ERROR(WrongClassElement, "given id is not an PRMAttribute or an PRMAggregate")
111 }
112 }

References _IOFlags_, exists(), GUM_ERROR, gum::prm::PRMClassElement< GUM_SCALAR >::isAggregate(), gum::prm::PRMClassElement< GUM_SCALAR >::isAttribute(), gum::prm::PRMObject::name(), gum::prm::PRMClassElement< GUM_SCALAR >::safeName(), and setIOFlag_().

Referenced by gum::prm::PRMClass< GUM_SCALAR >::addArc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setIOFlag_()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::PRMClassElementContainer< GUM_SCALAR >::setIOFlag_ ( const PRMClassElement< GUM_SCALAR > & elt,
const std::pair< bool, bool > & flags )
protectedvirtualinherited

Defines the IO flags of a PRMClassElement<GUM_SCALAR>.

Parameters
eltThe PRMClassElement<GUM_SCALAR>.
flagsThe IO flags of elt. Overwrite any existing flags.
Returns
elt's IO flags.
Exceptions
NotFoundRaised if elt does not have any IO flags.

Definition at line 168 of file PRMClassElementContainer_tpl.h.

169 {
170 if (auto p = _IOFlags_.tryGet(elt.safeName())) {
171 *p = flags;
172 } else {
173 _IOFlags_.insert(elt.safeName(), flags);
174 }
175 }

References _IOFlags_, and gum::prm::PRMClassElement< GUM_SCALAR >::safeName().

Referenced by gum::prm::PRMClass< GUM_SCALAR >::_addIOInterfaceFlags_(), copyIOFlags_(), setInputNode(), and setOutputNode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setOutputNode()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::PRMClassElementContainer< GUM_SCALAR >::setOutputNode ( const PRMClassElement< GUM_SCALAR > & elt,
bool b )
virtualinherited

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.

Parameters
eltA PRMClassElement<GUM_SCALAR>.
bThe flag value.
Exceptions
NotFoundRaised if id does'nt match any PRMClassElement<GUM_SCALAR> in this.
WrongClassElementRaised if NodeId is neither an PRMAttribute nor an PRMAggregate.

Definition at line 115 of file PRMClassElementContainer_tpl.h.

117 {
118 if (!exists(elt.safeName())) {
119 GUM_ERROR(NotFound, "<" + elt.safeName() + "> is not in <" + name() + ">")
122 if (auto p = _IOFlags_.tryGet(elt.safeName())) {
123 p->second = b;
124 } else {
125 setIOFlag_(elt, std::make_pair(false, b));
126 }
127
128 if (b) { updateDescendants_(elt); }
129 } else {
131 "given ClassElement<GUM_SCALAR> is not an "
132 "PRMAttribute or an PRMAggregate");
133 }
134 }
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 de...

References _IOFlags_, exists(), GUM_ERROR, gum::prm::PRMClassElement< GUM_SCALAR >::isAggregate(), gum::prm::PRMClassElement< GUM_SCALAR >::isAttribute(), gum::prm::PRMObject::name(), gum::prm::PRMClassElement< GUM_SCALAR >::safeName(), setIOFlag_(), and updateDescendants_().

Referenced by gum::prm::PRMFactory< GUM_SCALAR >::_buildSlotChain_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ super() [1/2]

template<GUM_Numeric GUM_SCALAR>
PRMInterface< GUM_SCALAR > & gum::prm::PRMInterface< GUM_SCALAR >::super ( )

Returns the superInterface of this PRMInterface.

Returns
Returns the super PRMInterface of this PRMInterface.
Exceptions
NotFoundRaised if this has no super PRMInterface.

Definition at line 357 of file PRMInterface_tpl.h.

357 {
359 else GUM_ERROR(NotFound, "this Interface is ! a sub interface")
360 }

References PRMInterface(), _superInterface_, and GUM_ERROR.

Referenced by PRMInterface(), and overload().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ super() [2/2]

template<GUM_Numeric GUM_SCALAR>
const PRMInterface< GUM_SCALAR > & gum::prm::PRMInterface< GUM_SCALAR >::super ( ) const

Returns the superInterface of this PRMInterface.

Returns
Returns the super PRMInterface of this PRMInterface.
Exceptions
NotFoundRaised if this has no super PRMInterface.

Definition at line 363 of file PRMInterface_tpl.h.

363 {
365 else GUM_ERROR(NotFound, "this Interface is ! a sub interface")
366 }

References PRMInterface(), _superInterface_, and GUM_ERROR.

Here is the call graph for this function:

◆ updateDescendants_()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::PRMInterface< GUM_SCALAR >::updateDescendants_ ( const PRMClassElement< GUM_SCALAR > & elt)
overrideprotectedvirtual

See gum::prm::PRMClassElementContainer<GUM_SCALAR>(const PRMClassElement<GUM_SCALAR>&).

Implements gum::prm::PRMClassElementContainer< GUM_SCALAR >.

Definition at line 316 of file PRMInterface_tpl.h.

316 {
317 // for ( const auto ext : _extensions_ )
318 // if ( !ext->isOutputNode( elt ) ) ext->setOutputNode( elt, true );
319
320 // for ( const auto impl : _implementations_ ) {
321 // // Because of cyclic dependencies we must use a reinterpret cast.
322 // PRMClassElementContainer<GUM_SCALAR>* c =
323 // reinterpret_cast<PRMClassElementContainer<GUM_SCALAR>*>( impl );
324
325 // if ( ! c->isOutputNode( elt ) ) c->setOutputNode( elt, true );
326 //}
327 }

◆ PRMClass< GUM_SCALAR >

template<GUM_Numeric GUM_SCALAR>
friend class PRMClass< GUM_SCALAR >
friend

Definition at line 404 of file PRMInterface.h.

References PRMInterface().

Referenced by _addImplementation_().

Member Data Documentation

◆ _attributes_

template<GUM_Numeric GUM_SCALAR>
Set< PRMAttribute< GUM_SCALAR >* > gum::prm::PRMInterface< GUM_SCALAR >::_attributes_
private

◆ _dag_

template<GUM_Numeric GUM_SCALAR>
DAG gum::prm::PRMInterface< GUM_SCALAR >::_dag_
private

The dag representing dependencies between formal attributes and slots.

Definition at line 338 of file PRMInterface.h.

Referenced by PRMInterface(), _addCastDescendants_(), _inheritInterface_(), _overloadAttribute_(), add(), dag_(), and dag_().

◆ _extensions_

template<GUM_Numeric GUM_SCALAR>
Set< PRMInterface< GUM_SCALAR >* > gum::prm::PRMInterface< GUM_SCALAR >::_extensions_
private

The set of Class<GUM_SCALAR> which implements this PRMInterface.

Definition at line 381 of file PRMInterface.h.

Referenced by _addExtension_(), and findAllSubtypes_().

◆ _implementations_

template<GUM_Numeric GUM_SCALAR>
Set< PRMClass< GUM_SCALAR >* > gum::prm::PRMInterface< GUM_SCALAR >::_implementations_
private

The set of Class<GUM_SCALAR> which implements this PRMInterface.

Definition at line 373 of file PRMInterface.h.

Referenced by _addImplementation_(), findAllSubtypes_(), implementations(), implementations(), and isOutputNode().

◆ _IOFlags_

template<GUM_Numeric GUM_SCALAR>
HashTable< std::string, std::pair< bool, bool > > gum::prm::PRMClassElementContainer< GUM_SCALAR >::_IOFlags_
privateinherited

input / output flags, useful when inheriting or copying.

Definition at line 451 of file PRMClassElementContainer.h.

Referenced by copyIOFlags_(), getIOFlag_(), getIOFlag_(), isInnerNode(), isInputNode(), setInputNode(), setIOFlag_(), and setOutputNode().

◆ _name_

std::string gum::prm::PRMObject::_name_
privateinherited

Definition at line 193 of file PRMObject.h.

Referenced by PRMObject(), PRMObject(), PRMObject(), name(), name(), operator!=(), operator=(), and operator==().

◆ _nameMap_

template<GUM_Numeric GUM_SCALAR>
HashTable< std::string, PRMClassElement< GUM_SCALAR >* > gum::prm::PRMInterface< GUM_SCALAR >::_nameMap_
private

Mapping between a member's name and itself. Used for fast access to a member given it's name.

Definition at line 352 of file PRMInterface.h.

Referenced by _addCastDescendants_(), _inheritInterface_(), _overloadAttribute_(), _overloadReferenceSlot_(), add(), get(), get(), and overload().

◆ _nodeIdMap_

template<GUM_Numeric GUM_SCALAR>
NodeProperty< PRMClassElement< GUM_SCALAR >* > gum::prm::PRMInterface< GUM_SCALAR >::_nodeIdMap_
private

Mapping between node's id and their name (being an attribute or a slot). Used for fast access to a member given it's node id.

Definition at line 342 of file PRMInterface.h.

Referenced by ~PRMInterface(), _addCastDescendants_(), _inheritInterface_(), _overloadAttribute_(), _overloadReferenceSlot_(), add(), begin(), begin(), end(), end(), get(), and get().

◆ _referenceSlots_

template<GUM_Numeric GUM_SCALAR>
Set< PRMReferenceSlot< GUM_SCALAR >* > gum::prm::PRMInterface< GUM_SCALAR >::_referenceSlots_
private

The sequence of PRMReferenceSlot<GUM_SCALAR>.

Definition at line 358 of file PRMInterface.h.

Referenced by _inheritInterface_(), _overloadReferenceSlot_(), add(), and referenceSlots().

◆ _superInterface_

template<GUM_Numeric GUM_SCALAR>
PRMInterface< GUM_SCALAR >* gum::prm::PRMInterface< GUM_SCALAR >::_superInterface_
private

The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this. Note that this is first searched for gum::PRMClassElement<GUM_SCALAR>.

Definition at line 370 of file PRMInterface.h.

Referenced by PRMInterface(), PRMInterface(), PRMInterface(), inheritInterface(), isOutputNode(), isSubTypeOf(), overload(), super(), and super().


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