aGrUM  0.18.2
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 <PRMClass.h>

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

Public Member Functions

Constructor & destructor.
 PRMInterface (const std::string &name)
 Default constructor. More...
 
 PRMInterface (const std::string &name, PRMInterface< GUM_SCALAR > &super, bool delayInheritance=false)
 Constructor for building a subclass of super. More...
 
 PRMInterface (const PRMInterface< GUM_SCALAR > &source)
 Copy constructor. More...
 
virtual ~PRMInterface ()
 Destructor. More...
 
Graphical model getters and setters
virtual PRMObject::prm_type obj_type () const
 Implementation of pure virtual method of PRMObject. More...
 
virtual PRMClassElement< GUM_SCALAR > & get (NodeId id)
 See gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(NodeId). More...
 
virtual const PRMClassElement< GUM_SCALAR > & get (NodeId id) const
 Se gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(NodeId). More...
 
void addArc (const std::string &tail, const std::string &head)
 An Interfance doesn't have any arc, this will raise an OperationNotAllowed exception. More...
 
PRMClassElement<GUM_SCALAR> getters and setters
virtual bool isOutputNode (const PRMClassElement< GUM_SCALAR > &elt) const
 See gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(const std::string&). More...
 
virtual PRMClassElement< GUM_SCALAR > & get (const std::string &name)
 See gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(const std::string&). More...
 
virtual const PRMClassElement< GUM_SCALAR > & get (const std::string &name) const
 See gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(const std::string&). More...
 
const Set< PRMAttribute< GUM_SCALAR > *> & attributes () const
 Returns the set of PRMAttribute<GUM_SCALAR> of this Class<GUM_SCALAR>. More...
 
const Set< PRMReferenceSlot< GUM_SCALAR > *> & referenceSlots () const
 Returns the set of PRMAggregate of this Class<GUM_SCALAR>. More...
 
NodeId add (PRMClassElement< GUM_SCALAR > *elt)
 See gum::prm::PRMClassElementContainer<GUM_SCALAR>::add(PRMClassElement<GUM_SCALAR>*). More...
 
NodeId overload (PRMClassElement< GUM_SCALAR > *elt)
 Add a new PRMClassElement<GUM_SCALAR> which overload an inherited PRMClassElement<GUM_SCALAR>. More...
 
Inheritance methods
virtual bool isSubTypeOf (const PRMClassElementContainer< GUM_SCALAR > &cec) const
 Test if this PRMInterface is a sub PRMInterface of cec. More...
 
PRMInterface< GUM_SCALAR > & super ()
 Returns the superInterface of this PRMInterface. More...
 
const PRMInterface< GUM_SCALAR > & super () const
 Returns the superInterface of this PRMInterface. More...
 
Set< PRMClass< GUM_SCALAR > *> & implementations ()
 Returns the set of Class<GUM_SCALAR> implementing this PRMInterface. More...
 
const Set< PRMClass< GUM_SCALAR > *> & implementations () const
 Returns the set of Class<GUM_SCALAR> implementing this PRMInterface. More...
 
void inheritInterface ()
 Inherits from this interface super interface, this should only be done when this inteface inheritance was delayed. More...
 
Getters & setters operators
PRMClassElement< GUM_SCALAR > & operator[] (NodeId id)
 See gum::prm::PRMClassElementContainer<GUM_SCALAR>::operator[](NodeId). More...
 
const PRMClassElement< GUM_SCALAR > & operator[] (NodeId id) const
 See gum::prm::PRMClassElementContainer<GUM_SCALAR>::operator[](NodeId). More...
 
PRMClassElement< GUM_SCALAR > & operator[] (const std::string &name)
 See gum::prm::PRMClassElementContainer<GUM_SCALAR>::operator[](const std::string&). More...
 
const PRMClassElement< GUM_SCALAR > & operator[] (const std::string &name) const
 See gum::prm::PRMClassElementContainer<GUM_SCALAR>::operator[](const std::string&). 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 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 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 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 const DAGcontainerDag () const
 Returns the gum::DAG of this PRMClassElementContainer. More...
 
Inheritance getters and setters
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...
 
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

const DAGdag_ () const
 Returns a constant reference over this PRMInterface's DAG. More...
 
DAGdag_ ()
 Returns a non constant reference over this PRMInterface's DAG. More...
 
void findAllSubtypes_ (Set< PRMClassElementContainer< GUM_SCALAR > * > &set)
 Fills set with all the subtypes of this PRMInterface, this includes extensions and implementations. More...
 
void updateDescendants_ (const PRMClassElement< GUM_SCALAR > &elt)
 See gum::prm::PRMClassElementContainer<GUM_SCALAR>(const PRMClassElement<GUM_SCALAR>&). 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...
 

Friends

class PRMClass< GUM_SCALAR >
 

Iterators

typedef NodeProperty< PRMClassElement< GUM_SCALAR > *>::iterator ClassEltIterator
 
typedef NodeProperty< PRMClassElement< GUM_SCALAR > *>::const_iterator const_ClassEltIterator
 
ClassEltIterator begin ()
 
const ClassEltIteratorend ()
 
const_ClassEltIterator begin () const
 
const const_ClassEltIteratorend () const
 

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>. More...
 
Set< PRMClass< GUM_SCALAR > *> implementations__
 The set of Class<GUM_SCALAR> which implements this PRMInterface. More...
 
Set< PRMInterface< GUM_SCALAR > *> extensions__
 The set of Class<GUM_SCALAR> which implements this PRMInterface. More...
 
void addImplementation__ (PRMClass< GUM_SCALAR > *c)
 Add an Class<GUM_SCALAR> to the set of Class<GUM_SCALAR> which implements this PRMInterface. More...
 
void addExtension__ (PRMInterface< GUM_SCALAR > *c)
 Add an Class<GUM_SCALAR> to the set of Class<GUM_SCALAR> which implements this PRMInterface. More...
 
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>. More...
 
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>. More...
 
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>. More...
 
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>. More...
 

Built-in types.

enum  prm_type : char {
  prm_type::ALL, prm_type::CLASS, prm_type::PRM_INTERFACE, prm_type::CLASS_ELT,
  prm_type::TYPE, prm_type::SYSTEM, prm_type::INSTANCE
}
 Enumeration of the different types of objects handled by a PRM. More...
 
static std::string LEFT_CAST ()
 Enumeration of the different types of objects handled by a PRM. More...
 
static std::string RIGHT_CAST ()
 Enumeration of the different types of objects handled by a PRM. More...
 
static std::string enum2str (prm_type type)
 Returns the string representation of a PRMObject. More...
 
static INLINE bool isClass (const PRMObject &obj)
 Returns true if obj_ptr is of type Class. More...
 
static INLINE bool isInterface (const PRMObject &obj)
 Returns true if obj_ptr is of type PRMInterface. More...
 
static INLINE bool isInstance (const PRMObject &obj)
 Returns true if obj_ptr is of type PRMInstance. More...
 

Detailed Description

template<typename 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 54 of file PRMClass.h.

Member Typedef Documentation

◆ ClassEltIterator

template<typename GUM_SCALAR>
typedef NodeProperty< PRMClassElement< GUM_SCALAR >* >::iterator gum::prm::PRMInterface< GUM_SCALAR >::ClassEltIterator

Definition at line 285 of file PRMInterface.h.

◆ const_ClassEltIterator

template<typename GUM_SCALAR>
typedef NodeProperty< PRMClassElement< GUM_SCALAR >* >::const_iterator gum::prm::PRMInterface< GUM_SCALAR >::const_ClassEltIterator

Definition at line 291 of file PRMInterface.h.

Member Enumeration Documentation

◆ prm_type

enum 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 69 of file PRMObject.h.

69  : char {
70  ALL,
71  CLASS,
72  PRM_INTERFACE,
73  CLASS_ELT,
74  TYPE,
75  SYSTEM,
76  INSTANCE
77  };

Constructor & Destructor Documentation

◆ PRMInterface() [1/3]

template<typename GUM_SCALAR >
gum::prm::PRMInterface< GUM_SCALAR >::PRMInterface ( const std::string &  name)
explicit

Default constructor.

Parameters
nameThe interface name.

Definition at line 37 of file PRMInterface_tpl.h.

37  :
38  PRMClassElementContainer< GUM_SCALAR >(name), superInterface__(0) {
39  GUM_CONSTRUCTOR(PRMInterface);
40  }
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:35
PRMInterface(const std::string &name)
Default constructor.
PRMInterface< GUM_SCALAR > * superInterface__
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
Definition: PRMInterface.h:359

◆ PRMInterface() [2/3]

template<typename GUM_SCALAR>
gum::prm::PRMInterface< GUM_SCALAR >::PRMInterface ( const std::string &  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 43 of file PRMInterface_tpl.h.

45  :
46  PRMClassElementContainer< GUM_SCALAR >(name),
48  GUM_CONSTRUCTOR(PRMInterface);
49  if (!delayInheritance) { inheritInterface__(super); }
50  }
void inheritInterface__(const PRMInterface< GUM_SCALAR > &i)
Proceed with the copy of i in this.
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:35
PRMInterface(const std::string &name)
Default constructor.
PRMInterface< GUM_SCALAR > & super()
Returns the superInterface of this PRMInterface.
PRMInterface< GUM_SCALAR > * superInterface__
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
Definition: PRMInterface.h:359

◆ PRMInterface() [3/3]

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

Copy constructor.

Definition at line 53 of file PRMInterface_tpl.h.

54  :
55  PRMClassElementContainer< GUM_SCALAR >(source.name()),
56  dag__(source.dag__), superInterface__(source.superInterface__) {
57  GUM_CONS_CPY(PRMInterface);
58  GUM_ERROR(FatalError, "don't copy an interface");
59  }
PRMInterface(const std::string &name)
Default constructor.
DAG dag__
The dag representing dependencies between formal attributes and slots.
Definition: PRMInterface.h:327
PRMInterface< GUM_SCALAR > * superInterface__
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
Definition: PRMInterface.h:359
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55

◆ ~PRMInterface()

template<typename GUM_SCALAR >
gum::prm::PRMInterface< GUM_SCALAR >::~PRMInterface ( )
virtual

Destructor.

Definition at line 62 of file PRMInterface_tpl.h.

62  {
63  GUM_DESTRUCTOR(PRMInterface);
64 
65  for (const auto& elt: nodeIdMap__) {
66  delete elt.second;
67  }
68  }
PRMInterface(const std::string &name)
Default constructor.
NodeProperty< PRMClassElement< GUM_SCALAR > *> nodeIdMap__
Mapping between node&#39;s id and their name (being an attribute or a slot). Used for fast access to a me...
Definition: PRMInterface.h:331

Member Function Documentation

◆ add()

template<typename GUM_SCALAR>
NodeId gum::prm::PRMInterface< GUM_SCALAR >::add ( PRMClassElement< GUM_SCALAR > *  elt)
virtual

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

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

Definition at line 116 of file PRMInterface_tpl.h.

116  {
117  if (nameMap__.exists(elt->name())) {
118  GUM_ERROR(DuplicateElement,
119  "name '" << elt->name()
120  << "' is already used by another ClassElement");
121  }
122 
124  PRMAttribute< GUM_SCALAR >* attr =
125  static_cast< PRMAttribute< GUM_SCALAR >* >(elt);
126  nameMap__.insert(attr->name(), attr);
127 
128  while (true) {
129  attr->setId(nextNodeId());
130  dag__.addNodeWithId(attr->id());
131  nodeIdMap__.insert(attr->id(), attr);
132  nameMap__.insert(attr->safeName(), attr);
133  attributes__.insert(attr);
134 
135  if (attr->type().isSubType()) {
136  attr = attr->getCastDescendant();
137  } else {
138  break;
139  }
140  }
142  elt->setId(nextNodeId());
143  dag__.addNodeWithId(elt->id());
144  nodeIdMap__.insert(elt->id(), elt);
145  referenceSlots__.insert(
146  static_cast< PRMReferenceSlot< GUM_SCALAR >* >(elt));
147  nameMap__.insert(elt->name(), elt);
148  nameMap__.insert(elt->safeName(), elt);
149  } else {
150  GUM_ERROR(WrongClassElement,
151  "illegal ClassElement<GUM_SCALAR> for an Interface");
152  }
153 
154  return elt->id();
155  }
virtual void addNodeWithId(const NodeId id)
try to insert a node with the given id
Set< PRMReferenceSlot< GUM_SCALAR > *> referenceSlots__
The sequence of PRMReferenceSlot<GUM_SCALAR>.
Definition: PRMInterface.h:347
Set< PRMAttribute< GUM_SCALAR > *> attributes__
The sequence of PRMAttribute<GUM_SCALAR>s.
Definition: PRMInterface.h:344
static INLINE bool isAttribute(const PRMClassElement< GUM_SCALAR > &elt)
Returns true if obj_ptr is of type PRMAttribute.
static INLINE bool isReferenceSlot(const PRMClassElement< GUM_SCALAR > &elt)
Returns true if obj_ptr is of type PRMReferenceSlot.
NodeId nextNodeId()
Returns the next value of an unique counter for PRM&#39;s node id.
Definition: utils_prm.cpp:65
HashTable< std::string, PRMClassElement< GUM_SCALAR > *> nameMap__
Mapping between a member&#39;s name and itself. Used for fast access to a member given it&#39;s name...
Definition: PRMInterface.h:341
NodeProperty< PRMClassElement< GUM_SCALAR > *> nodeIdMap__
Mapping between node&#39;s id and their name (being an attribute or a slot). Used for fast access to a me...
Definition: PRMInterface.h:331
DAG dag__
The dag representing dependencies between formal attributes and slots.
Definition: PRMInterface.h:327
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55

◆ addArc()

template<typename GUM_SCALAR >
INLINE void gum::prm::PRMInterface< GUM_SCALAR >::addArc ( const std::string &  tail,
const std::string &  head 
)
virtual

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 367 of file PRMInterface_tpl.h.

368  {
369  GUM_ERROR(OperationNotAllowed, "an Interface does ! have arcs");
370  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55

◆ addCastDescendants__()

template<typename 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 257 of file PRMInterface_tpl.h.

258  {
259  PRMAttribute< GUM_SCALAR >* parent = start;
260  PRMAttribute< GUM_SCALAR >* child = nullptr;
261 
262  while (parent->type().superType() != end->type()) {
263  child = parent->getCastDescendant();
264  child->setId(nextNodeId());
265  dag__.addNodeWithId(child->id());
266  nodeIdMap__.insert(child->id(), child);
267  // Only use child's safe name when adding to the name map!
268  nameMap__.insert(child->safeName(), child);
269  attributes__.insert(child);
270  // Do ! use Class<GUM_SCALAR>::insertArc(), child's CPF is already
271  // initialized properly
272  parent = child;
273  }
274 
275  parent->setAsCastDescendant(end);
276  }
virtual void addNodeWithId(const NodeId id)
try to insert a node with the given id
Set< PRMAttribute< GUM_SCALAR > *> attributes__
The sequence of PRMAttribute<GUM_SCALAR>s.
Definition: PRMInterface.h:344
NodeId nextNodeId()
Returns the next value of an unique counter for PRM&#39;s node id.
Definition: utils_prm.cpp:65
HashTable< std::string, PRMClassElement< GUM_SCALAR > *> nameMap__
Mapping between a member&#39;s name and itself. Used for fast access to a member given it&#39;s name...
Definition: PRMInterface.h:341
const ClassEltIterator & end()
NodeProperty< PRMClassElement< GUM_SCALAR > *> nodeIdMap__
Mapping between node&#39;s id and their name (being an attribute or a slot). Used for fast access to a me...
Definition: PRMInterface.h:331
DAG dag__
The dag representing dependencies between formal attributes and slots.
Definition: PRMInterface.h:327

◆ addExtension__()

template<typename GUM_SCALAR>
INLINE 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 397 of file PRMInterface_tpl.h.

397  {
398  extensions__.insert(i);
399  }
Set< PRMInterface< GUM_SCALAR > *> extensions__
The set of Class<GUM_SCALAR> which implements this PRMInterface.
Definition: PRMInterface.h:370

◆ addImplementation__()

template<typename GUM_SCALAR>
INLINE 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 391 of file PRMInterface_tpl.h.

391  {
392  implementations__.insert(c);
393  }
Set< PRMClass< GUM_SCALAR > *> implementations__
The set of Class<GUM_SCALAR> which implements this PRMInterface.
Definition: PRMInterface.h:362

◆ attributes()

template<typename GUM_SCALAR >
INLINE 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 483 of file PRMInterface_tpl.h.

483  {
484  return attributes__;
485  }
Set< PRMAttribute< GUM_SCALAR > *> attributes__
The sequence of PRMAttribute<GUM_SCALAR>s.
Definition: PRMInterface.h:344

◆ begin() [1/2]

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

Definition at line 344 of file PRMInterface_tpl.h.

Referenced by gum::prm::PRMInterface< double >::begin().

344  {
345  return nodeIdMap__.begin();
346  }
NodeProperty< PRMClassElement< GUM_SCALAR > *> nodeIdMap__
Mapping between node&#39;s id and their name (being an attribute or a slot). Used for fast access to a me...
Definition: PRMInterface.h:331
+ Here is the caller graph for this function:

◆ begin() [2/2]

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

Definition at line 356 of file PRMInterface_tpl.h.

356  {
357  return nodeIdMap__.begin();
358  }
NodeProperty< PRMClassElement< GUM_SCALAR > *> nodeIdMap__
Mapping between node&#39;s id and their name (being an attribute or a slot). Used for fast access to a me...
Definition: PRMInterface.h:331

◆ belongsTo()

template<typename GUM_SCALAR>
INLINE 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 177 of file PRMClassElementContainer_tpl.h.

178  {
179  try {
180  return &elt == &(get(elt.safeName()));
181  } catch (NotFound&) { return false; }
182  }

◆ checkOverloadLegality__()

template<typename 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 279 of file PRMInterface_tpl.h.

281  {
282  if (overloaded->elt_type() != overloader->elt_type()) { return false; }
283 
284  if (overloaded->elt_type() == PRMClassElement< GUM_SCALAR >::prm_attribute) {
285  if (!overloader->type().isSubTypeOf(overloaded->type())) { return false; }
286  } else if (overloaded->elt_type()
288  auto ref_overloader =
289  static_cast< const PRMReferenceSlot< GUM_SCALAR >* >(overloader);
290  auto ref_overloaded =
291  static_cast< const PRMReferenceSlot< GUM_SCALAR >* >(overloaded);
292  if (!ref_overloader->slotType().isSubTypeOf(ref_overloaded->slotType())) {
293  return false;
294  }
295  } else {
296  return false;
297  }
298  return true;
299  }

◆ containerDag()

template<typename GUM_SCALAR >
INLINE 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 186 of file PRMClassElementContainer_tpl.h.

Referenced by gum::prm::ClassDependencyGraph< GUM_SCALAR >::addArcs__(), gum::prm::PRMFactory< GUM_SCALAR >::addAttribute(), gum::prm::PRMClass< double >::inheritClass__(), gum::prm::ClassBayesNet< GUM_SCALAR >::init__(), gum::prm::SVED< GUM_SCALAR >::initLiftedNodes__(), gum::prm::SVE< GUM_SCALAR >::initLiftedNodes__(), operator<<(), and gum::prm::PRMClass< double >::PRMClass().

186  {
187  return dag_();
188  }
virtual const DAG & dag_() const =0
+ Here is the caller graph for this function:

◆ copyIOFlags_()

template<typename 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 37 of file PRMClassElementContainer_tpl.h.

38  {
39  for (const auto& flag: c.IOFlags__)
40  setIOFlag_(get(flag.first), flag.second);
41  }
virtual void setIOFlag_(const PRMClassElement< GUM_SCALAR > &elt, const std::pair< bool, bool > &flags)
Defines the IO flags of a PRMClassElement<GUM_SCALAR>.

◆ dag_() [1/2]

template<typename GUM_SCALAR >
INLINE const DAG & gum::prm::PRMInterface< GUM_SCALAR >::dag_ ( ) const
protectedvirtual

Returns a constant reference over this PRMInterface's DAG.

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

Definition at line 432 of file PRMInterface_tpl.h.

432  {
433  return dag__;
434  }
DAG dag__
The dag representing dependencies between formal attributes and slots.
Definition: PRMInterface.h:327

◆ dag_() [2/2]

template<typename GUM_SCALAR >
INLINE DAG & gum::prm::PRMInterface< GUM_SCALAR >::dag_ ( )
protectedvirtual

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

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

Definition at line 437 of file PRMInterface_tpl.h.

437  {
438  return dag__;
439  }
DAG dag__
The dag representing dependencies between formal attributes and slots.
Definition: PRMInterface.h:327

◆ end() [1/2]

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

Definition at line 350 of file PRMInterface_tpl.h.

Referenced by gum::prm::PRMInterface< double >::end().

350  {
351  return nodeIdMap__.end();
352  }
NodeProperty< PRMClassElement< GUM_SCALAR > *> nodeIdMap__
Mapping between node&#39;s id and their name (being an attribute or a slot). Used for fast access to a me...
Definition: PRMInterface.h:331
+ Here is the caller graph for this function:

◆ end() [2/2]

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

Definition at line 362 of file PRMInterface_tpl.h.

362  {
363  return nodeIdMap__.end();
364  }
NodeProperty< PRMClassElement< GUM_SCALAR > *> nodeIdMap__
Mapping between node&#39;s id and their name (being an attribute or a slot). Used for fast access to a me...
Definition: PRMInterface.h:331

◆ enum2str()

static std::string gum::prm::PRMObject::enum2str ( prm_type  type)
inlinestaticinherited

Returns the string representation of a PRMObject.

Definition at line 83 of file PRMObject.h.

References gum::prm::PRMObject::CLASS, gum::prm::PRMObject::CLASS_ELT, gum::prm::PRMObject::INSTANCE, gum::prm::PRMObject::PRM_INTERFACE, gum::prm::PRMObject::SYSTEM, and gum::prm::PRMObject::TYPE.

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

83  {
84  switch (type) {
85  case prm_type::CLASS: return "PRMType::CLASS";
86 
87  case prm_type::CLASS_ELT: return "PRMType::CLASS_ELT";
88 
89  case prm_type::TYPE: return "PRMType::TYPE";
90 
91  case prm_type::SYSTEM: return "PRMType::SYSTEM";
92 
93  case prm_type::INSTANCE: return "PRMType::INSTANCE";
94 
95  case prm_type::PRM_INTERFACE: return "PRMType::PRM_INTERFACE";
96 
97  default: return "unknown";
98  }
99  }
+ Here is the caller graph for this function:

◆ exists() [1/2]

template<typename GUM_SCALAR >
INLINE bool gum::prm::PRMClassElementContainer< GUM_SCALAR >::exists ( const std::string &  name) const
virtualinherited

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

Definition at line 168 of file PRMClassElementContainer_tpl.h.

Referenced by gum::prm::PRMFactory< GUM_SCALAR >::addNoisyOrCompound(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::checkLocalParent__(), gum::prm::o3prm::O3SystemFactory< GUM_SCALAR >::checkParameters__(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::checkSlotChainLink__(), gum::prm::PRMFactory< GUM_SCALAR >::continueAggregator(), gum::prm::PRMFactory< GUM_SCALAR >::continueAttribute(), gum::prm::PRMClassElementContainer< double >::exists(), and gum::prm::PRMFactory< GUM_SCALAR >::startAttribute().

169  {
170  try {
171  get(name);
172  return true;
173  } catch (NotFound&) { return false; }
174  }
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:35
+ Here is the caller graph for this function:

◆ exists() [2/2]

template<typename GUM_SCALAR >
INLINE 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 163 of file PRMClassElementContainer_tpl.h.

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

◆ findAllSubtypes_()

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

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

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

Definition at line 506 of file PRMInterface_tpl.h.

Referenced by gum::prm::PRMInterface< double >::findAllSubtypes_().

507  {
508  for (const auto impl: implementations__) {
509  set.insert(impl);
510  impl->findAllSubtypes_(set);
511  }
512 
513  for (const auto ext: extensions__) {
514  set.insert(ext);
515  ext->findAllSubtypes_(set);
516  }
517  }
Set< PRMInterface< GUM_SCALAR > *> extensions__
The set of Class<GUM_SCALAR> which implements this PRMInterface.
Definition: PRMInterface.h:370
Set< PRMClass< GUM_SCALAR > *> implementations__
The set of Class<GUM_SCALAR> which implements this PRMInterface.
Definition: PRMInterface.h:362
+ Here is the caller graph for this function:

◆ get() [1/4]

template<typename GUM_SCALAR >
INLINE PRMClassElement< GUM_SCALAR > & gum::prm::PRMInterface< GUM_SCALAR >::get ( NodeId  id)
virtual

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

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

Definition at line 443 of file PRMInterface_tpl.h.

Referenced by gum::prm::PRMClass< double >::checkInterface__(), and gum::prm::PRMClass< double >::checkRefInterface__().

443  {
444  try {
445  return *(nodeIdMap__[id]);
446  } catch (NotFound&) {
447  GUM_ERROR(NotFound, "no ClassElement<GUM_SCALAR> with the given NodeId");
448  }
449  }
NodeProperty< PRMClassElement< GUM_SCALAR > *> nodeIdMap__
Mapping between node&#39;s id and their name (being an attribute or a slot). Used for fast access to a me...
Definition: PRMInterface.h:331
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55
+ Here is the caller graph for this function:

◆ get() [2/4]

template<typename GUM_SCALAR >
INLINE const PRMClassElement< GUM_SCALAR > & gum::prm::PRMInterface< GUM_SCALAR >::get ( NodeId  id) const
virtual

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

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

Definition at line 453 of file PRMInterface_tpl.h.

453  {
454  try {
455  return *(nodeIdMap__[id]);
456  } catch (NotFound&) {
457  GUM_ERROR(NotFound, "no ClassElement<GUM_SCALAR> with the given NodeId");
458  }
459  }
NodeProperty< PRMClassElement< GUM_SCALAR > *> nodeIdMap__
Mapping between node&#39;s id and their name (being an attribute or a slot). Used for fast access to a me...
Definition: PRMInterface.h:331
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55

◆ get() [3/4]

template<typename GUM_SCALAR >
INLINE PRMClassElement< GUM_SCALAR > & gum::prm::PRMInterface< GUM_SCALAR >::get ( const std::string &  name)
virtual

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

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

Definition at line 463 of file PRMInterface_tpl.h.

463  {
464  try {
465  return *(nameMap__[name]);
466  } catch (NotFound&) {
467  GUM_ERROR(NotFound, "no ClassElement<GUM_SCALAR> with the given name");
468  }
469  }
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:35
HashTable< std::string, PRMClassElement< GUM_SCALAR > *> nameMap__
Mapping between a member&#39;s name and itself. Used for fast access to a member given it&#39;s name...
Definition: PRMInterface.h:341
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55

◆ get() [4/4]

template<typename GUM_SCALAR >
INLINE const PRMClassElement< GUM_SCALAR > & gum::prm::PRMInterface< GUM_SCALAR >::get ( const std::string &  name) const
virtual

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

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

Definition at line 473 of file PRMInterface_tpl.h.

473  {
474  try {
475  return *(nameMap__[name]);
476  } catch (NotFound&) {
477  GUM_ERROR(NotFound, "no ClassElement<GUM_SCALAR> with the given name");
478  }
479  }
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:35
HashTable< std::string, PRMClassElement< GUM_SCALAR > *> nameMap__
Mapping between a member&#39;s name and itself. Used for fast access to a member given it&#39;s name...
Definition: PRMInterface.h:341
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55

◆ getIOFlag_() [1/2]

template<typename GUM_SCALAR>
INLINE 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 131 of file PRMClassElementContainer_tpl.h.

132  {
133  try {
134  return IOFlags__[elt.safeName()];
135  } catch (NotFound&) {
136  GUM_ERROR(NotFound,
137  "this ClassElement<GUM_SCALAR> does not have any IO flags");
138  }
139  }
HashTable< std::string, std::pair< bool, bool > > IOFlags__
input / output flags, useful when inheriting or copying.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55

◆ getIOFlag_() [2/2]

template<typename GUM_SCALAR>
INLINE 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 143 of file PRMClassElementContainer_tpl.h.

144  {
145  try {
146  return IOFlags__[elt.safeName()];
147  } catch (NotFound&) {
148  GUM_ERROR(NotFound,
149  "this ClassElement<GUM_SCALAR> does not have any IO flags");
150  }
151  }
HashTable< std::string, std::pair< bool, bool > > IOFlags__
input / output flags, useful when inheriting or copying.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55

◆ implementations() [1/2]

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

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

Definition at line 495 of file PRMInterface_tpl.h.

495  {
496  return implementations__;
497  }
Set< PRMClass< GUM_SCALAR > *> implementations__
The set of Class<GUM_SCALAR> which implements this PRMInterface.
Definition: PRMInterface.h:362

◆ implementations() [2/2]

template<typename GUM_SCALAR >
INLINE 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 501 of file PRMInterface_tpl.h.

501  {
502  return implementations__;
503  }
Set< PRMClass< GUM_SCALAR > *> implementations__
The set of Class<GUM_SCALAR> which implements this PRMInterface.
Definition: PRMInterface.h:362

◆ inheritInterface()

template<typename 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 71 of file PRMInterface_tpl.h.

71  {
73  }
void inheritInterface__(const PRMInterface< GUM_SCALAR > &i)
Proceed with the copy of i in this.
PRMInterface< GUM_SCALAR > * superInterface__
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
Definition: PRMInterface.h:359

◆ inheritInterface__()

template<typename 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 76 of file PRMInterface_tpl.h.

77  {
78  // Copying attributes
79  for (const auto i_attr: i.attributes__) {
80  auto attr =
81  new PRMScalarAttribute< GUM_SCALAR >(i_attr->name(), i_attr->type());
82  attr->setId(i_attr->id());
83  nodeIdMap__.insert(attr->id(), attr);
84  attributes__.insert(attr);
85 
86  if (i.nameMap__[i_attr->name()] == i.nameMap__[i_attr->safeName()]) {
87  nameMap__.insert(attr->name(), attr);
88  }
89 
90  nameMap__.insert(attr->safeName(), attr);
91  dag__.addNodeWithId(attr->id());
92  }
93 
94  // Copying reference slots
95  for (const auto i_ref: i.referenceSlots__) {
96  auto ref = new PRMReferenceSlot< GUM_SCALAR >(
97  i_ref->name(),
98  const_cast< PRMClassElementContainer< GUM_SCALAR >& >(
99  i_ref->slotType()),
100  i_ref->isArray());
101 
102  ref->setId(i_ref->id());
103  nodeIdMap__.insert(ref->id(), ref);
104  referenceSlots__.insert(ref);
105 
106  if (i.nameMap__.exists(ref->name())) {
107  nameMap__.insert(ref->name(), ref);
108  }
109 
110  nameMap__.insert(ref->safeName(), ref);
111  dag__.addNodeWithId(ref->id());
112  }
113  }
virtual void addNodeWithId(const NodeId id)
try to insert a node with the given id
Set< PRMReferenceSlot< GUM_SCALAR > *> referenceSlots__
The sequence of PRMReferenceSlot<GUM_SCALAR>.
Definition: PRMInterface.h:347
Set< PRMAttribute< GUM_SCALAR > *> attributes__
The sequence of PRMAttribute<GUM_SCALAR>s.
Definition: PRMInterface.h:344
HashTable< std::string, PRMClassElement< GUM_SCALAR > *> nameMap__
Mapping between a member&#39;s name and itself. Used for fast access to a member given it&#39;s name...
Definition: PRMInterface.h:341
NodeProperty< PRMClassElement< GUM_SCALAR > *> nodeIdMap__
Mapping between node&#39;s id and their name (being an attribute or a slot). Used for fast access to a me...
Definition: PRMInterface.h:331
DAG dag__
The dag representing dependencies between formal attributes and slots.
Definition: PRMInterface.h:327

◆ isClass()

static INLINE bool gum::prm::PRMObject::isClass ( const PRMObject obj)
inlinestaticinherited

Returns true if obj_ptr is of type Class.

Definition at line 102 of file PRMObject.h.

References gum::prm::PRMObject::CLASS, and gum::prm::PRMObject::obj_type().

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

102  {
103  return obj.obj_type() == prm_type::CLASS;
104  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isInnerNode()

template<typename GUM_SCALAR>
INLINE 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 116 of file PRMClassElementContainer_tpl.h.

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

117  {
118  try {
119  return !(getIOFlag_(elt).first || getIOFlag_(elt).second);
120  } catch (NotFound&) { return true; }
121  }
virtual std::pair< bool, bool > & getIOFlag_(const PRMClassElement< GUM_SCALAR > &elt)
Returns the IO flags of a PRMClassElement<GUM_SCALAR>.
+ Here is the caller graph for this function:

◆ isInputNode()

template<typename GUM_SCALAR>
INLINE 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 72 of file PRMClassElementContainer_tpl.h.

73  {
74  try {
75  return getIOFlag_(elt).first;
76  } catch (NotFound&) { return false; }
77  }
virtual std::pair< bool, bool > & getIOFlag_(const PRMClassElement< GUM_SCALAR > &elt)
Returns the IO flags of a PRMClassElement<GUM_SCALAR>.

◆ isInstance()

static INLINE bool gum::prm::PRMObject::isInstance ( const PRMObject obj)
inlinestaticinherited

Returns true if obj_ptr is of type PRMInstance.

Definition at line 112 of file PRMObject.h.

References gum::prm::PRMObject::INSTANCE, gum::prm::PRMObject::name(), gum::prm::PRMObject::obj_type(), gum::prm::PRMObject::operator!=(), gum::prm::PRMObject::operator=(), gum::prm::PRMObject::operator==(), gum::prm::PRMObject::PRMObject(), and gum::prm::PRMObject::~PRMObject().

112  {
113  return obj.obj_type() == prm_type::INSTANCE;
114  }
+ Here is the call graph for this function:

◆ isInterface()

static INLINE bool gum::prm::PRMObject::isInterface ( const PRMObject obj)
inlinestaticinherited

Returns true if obj_ptr is of type PRMInterface.

Definition at line 107 of file PRMObject.h.

References gum::prm::PRMObject::obj_type(), and gum::prm::PRMObject::PRM_INTERFACE.

107  {
108  return obj.obj_type() == prm_type::PRM_INTERFACE;
109  }
+ Here is the call graph for this function:

◆ isOutputNode()

template<typename GUM_SCALAR>
INLINE bool gum::prm::PRMInterface< GUM_SCALAR >::isOutputNode ( const PRMClassElement< GUM_SCALAR > &  elt) const
virtual

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

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

Definition at line 520 of file PRMInterface_tpl.h.

521  {
522  try {
523  if (!this->getIOFlag_(elt).second) {
524  for (auto i: implementations__) {
525  if (i->isOutputNode(elt)) { return true; }
526  }
527 
528  if (superInterface__ && superInterface__->isOutputNode(elt)) {
529  return true;
530  }
531 
532  } else {
533  return true;
534  }
535  } catch (NotFound&) {}
536  return false;
537  }
virtual std::pair< bool, bool > & getIOFlag_(const PRMClassElement< GUM_SCALAR > &elt)
Returns the IO flags of a PRMClassElement<GUM_SCALAR>.
Set< PRMClass< GUM_SCALAR > *> implementations__
The set of Class<GUM_SCALAR> which implements this PRMInterface.
Definition: PRMInterface.h:362
PRMInterface< GUM_SCALAR > * superInterface__
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
Definition: PRMInterface.h:359

◆ isSubTypeOf()

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

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 302 of file PRMInterface_tpl.h.

303  {
304  switch (cec.obj_type()) {
306  return false;
307  }
308 
310  const PRMInterface* current = this;
311 
312  while (current != 0) {
313  if (current == &(cec)) return true;
314 
315  current = current->superInterface__;
316  }
317 
318  return false;
319  }
320 
321  default: {
322  GUM_ERROR(FatalError, "unknown ClassElementContainer<GUM_SCALAR>");
323  }
324  }
325  }
PRMInterface(const std::string &name)
Default constructor.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55

◆ isSuperTypeOf()

template<typename GUM_SCALAR>
INLINE 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 124 of file PRMClassElementContainer_tpl.h.

125  {
126  return cec.isSubTypeOf(*this);
127  }

◆ LEFT_CAST()

static std::string gum::prm::PRMObject::LEFT_CAST ( )
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.

Referenced by gum::prm::decomposePath(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), and gum::prm::PRMScalarAttribute< GUM_SCALAR >::PRMScalarAttribute().

79 { return "("; }
+ 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 35 of file PRMObject_inl.h.

References gum::prm::PRMObject::name__.

Referenced by gum::prm::__print_attribute__(), gum::prm::__print_instance__(), gum::prm::PRMSystem< double >::add(), gum::prm::PRMInterface< double >::add(), gum::prm::PRMClass< double >::add(), gum::prm::PRMFactory< GUM_SCALAR >::addAggregator(), gum::prm::SVE< GUM_SCALAR >::addDelayedVariable__(), gum::prm::PRMClass< double >::addIOInterfaceFlags__(), gum::prm::PRMFormAttribute< GUM_SCALAR >::addParent(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::addParent(), gum::prm::PRMFactory< GUM_SCALAR >::addParent__(), gum::prm::PRMInstance< GUM_SCALAR >::addReferingInstance__(), gum::prm::PRMClass< double >::checkInterface__(), gum::prm::PRMFactory< GUM_SCALAR >::checkInterfaceImplementation__(), gum::prm::PRMClass< double >::checkInterfaces__(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::checkRawCPT__(), gum::prm::PRMClass< double >::checkRefInterface__(), gum::prm::PRMClass< double >::checkRefInterfaces__(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::checkRuleCPTSumsTo1__(), gum::prm::PRMFormAttribute< GUM_SCALAR >::copy(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::copy(), gum::prm::PRMInstance< GUM_SCALAR >::copyAggregates__(), gum::prm::PRMInstance< GUM_SCALAR >::copyAttribute__(), gum::prm::PRMSlotChain< double >::copyLastElt__(), gum::prm::o3prmr::O3prmrInterpreter::findAttributeName(), gum::prm::o3prmr::O3prmrInterpreter::findInstanceName(), gum::prm::PRMFormAttribute< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMSystem< double >::groundAttr__(), gum::prm::PRMSystem< double >::groundPotential__(), gum::prm::PRMSystem< double >::groundRef__(), gum::prm::PRMClass< double >::inheritAggregates(), gum::prm::PRMClass< double >::inheritClass__(), gum::prm::PRMClass< double >::isCastDescendant(), gum::prm::PRMObject::isInstance(), gum::prm::PRMObject::name(), gum::prm::PRMType::name(), gum::prm::PRMFormAttribute< GUM_SCALAR >::newFactory(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::newFactory(), gum::prm::PRMType::operator!=(), gum::prm::PRMObject::operator!=(), operator<<(), gum::prm::PRMType::operator==(), gum::prm::PRMObject::operator==(), gum::prm::PRMClass< double >::overload(), gum::prm::PRMInterface< double >::overload(), gum::prm::PRMInterface< double >::overloadAttribute__(), gum::prm::PRMClass< double >::overloadAttribute__(), gum::prm::PRMClass< double >::overloadParameter__(), gum::prm::PRMClass< double >::overloadReference__(), gum::prm::PRMInterface< double >::overloadReferenceSlot__(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), gum::prm::PRMReferenceSlot< double >::PRMReferenceSlot(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::PRMScalarAttribute(), gum::prm::PRMFactory< GUM_SCALAR >::startClass(), gum::prm::PRMFactory< GUM_SCALAR >::startInterface(), gum::prm::PRMFactory< GUM_SCALAR >::startSystem(), gum::prm::PRMAggregate< double >::str2enum(), gum::prm::gspan::StrictSearch< GUM_SCALAR >::str__(), and gum::prm::StructuredInference< GUM_SCALAR >::str__().

35 { return name__; }
std::string name__
Definition: PRMObject.h:200

◆ name() [2/2]

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

Change the name of the PRM Object.

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

Definition at line 39 of file PRMObject_inl.h.

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

39 { name__ = name; }
std::string name__
Definition: PRMObject.h:200
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:35
+ Here is the call graph for this function:

◆ obj_type()

template<typename GUM_SCALAR >
INLINE PRMObject::prm_type gum::prm::PRMInterface< GUM_SCALAR >::obj_type ( ) const
virtual

Implementation of pure virtual method of PRMObject.

Implements gum::prm::PRMObject.

Definition at line 427 of file PRMInterface_tpl.h.

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

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

Referenced by gum::prm::PRMObject::isInstance().

49  {
50  return name__ != obj.name();
51  }
std::string name__
Definition: PRMObject.h:200
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator=()

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

Copy operator. Don't use it.

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

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

Referenced by gum::prm::PRMObject::isInstance().

43  {
44  return name__ == obj.name();
45  }
std::string name__
Definition: PRMObject.h:200
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator[]() [1/4]

template<typename GUM_SCALAR >
INLINE PRMClassElement< GUM_SCALAR > & gum::prm::PRMInterface< GUM_SCALAR >::operator[] ( NodeId  id)
virtual

◆ operator[]() [2/4]

template<typename GUM_SCALAR >
INLINE const PRMClassElement< GUM_SCALAR > & gum::prm::PRMInterface< GUM_SCALAR >::operator[] ( NodeId  id) const
virtual

◆ operator[]() [3/4]

template<typename GUM_SCALAR >
INLINE PRMClassElement< GUM_SCALAR > & gum::prm::PRMInterface< GUM_SCALAR >::operator[] ( const std::string &  name)
virtual

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

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

Definition at line 415 of file PRMInterface_tpl.h.

415  {
416  return get(name);
417  }
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:35

◆ operator[]() [4/4]

template<typename GUM_SCALAR >
INLINE const PRMClassElement< GUM_SCALAR > & gum::prm::PRMInterface< GUM_SCALAR >::operator[] ( const std::string &  name) const
virtual

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

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

Definition at line 421 of file PRMInterface_tpl.h.

421  {
422  return get(name);
423  }
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:35

◆ overload()

template<typename GUM_SCALAR>
NodeId gum::prm::PRMInterface< GUM_SCALAR >::overload ( PRMClassElement< GUM_SCALAR > *  elt)
virtual

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 158 of file PRMInterface_tpl.h.

159  {
160  try {
161  if (!super().exists(overloader->name())) {
162  GUM_ERROR(OperationNotAllowed,
163  "found no ClassElement<GUM_SCALAR> to overload");
164  }
165  } catch (NotFound&) {
166  GUM_ERROR(OperationNotAllowed,
167  "overload is possible only with sub interfaces");
168  }
169 
170  PRMClassElement< GUM_SCALAR >* overloaded = nameMap__[overloader->name()];
171  if (overloaded == overloader) {
172  GUM_ERROR(DuplicateElement,
173  "duplicate ClassElement '" << overloader->name() << "'");
174  }
175  if (!checkOverloadLegality__(overloaded, overloader)) {
176  GUM_ERROR(OperationNotAllowed, "illegal overload");
177  }
178 
179  switch (overloader->elt_type()) {
181  auto attr_overloader =
182  static_cast< PRMAttribute< GUM_SCALAR >* >(overloader);
183  auto attr_overloaded =
184  static_cast< PRMAttribute< GUM_SCALAR >* >(overloaded);
185  overloadAttribute__(attr_overloader, attr_overloaded);
186  break;
187  }
188 
190  auto ref_overloader =
191  static_cast< PRMReferenceSlot< GUM_SCALAR >* >(overloader);
192  auto ref_overloaded =
193  static_cast< PRMReferenceSlot< GUM_SCALAR >* >(overloaded);
194  overloadReferenceSlot__(ref_overloader, ref_overloaded);
195  break;
196  }
197 
200  auto msg = "element can ! be overloaded";
201  GUM_ERROR(OperationNotAllowed, msg);
202  break;
203  }
204 
205  default: {
206  GUM_ERROR(FatalError, "unknown ClassElement<GUM_SCALAR> type");
207  }
208  }
209 
210  return overloader->id();
211  }
void overloadAttribute__(PRMAttribute< GUM_SCALAR > *overloader, PRMAttribute< GUM_SCALAR > *overloaded)
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
virtual bool exists(const std::string &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...
bool checkOverloadLegality__(const PRMClassElement< GUM_SCALAR > *overloaded, const PRMClassElement< GUM_SCALAR > *overloader)
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
PRMInterface< GUM_SCALAR > & super()
Returns the superInterface of this PRMInterface.
HashTable< std::string, PRMClassElement< GUM_SCALAR > *> nameMap__
Mapping between a member&#39;s name and itself. Used for fast access to a member given it&#39;s name...
Definition: PRMInterface.h:341
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55

◆ overloadAttribute__()

template<typename 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 214 of file PRMInterface_tpl.h.

216  {
217  if (overloader->type() != overloaded->type()) {
218  overloader->setId(nextNodeId());
219  dag__.addNodeWithId(overloader->id());
220  nodeIdMap__.insert(overloader->id(), overloader);
221  nameMap__[overloader->name()] = overloader;
222  nameMap__.insert(overloader->safeName(), overloader);
223  attributes__.insert(overloader);
224  addCastDescendants__(overloader, overloaded);
225  } else {
226  overloader->setId(overloaded->id());
227  nodeIdMap__[overloader->id()] = overloader;
228  nameMap__[overloader->name()] = overloader;
229  nameMap__[overloader->safeName()] = overloader;
230  attributes__.erase(overloaded);
231  attributes__.insert(overloader);
232  // Swapping types, ugly but necessary to preserve the
233  // PRMType<GUM_SCALAR>
234  // pointer of overloaded
235  overloader->overload(overloaded);
236  delete overloaded;
237  }
238  }
virtual void addNodeWithId(const NodeId id)
try to insert a node with the given id
Set< PRMAttribute< GUM_SCALAR > *> attributes__
The sequence of PRMAttribute<GUM_SCALAR>s.
Definition: PRMInterface.h:344
NodeId nextNodeId()
Returns the next value of an unique counter for PRM&#39;s node id.
Definition: utils_prm.cpp:65
HashTable< std::string, PRMClassElement< GUM_SCALAR > *> nameMap__
Mapping between a member&#39;s name and itself. Used for fast access to a member given it&#39;s name...
Definition: PRMInterface.h:341
NodeProperty< PRMClassElement< GUM_SCALAR > *> nodeIdMap__
Mapping between node&#39;s id and their name (being an attribute or a slot). Used for fast access to a me...
Definition: PRMInterface.h:331
DAG dag__
The dag representing dependencies between formal attributes and slots.
Definition: PRMInterface.h:327
void addCastDescendants__(PRMAttribute< GUM_SCALAR > *start, PRMAttribute< GUM_SCALAR > *end)
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...

◆ overloadReferenceSlot__()

template<typename 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 241 of file PRMInterface_tpl.h.

243  {
244  // Adding overloading reference
245  overloader->setId(overloaded->id());
246  nodeIdMap__[overloader->id()] = overloader;
247  nameMap__[overloader->name()] = overloader;
248  nameMap__.insert(overloader->safeName(), overloader);
249  referenceSlots__.insert(overloader);
250  // Removing overloaded PRMReferenceSlot<GUM_SCALAR>
251  referenceSlots__.erase(overloaded);
252  nameMap__.erase(overloaded->safeName());
253  delete overloaded;
254  }
Set< PRMReferenceSlot< GUM_SCALAR > *> referenceSlots__
The sequence of PRMReferenceSlot<GUM_SCALAR>.
Definition: PRMInterface.h:347
HashTable< std::string, PRMClassElement< GUM_SCALAR > *> nameMap__
Mapping between a member&#39;s name and itself. Used for fast access to a member given it&#39;s name...
Definition: PRMInterface.h:341
NodeProperty< PRMClassElement< GUM_SCALAR > *> nodeIdMap__
Mapping between node&#39;s id and their name (being an attribute or a slot). Used for fast access to a me...
Definition: PRMInterface.h:331

◆ referenceSlots()

template<typename GUM_SCALAR >
INLINE 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 489 of file PRMInterface_tpl.h.

489  {
490  return referenceSlots__;
491  }
Set< PRMReferenceSlot< GUM_SCALAR > *> referenceSlots__
The sequence of PRMReferenceSlot<GUM_SCALAR>.
Definition: PRMInterface.h:347

◆ RIGHT_CAST()

static std::string gum::prm::PRMObject::RIGHT_CAST ( )
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.

Referenced by gum::prm::decomposePath(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), and gum::prm::PRMScalarAttribute< GUM_SCALAR >::PRMScalarAttribute().

80 { return ")"; }
+ Here is the caller graph for this function:

◆ setInputNode()

template<typename GUM_SCALAR>
INLINE 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 80 of file PRMClassElementContainer_tpl.h.

81  {
82  if (!exists(elt.safeName())) {
83  GUM_ERROR(NotFound,
84  ": <" + elt.safeName() + "> is not in <" + name() + ">");
87  try {
88  getIOFlag_(elt).first = b;
89  } catch (NotFound&) { setIOFlag_(elt, std::make_pair(b, false)); }
90  } else {
91  GUM_ERROR(WrongClassElement,
92  "given id is not an PRMAttribute or an PRMAggregate");
93  }
94  }
virtual std::pair< bool, bool > & getIOFlag_(const PRMClassElement< GUM_SCALAR > &elt)
Returns the IO flags of a PRMClassElement<GUM_SCALAR>.
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:35
virtual bool exists(const std::string &name) const
Returns true if a member with the given name exists in this PRMClassElementContainer or in the PRMCla...
static INLINE bool isAttribute(const PRMClassElement< GUM_SCALAR > &elt)
Returns true if obj_ptr is of type PRMAttribute.
virtual void setIOFlag_(const PRMClassElement< GUM_SCALAR > &elt, const std::pair< bool, bool > &flags)
Defines the IO flags of a PRMClassElement<GUM_SCALAR>.
static INLINE bool isAggregate(const PRMClassElement< GUM_SCALAR > &elt)
Return true if obj is of type PRMAggregate.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55

◆ setIOFlag_()

template<typename GUM_SCALAR>
INLINE 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 154 of file PRMClassElementContainer_tpl.h.

156  {
157  try {
158  IOFlags__[elt.safeName()] = flags;
159  } catch (NotFound&) { IOFlags__.insert(elt.safeName(), flags); }
160  }
value_type & insert(const Key &key, const Val &val)
Adds a new element (actually a copy of this element) into the hash table.
HashTable< std::string, std::pair< bool, bool > > IOFlags__
input / output flags, useful when inheriting or copying.

◆ setOutputNode()

template<typename GUM_SCALAR>
INLINE 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 97 of file PRMClassElementContainer_tpl.h.

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

98  {
99  if (!exists(elt.safeName())) {
100  GUM_ERROR(NotFound, "<" + elt.safeName() + "> is not in <" + name() + ">");
103  try {
104  getIOFlag_(elt).second = b;
105  } catch (NotFound&) { setIOFlag_(elt, std::make_pair(false, b)); }
106 
107  if (b) { updateDescendants_(elt); }
108  } else {
109  GUM_ERROR(WrongClassElement,
110  "given ClassElement<GUM_SCALAR> is not an "
111  "PRMAttribute or an PRMAggregate");
112  }
113  }
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...
virtual std::pair< bool, bool > & getIOFlag_(const PRMClassElement< GUM_SCALAR > &elt)
Returns the IO flags of a PRMClassElement<GUM_SCALAR>.
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:35
virtual bool exists(const std::string &name) const
Returns true if a member with the given name exists in this PRMClassElementContainer or in the PRMCla...
static INLINE bool isAttribute(const PRMClassElement< GUM_SCALAR > &elt)
Returns true if obj_ptr is of type PRMAttribute.
virtual void setIOFlag_(const PRMClassElement< GUM_SCALAR > &elt, const std::pair< bool, bool > &flags)
Defines the IO flags of a PRMClassElement<GUM_SCALAR>.
static INLINE bool isAggregate(const PRMClassElement< GUM_SCALAR > &elt)
Return true if obj is of type PRMAggregate.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55
+ Here is the caller graph for this function:

◆ super() [1/2]

template<typename GUM_SCALAR >
INLINE 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 373 of file PRMInterface_tpl.h.

Referenced by gum::prm::PRMClass< double >::addIOInterfaceFlags__().

373  {
374  if (superInterface__)
375  return *superInterface__;
376  else
377  GUM_ERROR(NotFound, "this Interface is ! a sub interface");
378  }
PRMInterface< GUM_SCALAR > * superInterface__
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
Definition: PRMInterface.h:359
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55
+ Here is the caller graph for this function:

◆ super() [2/2]

template<typename GUM_SCALAR >
INLINE 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 382 of file PRMInterface_tpl.h.

382  {
383  if (superInterface__)
384  return *superInterface__;
385  else
386  GUM_ERROR(NotFound, "this Interface is ! a sub interface");
387  }
PRMInterface< GUM_SCALAR > * superInterface__
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
Definition: PRMInterface.h:359
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55

◆ updateDescendants_()

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

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

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

Definition at line 328 of file PRMInterface_tpl.h.

329  {
330  // for ( const auto ext : extensions__ )
331  // if ( !ext->isOutputNode( elt ) ) ext->setOutputNode( elt, true );
332 
333  // for ( const auto impl : implementations__ ) {
334  // // Because of cyclic dependencies we must use a reinterpret cast.
335  // PRMClassElementContainer<GUM_SCALAR>* c =
336  // reinterpret_cast<PRMClassElementContainer<GUM_SCALAR>*>( impl );
337 
338  // if ( ! c->isOutputNode( elt ) ) c->setOutputNode( elt, true );
339  //}
340  }

Friends And Related Function Documentation

◆ PRMClass< GUM_SCALAR >

template<typename GUM_SCALAR>
friend class PRMClass< GUM_SCALAR >
friend

Definition at line 69 of file PRMInterface.h.

Member Data Documentation

◆ attributes__

template<typename GUM_SCALAR>
Set< PRMAttribute< GUM_SCALAR >* > gum::prm::PRMInterface< GUM_SCALAR >::attributes__
private

The sequence of PRMAttribute<GUM_SCALAR>s.

Definition at line 344 of file PRMInterface.h.

Referenced by gum::prm::PRMInterface< double >::inheritInterface__().

◆ dag__

template<typename GUM_SCALAR>
DAG gum::prm::PRMInterface< GUM_SCALAR >::dag__
private

The dag representing dependencies between formal attributes and slots.

Definition at line 327 of file PRMInterface.h.

◆ extensions__

template<typename 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 370 of file PRMInterface.h.

◆ implementations__

template<typename 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 362 of file PRMInterface.h.

◆ nameMap__

template<typename 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 341 of file PRMInterface.h.

Referenced by gum::prm::PRMInterface< double >::inheritInterface__().

◆ nodeIdMap__

template<typename 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 331 of file PRMInterface.h.

◆ referenceSlots__

template<typename GUM_SCALAR>
Set< PRMReferenceSlot< GUM_SCALAR >* > gum::prm::PRMInterface< GUM_SCALAR >::referenceSlots__
private

The sequence of PRMReferenceSlot<GUM_SCALAR>.

Definition at line 347 of file PRMInterface.h.

Referenced by gum::prm::PRMInterface< double >::inheritInterface__().

◆ superInterface__

template<typename 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 359 of file PRMInterface.h.

Referenced by gum::prm::PRMInterface< double >::isSubTypeOf().


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