aGrUM  0.13.2
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 <PRMClassElementContainer.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 &super, bool delayInheritance=false)
 Constructor for building a subclass of super. More...
 
 PRMInterface (const PRMInterface &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...
 
PRMInterfacesuper ()
 Returns the superInterface of this PRMInterface. More...
 
const PRMInterfacesuper () 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 &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 DAG_dag () const
 Returns a constant reference over this PRMInterface's DAG. More...
 
DAG_dag ()
 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 &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__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 * > __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 *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 46 of file PRMClassElementContainer.h.

Member Typedef Documentation

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

Definition at line 272 of file PRMInterface.h.

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

Definition at line 278 of file PRMInterface.h.

Member Enumeration Documentation

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

66  : char {
67  ALL,
68  CLASS,
69  PRM_INTERFACE,
70  CLASS_ELT,
71  TYPE,
72  SYSTEM,
73  INSTANCE
74  };

Constructor & Destructor Documentation

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  }
PRMInterface * __superInterface
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
Definition: PRMInterface.h:345
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:32
PRMInterface(const std::string &name)
Default constructor.
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.

References gum::prm::PRMInterface< GUM_SCALAR >::__inheritInterface().

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

+ Here is the call graph for this function:

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.

References GUM_ERROR.

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 * __superInterface
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
Definition: PRMInterface.h:345
DAG __dag
The dag representing dependencies between formal attributes and slots.
Definition: PRMInterface.h:313
PRMInterface(const std::string &name)
Default constructor.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66
template<typename GUM_SCALAR >
gum::prm::PRMInterface< GUM_SCALAR >::~PRMInterface ( )
virtual

Destructor.

Definition at line 62 of file PRMInterface_tpl.h.

References gum::prm::PRMInterface< GUM_SCALAR >::__nodeIdMap.

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:317

Member Function Documentation

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

References gum::prm::PRMInterface< GUM_SCALAR >::__attributes, gum::prm::PRMInterface< GUM_SCALAR >::__dag, gum::prm::PRMInterface< GUM_SCALAR >::__nameMap, gum::prm::PRMInterface< GUM_SCALAR >::__nodeIdMap, gum::NodeGraphPart::addNodeWithId(), 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(), and gum::prm::PRMAttribute< GUM_SCALAR >::type().

Referenced by gum::prm::PRMInterface< GUM_SCALAR >::__overloadAttribute().

255  {
256  PRMAttribute< GUM_SCALAR >* parent = start;
257  PRMAttribute< GUM_SCALAR >* child = 0;
258 
259  while (parent->type().superType() != end->type()) {
260  child = parent->getCastDescendant();
261  child->setId(nextNodeId());
262  __dag.addNodeWithId(child->id());
263  __nodeIdMap.insert(child->id(), child);
264  // Only use child's safe name when adding to the name map!
265  __nameMap.insert(child->safeName(), child);
266  __attributes.insert(child);
267  // Do ! use Class<GUM_SCALAR>::insertArc(), child's CPF is already
268  // initialized properly
269  parent = child;
270  }
271 
272  parent->setAsCastDescendant(end);
273  }
virtual void addNodeWithId(const NodeId id)
try to insert a node with the given id
DAG __dag
The dag representing dependencies between formal attributes and slots.
Definition: PRMInterface.h:313
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:327
NodeId nextNodeId()
Returns the next value of an unique counter for PRM&#39;s node id.
Definition: utils_prm.cpp:63
Set< PRMAttribute< GUM_SCALAR > * > __attributes
The sequence of PRMAttribute<GUM_SCALAR>s.
Definition: PRMInterface.h:330
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:317

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

References gum::prm::PRMInterface< GUM_SCALAR >::__extensions, and gum::prm::PRMInterface< GUM_SCALAR >::operator[]().

393  {
394  __extensions.insert(i);
395  }
Set< PRMInterface * > __extensions
The set of Class<GUM_SCALAR> which implements this PRMInterface.
Definition: PRMInterface.h:356

+ Here is the call graph for this function:

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

References gum::prm::PRMInterface< GUM_SCALAR >::__implementations.

388  {
389  __implementations.insert(c);
390  }
Set< PRMClass< GUM_SCALAR > * > __implementations
The set of Class<GUM_SCALAR> which implements this PRMInterface.
Definition: PRMInterface.h:348
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 276 of file PRMInterface_tpl.h.

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

Referenced by gum::prm::PRMInterface< GUM_SCALAR >::overload().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

References gum::prm::PRMInterface< GUM_SCALAR >::__attributes, gum::prm::PRMInterface< GUM_SCALAR >::__dag, gum::prm::PRMInterface< GUM_SCALAR >::__nameMap, gum::prm::PRMInterface< GUM_SCALAR >::__nodeIdMap, gum::prm::PRMInterface< GUM_SCALAR >::__referenceSlots, gum::NodeGraphPart::addNodeWithId(), and gum::prm::PRMClassElement< GUM_SCALAR >::setId().

Referenced by gum::prm::PRMInterface< GUM_SCALAR >::inheritInterface(), and gum::prm::PRMInterface< GUM_SCALAR >::PRMInterface().

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 >& >(i_ref->slotType()),
99  i_ref->isArray());
100 
101  ref->setId(i_ref->id());
102  __nodeIdMap.insert(ref->id(), ref);
103  __referenceSlots.insert(ref);
104 
105  if (i.__nameMap.exists(ref->name())) {
106  __nameMap.insert(ref->name(), ref);
107  }
108 
109  __nameMap.insert(ref->safeName(), ref);
110  __dag.addNodeWithId(ref->id());
111  }
112  }
virtual void addNodeWithId(const NodeId id)
try to insert a node with the given id
DAG __dag
The dag representing dependencies between formal attributes and slots.
Definition: PRMInterface.h:313
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:327
Set< PRMAttribute< GUM_SCALAR > * > __attributes
The sequence of PRMAttribute<GUM_SCALAR>s.
Definition: PRMInterface.h:330
Set< PRMReferenceSlot< GUM_SCALAR > * > __referenceSlots
The sequence of PRMReferenceSlot<GUM_SCALAR>.
Definition: PRMInterface.h:333
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:317

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

References gum::prm::PRMInterface< GUM_SCALAR >::__addCastDescendants(), gum::prm::PRMInterface< GUM_SCALAR >::__attributes, gum::prm::PRMInterface< GUM_SCALAR >::__dag, gum::prm::PRMInterface< GUM_SCALAR >::__nameMap, gum::prm::PRMInterface< GUM_SCALAR >::__nodeIdMap, gum::NodeGraphPart::addNodeWithId(), 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 gum::prm::PRMInterface< GUM_SCALAR >::overload().

213  {
214  if (overloader->type() != overloaded->type()) {
215  overloader->setId(nextNodeId());
216  __dag.addNodeWithId(overloader->id());
217  __nodeIdMap.insert(overloader->id(), overloader);
218  __nameMap[overloader->name()] = overloader;
219  __nameMap.insert(overloader->safeName(), overloader);
220  __attributes.insert(overloader);
221  __addCastDescendants(overloader, overloaded);
222  } else {
223  overloader->setId(overloaded->id());
224  __nodeIdMap[overloader->id()] = overloader;
225  __nameMap[overloader->name()] = overloader;
226  __nameMap[overloader->safeName()] = overloader;
227  __attributes.erase(overloaded);
228  __attributes.insert(overloader);
229  // Swapping types, ugly but necessary to preserve the
230  // PRMType<GUM_SCALAR>
231  // pointer of overloaded
232  overloader->overload(overloaded);
233  delete overloaded;
234  }
235  }
virtual void addNodeWithId(const NodeId id)
try to insert a node with the given id
void __addCastDescendants(PRMAttribute< GUM_SCALAR > *start, PRMAttribute< GUM_SCALAR > *end)
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
DAG __dag
The dag representing dependencies between formal attributes and slots.
Definition: PRMInterface.h:313
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:327
NodeId nextNodeId()
Returns the next value of an unique counter for PRM&#39;s node id.
Definition: utils_prm.cpp:63
Set< PRMAttribute< GUM_SCALAR > * > __attributes
The sequence of PRMAttribute<GUM_SCALAR>s.
Definition: PRMInterface.h:330
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:317

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

References gum::prm::PRMInterface< GUM_SCALAR >::__nameMap, gum::prm::PRMInterface< GUM_SCALAR >::__nodeIdMap, gum::prm::PRMInterface< GUM_SCALAR >::__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 gum::prm::PRMInterface< GUM_SCALAR >::overload().

240  {
241  // Adding overloading reference
242  overloader->setId(overloaded->id());
243  __nodeIdMap[overloader->id()] = overloader;
244  __nameMap[overloader->name()] = overloader;
245  __nameMap.insert(overloader->safeName(), overloader);
246  __referenceSlots.insert(overloader);
247  // Removing overloaded PRMReferenceSlot<GUM_SCALAR>
248  __referenceSlots.erase(overloaded);
249  __nameMap.erase(overloaded->safeName());
250  delete overloaded;
251  }
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:327
Set< PRMReferenceSlot< GUM_SCALAR > * > __referenceSlots
The sequence of PRMReferenceSlot<GUM_SCALAR>.
Definition: PRMInterface.h:333
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:317

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 34 of file PRMClassElementContainer_tpl.h.

References gum::prm::PRMClassElementContainer< GUM_SCALAR >::__IOFlags.

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

35  {
36  for (const auto& flag : c.__IOFlags)
37  _setIOFlag(get(flag.first), flag.second);
38  }
virtual void _setIOFlag(const PRMClassElement< GUM_SCALAR > &elt, const std::pair< bool, bool > &flags)
Defines the IO flags of a PRMClassElement<GUM_SCALAR>.

+ Here is the caller graph for this function:

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

References gum::prm::PRMInterface< GUM_SCALAR >::__dag.

428  {
429  return __dag;
430  }
DAG __dag
The dag representing dependencies between formal attributes and slots.
Definition: PRMInterface.h:313
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 433 of file PRMInterface_tpl.h.

References gum::prm::PRMInterface< GUM_SCALAR >::__dag.

433  {
434  return __dag;
435  }
DAG __dag
The dag representing dependencies between formal attributes and slots.
Definition: PRMInterface.h:313
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 502 of file PRMInterface_tpl.h.

References gum::prm::PRMInterface< GUM_SCALAR >::__extensions, and gum::prm::PRMInterface< GUM_SCALAR >::__implementations.

503  {
504  for (const auto impl : __implementations) {
505  set.insert(impl);
506  impl->_findAllSubtypes(set);
507  }
508 
509  for (const auto ext : __extensions) {
510  set.insert(ext);
511  ext->_findAllSubtypes(set);
512  }
513  }
Set< PRMClass< GUM_SCALAR > * > __implementations
The set of Class<GUM_SCALAR> which implements this PRMInterface.
Definition: PRMInterface.h:348
Set< PRMInterface * > __extensions
The set of Class<GUM_SCALAR> which implements this PRMInterface.
Definition: PRMInterface.h:356
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 128 of file PRMClassElementContainer_tpl.h.

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

Referenced by gum::prm::PRMClass< GUM_SCALAR >::__addIOInterfaceFlags(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::isInnerNode(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::isInputNode(), gum::prm::PRMInterface< GUM_SCALAR >::isOutputNode(), gum::prm::PRMClass< GUM_SCALAR >::isOutputNode(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::setInputNode(), and gum::prm::PRMClassElementContainer< GUM_SCALAR >::setOutputNode().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 140 of file PRMClassElementContainer_tpl.h.

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

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

+ Here is the call graph for this function:

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 151 of file PRMClassElementContainer_tpl.h.

References gum::prm::PRMClassElementContainer< GUM_SCALAR >::__IOFlags, gum::HashTable< Key, Val, Alloc >::insert(), and gum::prm::PRMClassElement< GUM_SCALAR >::safeName().

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

326  {
327  // for ( const auto ext : __extensions )
328  // if ( !ext->isOutputNode( elt ) ) ext->setOutputNode( elt, true );
329 
330  // for ( const auto impl : __implementations ) {
331  // // Because of cyclic dependencies we must use a reinterpret cast.
332  // PRMClassElementContainer<GUM_SCALAR>* c =
333  // reinterpret_cast<PRMClassElementContainer<GUM_SCALAR>*>( impl );
334 
335  // if ( ! c->isOutputNode( elt ) ) c->setOutputNode( elt, true );
336  //}
337  }
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 115 of file PRMInterface_tpl.h.

References gum::prm::PRMInterface< GUM_SCALAR >::__attributes, gum::prm::PRMInterface< GUM_SCALAR >::__dag, gum::prm::PRMInterface< GUM_SCALAR >::__nameMap, gum::prm::PRMInterface< GUM_SCALAR >::__nodeIdMap, gum::prm::PRMInterface< GUM_SCALAR >::__referenceSlots, gum::NodeGraphPart::addNodeWithId(), gum::prm::PRMAttribute< GUM_SCALAR >::getCastDescendant(), GUM_ERROR, gum::prm::PRMClassElement< GUM_SCALAR >::id(), 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().

115  {
116  if (__nameMap.exists(elt->name())) {
117  GUM_ERROR(DuplicateElement,
118  "name already used by another ClassElement<GUM_SCALAR>");
119  }
120 
122  PRMAttribute< GUM_SCALAR >* attr =
123  static_cast< PRMAttribute< GUM_SCALAR >* >(elt);
124  __nameMap.insert(attr->name(), attr);
125 
126  while (true) {
127  attr->setId(nextNodeId());
128  __dag.addNodeWithId(attr->id());
129  __nodeIdMap.insert(attr->id(), attr);
130  __nameMap.insert(attr->safeName(), attr);
131  __attributes.insert(attr);
132 
133  if (attr->type().isSubType()) {
134  attr = attr->getCastDescendant();
135  } else {
136  break;
137  }
138  }
140  elt->setId(nextNodeId());
141  __dag.addNodeWithId(elt->id());
142  __nodeIdMap.insert(elt->id(), elt);
143  __referenceSlots.insert(
144  static_cast< PRMReferenceSlot< GUM_SCALAR >* >(elt));
145  __nameMap.insert(elt->name(), elt);
146  __nameMap.insert(elt->safeName(), elt);
147  } else {
148  GUM_ERROR(WrongClassElement,
149  "illegal ClassElement<GUM_SCALAR> for an Interface");
150  }
151 
152  return elt->id();
153  }
virtual void addNodeWithId(const NodeId id)
try to insert a node with the given id
static INLINE bool isReferenceSlot(const PRMClassElement &elt)
Returns true if obj_ptr is of type PRMReferenceSlot.
DAG __dag
The dag representing dependencies between formal attributes and slots.
Definition: PRMInterface.h:313
static INLINE bool isAttribute(const PRMClassElement &elt)
Returns true if obj_ptr is of type PRMAttribute.
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:327
NodeId nextNodeId()
Returns the next value of an unique counter for PRM&#39;s node id.
Definition: utils_prm.cpp:63
Set< PRMAttribute< GUM_SCALAR > * > __attributes
The sequence of PRMAttribute<GUM_SCALAR>s.
Definition: PRMInterface.h:330
Set< PRMReferenceSlot< GUM_SCALAR > * > __referenceSlots
The sequence of PRMReferenceSlot<GUM_SCALAR>.
Definition: PRMInterface.h:333
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:317
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the call graph for this function:

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

References GUM_ERROR.

365  {
366  GUM_ERROR(OperationNotAllowed, "an Interface does ! have arcs");
367  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66
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 479 of file PRMInterface_tpl.h.

References gum::prm::PRMInterface< GUM_SCALAR >::__attributes.

479  {
480  return __attributes;
481  }
Set< PRMAttribute< GUM_SCALAR > * > __attributes
The sequence of PRMAttribute<GUM_SCALAR>s.
Definition: PRMInterface.h:330
template<typename GUM_SCALAR >
INLINE PRMInterface< GUM_SCALAR >::ClassEltIterator gum::prm::PRMInterface< GUM_SCALAR >::begin ( )

Definition at line 341 of file PRMInterface_tpl.h.

References gum::prm::PRMInterface< GUM_SCALAR >::__nodeIdMap.

341  {
342  return __nodeIdMap.begin();
343  }
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:317
template<typename GUM_SCALAR >
INLINE PRMInterface< GUM_SCALAR >::const_ClassEltIterator gum::prm::PRMInterface< GUM_SCALAR >::begin ( ) const

Definition at line 353 of file PRMInterface_tpl.h.

References gum::prm::PRMInterface< GUM_SCALAR >::__nodeIdMap.

353  {
354  return __nodeIdMap.begin();
355  }
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:317
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 174 of file PRMClassElementContainer_tpl.h.

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

175  {
176  try {
177  return &elt == &(get(elt.safeName()));
178  } catch (NotFound&) { return false; }
179  }

+ Here is the call graph for this function:

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 183 of file PRMClassElementContainer_tpl.h.

References gum::prm::PRMClassElementContainer< GUM_SCALAR >::_dag().

Referenced by gum::prm::ClassDependencyGraph< GUM_SCALAR >::__addArcs(), gum::prm::PRMClass< GUM_SCALAR >::__inheritClass(), gum::prm::ClassBayesNet< GUM_SCALAR >::__init(), gum::prm::SVED< GUM_SCALAR >::__initLiftedNodes(), gum::prm::SVE< GUM_SCALAR >::__initLiftedNodes(), gum::prm::PRMClass< GUM_SCALAR >::__overloadReference(), gum::prm::PRMFactory< GUM_SCALAR >::addAttribute(), gum::prm::PRMClass< GUM_SCALAR >::completeInheritance(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::exists(), operator<<(), and gum::prm::PRMClass< GUM_SCALAR >::PRMClass().

183  {
184  return _dag();
185  }
virtual const DAG & _dag() const =0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 347 of file PRMInterface_tpl.h.

References gum::prm::PRMInterface< GUM_SCALAR >::__nodeIdMap.

347  {
348  return __nodeIdMap.end();
349  }
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:317
template<typename GUM_SCALAR >
INLINE const PRMInterface< GUM_SCALAR >::const_ClassEltIterator & gum::prm::PRMInterface< GUM_SCALAR >::end ( ) const

Definition at line 359 of file PRMInterface_tpl.h.

References gum::prm::PRMInterface< GUM_SCALAR >::__nodeIdMap.

359  {
360  return __nodeIdMap.end();
361  }
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:317
static std::string gum::prm::PRMObject::enum2str ( prm_type  type)
inlinestaticinherited

Returns the string representation of a PRMObject.

Definition at line 80 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<<().

80  {
81  switch (type) {
82  case prm_type::CLASS: return "PRMType::CLASS";
83 
84  case prm_type::CLASS_ELT: return "PRMType::CLASS_ELT";
85 
86  case prm_type::TYPE: return "PRMType::TYPE";
87 
88  case prm_type::SYSTEM: return "PRMType::SYSTEM";
89 
90  case prm_type::INSTANCE: return "PRMType::INSTANCE";
91 
92  case prm_type::PRM_INTERFACE: return "PRMType::PRM_INTERFACE";
93 
94  default: return "unknown";
95  }
96  }

+ Here is the caller graph for this function:

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 165 of file PRMClassElementContainer_tpl.h.

References gum::prm::PRMObject::name().

Referenced by gum::prm::PRMClass< GUM_SCALAR >::__checkInterface(), 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 >::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(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::setInputNode(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::setOutputNode(), and gum::prm::PRMFactory< GUM_SCALAR >::startAttribute().

166  {
167  try {
168  get(name);
169  return true;
170  } catch (NotFound&) { return false; }
171  }
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:32

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 160 of file PRMClassElementContainer_tpl.h.

References gum::prm::PRMClassElementContainer< GUM_SCALAR >::containerDag(), and gum::NodeGraphPart::exists().

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

+ Here is the call graph for this function:

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

References gum::prm::PRMInterface< GUM_SCALAR >::__nodeIdMap, and GUM_ERROR.

Referenced by gum::prm::PRMClass< GUM_SCALAR >::__checkInterface(), and gum::prm::PRMClass< GUM_SCALAR >::__checkRefInterface().

439  {
440  try {
441  return *(__nodeIdMap[id]);
442  } catch (NotFound&) {
443  GUM_ERROR(NotFound, "no ClassElement<GUM_SCALAR> with the given NodeId");
444  }
445  }
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:317
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the caller graph for this function:

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

References gum::prm::PRMInterface< GUM_SCALAR >::__nodeIdMap, and GUM_ERROR.

449  {
450  try {
451  return *(__nodeIdMap[id]);
452  } catch (NotFound&) {
453  GUM_ERROR(NotFound, "no ClassElement<GUM_SCALAR> with the given NodeId");
454  }
455  }
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:317
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66
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 459 of file PRMInterface_tpl.h.

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

459  {
460  try {
461  return *(__nameMap[name]);
462  } catch (NotFound&) {
463  GUM_ERROR(NotFound, "no ClassElement<GUM_SCALAR> with the given name");
464  }
465  }
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:32
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:327
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the call graph for this function:

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

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

469  {
470  try {
471  return *(__nameMap[name]);
472  } catch (NotFound&) {
473  GUM_ERROR(NotFound, "no ClassElement<GUM_SCALAR> with the given name");
474  }
475  }
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:32
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:327
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the call graph for this function:

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

References gum::prm::PRMInterface< GUM_SCALAR >::__implementations.

491  {
492  return __implementations;
493  }
Set< PRMClass< GUM_SCALAR > * > __implementations
The set of Class<GUM_SCALAR> which implements this PRMInterface.
Definition: PRMInterface.h:348
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 497 of file PRMInterface_tpl.h.

References gum::prm::PRMInterface< GUM_SCALAR >::__implementations.

497  {
498  return __implementations;
499  }
Set< PRMClass< GUM_SCALAR > * > __implementations
The set of Class<GUM_SCALAR> which implements this PRMInterface.
Definition: PRMInterface.h:348
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.

References gum::prm::PRMInterface< GUM_SCALAR >::__inheritInterface(), and gum::prm::PRMInterface< GUM_SCALAR >::__superInterface.

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

+ Here is the call graph for this function:

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

Returns true if obj_ptr is of type Class.

Definition at line 99 of file PRMObject.h.

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

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

99  {
100  return obj.obj_type() == prm_type::CLASS;
101  }

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 113 of file PRMClassElementContainer_tpl.h.

References gum::prm::PRMClassElementContainer< GUM_SCALAR >::_getIOFlag().

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

114  {
115  try {
116  return !(_getIOFlag(elt).first || _getIOFlag(elt).second);
117  } catch (NotFound&) { return true; }
118  }
virtual std::pair< bool, bool > & _getIOFlag(const PRMClassElement< GUM_SCALAR > &elt)
Returns the IO flags of a PRMClassElement<GUM_SCALAR>.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

References gum::prm::PRMClassElementContainer< GUM_SCALAR >::_getIOFlag().

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

+ Here is the call graph for this function:

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

Returns true if obj_ptr is of type PRMInstance.

Definition at line 109 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().

109  {
110  return obj.obj_type() == prm_type::INSTANCE;
111  }

+ Here is the call graph for this function:

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

Returns true if obj_ptr is of type PRMInterface.

Definition at line 104 of file PRMObject.h.

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

104  {
105  return obj.obj_type() == prm_type::PRM_INTERFACE;
106  }

+ Here is the call graph for this function:

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

References gum::prm::PRMInterface< GUM_SCALAR >::__implementations, gum::prm::PRMInterface< GUM_SCALAR >::__superInterface, gum::prm::PRMClassElementContainer< GUM_SCALAR >::_getIOFlag(), and gum::prm::PRMInterface< GUM_SCALAR >::isOutputNode().

Referenced by gum::prm::PRMInterface< GUM_SCALAR >::isOutputNode().

517  {
518  try {
519  if (!this->_getIOFlag(elt).second) {
520  for (auto i : __implementations) {
521  if (i->isOutputNode(elt)) { return true; }
522  }
523 
525  return true;
526  }
527 
528  } else {
529  return true;
530  }
531  } catch (NotFound&) {}
532  return false;
533  }
Set< PRMClass< GUM_SCALAR > * > __implementations
The set of Class<GUM_SCALAR> which implements this PRMInterface.
Definition: PRMInterface.h:348
PRMInterface * __superInterface
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
Definition: PRMInterface.h:345
virtual std::pair< bool, bool > & _getIOFlag(const PRMClassElement< GUM_SCALAR > &elt)
Returns the IO flags of a PRMClassElement<GUM_SCALAR>.
virtual bool isOutputNode(const PRMClassElement< GUM_SCALAR > &elt) const
See gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(const std::string&).

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

References gum::prm::PRMInterface< GUM_SCALAR >::__superInterface, GUM_ERROR, and gum::prm::PRMObject::obj_type().

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

+ Here is the call graph for this function:

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 121 of file PRMClassElementContainer_tpl.h.

References gum::prm::PRMClassElementContainer< GUM_SCALAR >::isSubTypeOf().

122  {
123  return cec.isSubTypeOf(*this);
124  }

+ Here is the call graph for this function:

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

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

76 { return "("; }

+ Here is the caller graph for this function:

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

Returns the name of this object.

Definition at line 32 of file PRMObject_inl.h.

References gum::prm::PRMObject::__name.

Referenced by 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 >::__groundAttr(), gum::prm::PRMSystem< GUM_SCALAR >::__groundPotential(), gum::prm::PRMSystem< GUM_SCALAR >::__groundRef(), gum::prm::PRMClass< GUM_SCALAR >::__inheritClass(), gum::prm::PRMInterface< GUM_SCALAR >::__overloadAttribute(), gum::prm::PRMClass< GUM_SCALAR >::__overloadAttribute(), gum::prm::PRMClass< GUM_SCALAR >::__overloadParameter(), gum::prm::PRMClass< GUM_SCALAR >::__overloadReference(), gum::prm::PRMInterface< GUM_SCALAR >::__overloadReferenceSlot(), gum::prm::__print_attribute__(), gum::prm::__print_instance__(), gum::prm::gspan::StrictSearch< GUM_SCALAR >::__str(), gum::prm::StructuredInference< GUM_SCALAR >::__str(), gum::prm::PRMInterface< GUM_SCALAR >::add(), gum::prm::PRMSystem< GUM_SCALAR >::add(), gum::prm::PRMClass< 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::o3prmr::O3prmrInterpreter::findAttributeName(), gum::prm::o3prmr::O3prmrInterpreter::findInstanceName(), gum::prm::PRMInterface< GUM_SCALAR >::get(), gum::prm::PRMSystem< GUM_SCALAR >::get(), gum::prm::PRMClass< GUM_SCALAR >::get(), gum::prm::PRMSystem< GUM_SCALAR >::getArray(), gum::prm::PRMSystem< GUM_SCALAR >::getArrayType(), gum::prm::PRMFormAttribute< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMAggregate< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMSystem< GUM_SCALAR >::groundedBN(), gum::prm::PRMClass< GUM_SCALAR >::inheritAggregates(), gum::prm::PRMClass< GUM_SCALAR >::isCastDescendant(), gum::prm::PRMObject::isInstance(), gum::prm::PRMObject::name(), gum::prm::PRMType< GUM_SCALAR >::name(), gum::prm::PRMFormAttribute< GUM_SCALAR >::newFactory(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::newFactory(), gum::prm::PRMType< GUM_SCALAR >::operator!=(), gum::prm::PRMObject::operator!=(), operator<<(), gum::prm::PRMType< GUM_SCALAR >::operator==(), gum::prm::PRMObject::operator==(), gum::prm::PRMInterface< GUM_SCALAR >::operator[](), gum::prm::PRMClass< GUM_SCALAR >::operator[](), gum::prm::PRMInterface< GUM_SCALAR >::overload(), gum::prm::PRMClass< GUM_SCALAR >::overload(), gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), 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::PRMClassElementContainer< GUM_SCALAR >::setInputNode(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::setOutputNode(), and gum::prm::PRMAggregate< double >::str2enum().

32 { return __name; }
std::string __name
Definition: PRMObject.h:197
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 wath you are doing !

Definition at line 36 of file PRMObject_inl.h.

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

36 { __name = name; }
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:32
std::string __name
Definition: PRMObject.h:197

+ Here is the call graph for this function:

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

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

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

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

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

46  {
47  return __name != obj.name();
48  }
std::string __name
Definition: PRMObject.h:197

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Copy operator. Don't use it.

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

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

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

40  {
41  return __name == obj.name();
42  }
std::string __name
Definition: PRMObject.h:197

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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

Definition at line 399 of file PRMInterface_tpl.h.

Referenced by gum::prm::PRMInterface< GUM_SCALAR >::__addExtension(), and gum::prm::PRMInterface< GUM_SCALAR >::operator[]().

399  {
400  return get(id);
401  }

+ Here is the caller graph for this function:

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

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

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

Definition at line 405 of file PRMInterface_tpl.h.

References gum::prm::PRMInterface< GUM_SCALAR >::operator[]().

405  {
406  return get(id);
407  }

+ Here is the call graph for this function:

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

References gum::prm::PRMObject::name(), and gum::prm::PRMInterface< GUM_SCALAR >::operator[]().

411  {
412  return get(name);
413  }
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:32

+ Here is the call graph for this function:

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

References gum::prm::PRMObject::name().

417  {
418  return get(name);
419  }
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:32

+ Here is the call graph for this function:

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

References gum::prm::PRMInterface< GUM_SCALAR >::__checkOverloadLegality(), gum::prm::PRMInterface< GUM_SCALAR >::__nameMap, gum::prm::PRMInterface< GUM_SCALAR >::__overloadAttribute(), gum::prm::PRMInterface< GUM_SCALAR >::__overloadReferenceSlot(), 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(), and gum::prm::PRMInterface< GUM_SCALAR >::super().

157  {
158  try {
159  if (!super().exists(overloader->name())) {
160  GUM_ERROR(OperationNotAllowed,
161  "found no ClassElement<GUM_SCALAR> to overload");
162  }
163  } catch (NotFound&) {
164  GUM_ERROR(OperationNotAllowed,
165  "overload is possible only with sub interfaces");
166  }
167 
168  PRMClassElement< GUM_SCALAR >* overloaded = __nameMap[overloader->name()];
169  if (overloaded == overloader) {
170  GUM_ERROR(DuplicateElement, "dupplicate ClassElement");
171  }
172  if (!__checkOverloadLegality(overloaded, overloader)) {
173  GUM_ERROR(OperationNotAllowed, "illegal overload");
174  }
175 
176  switch (overloader->elt_type()) {
178  auto attr_overloader =
179  static_cast< PRMAttribute< GUM_SCALAR >* >(overloader);
180  auto attr_overloaded =
181  static_cast< PRMAttribute< GUM_SCALAR >* >(overloaded);
182  __overloadAttribute(attr_overloader, attr_overloaded);
183  break;
184  }
185 
187  auto ref_overloader =
188  static_cast< PRMReferenceSlot< GUM_SCALAR >* >(overloader);
189  auto ref_overloaded =
190  static_cast< PRMReferenceSlot< GUM_SCALAR >* >(overloaded);
191  __overloadReferenceSlot(ref_overloader, ref_overloaded);
192  break;
193  }
194 
197  auto msg = "element can ! be overloaded";
198  GUM_ERROR(OperationNotAllowed, msg);
199  break;
200  }
201 
202  default: {
203  GUM_ERROR(FatalError, "unknown ClassElement<GUM_SCALAR> type");
204  }
205  }
206 
207  return overloader->id();
208  }
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...
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:327
void __overloadAttribute(PRMAttribute< GUM_SCALAR > *overloader, PRMAttribute< GUM_SCALAR > *overloaded)
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
void __overloadReferenceSlot(PRMReferenceSlot< GUM_SCALAR > *overloader, PRMReferenceSlot< GUM_SCALAR > *overloaded)
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
PRMInterface & super()
Returns the superInterface of 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...
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the call graph for this function:

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

References gum::prm::PRMInterface< GUM_SCALAR >::__referenceSlots.

485  {
486  return __referenceSlots;
487  }
Set< PRMReferenceSlot< GUM_SCALAR > * > __referenceSlots
The sequence of PRMReferenceSlot<GUM_SCALAR>.
Definition: PRMInterface.h:333
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 77 of file PRMObject.h.

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

77 { return ")"; }

+ Here is the caller graph for this function:

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 77 of file PRMClassElementContainer_tpl.h.

References gum::prm::PRMClassElementContainer< GUM_SCALAR >::_getIOFlag(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::_setIOFlag(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::exists(), GUM_ERROR, gum::prm::PRMClassElement< GUM_SCALAR >::isAggregate(), gum::prm::PRMObject::name(), and gum::prm::PRMClassElement< GUM_SCALAR >::safeName().

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

78  {
79  if (!exists(elt.safeName())) {
80  GUM_ERROR(NotFound,
81  ": <" + elt.safeName() + "> is not in <" + name() + ">");
84  try {
85  _getIOFlag(elt).first = b;
86  } catch (NotFound&) { _setIOFlag(elt, std::make_pair(b, false)); }
87  } else {
88  GUM_ERROR(WrongClassElement,
89  "given id is not an PRMAttribute or an PRMAggregate");
90  }
91  }
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...
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:32
static INLINE bool isAttribute(const PRMClassElement &elt)
Returns true if obj_ptr is of type PRMAttribute.
virtual std::pair< bool, bool > & _getIOFlag(const PRMClassElement< GUM_SCALAR > &elt)
Returns the IO flags of a PRMClassElement<GUM_SCALAR>.
static INLINE bool isAggregate(const PRMClassElement &elt)
Return true if obj is of type PRMAggregate.
virtual void _setIOFlag(const PRMClassElement< GUM_SCALAR > &elt, const std::pair< bool, bool > &flags)
Defines the IO flags of a PRMClassElement<GUM_SCALAR>.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 94 of file PRMClassElementContainer_tpl.h.

References gum::prm::PRMClassElementContainer< GUM_SCALAR >::_getIOFlag(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::_setIOFlag(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::_updateDescendants(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::exists(), GUM_ERROR, gum::prm::PRMClassElement< GUM_SCALAR >::isAggregate(), gum::prm::PRMObject::name(), and gum::prm::PRMClassElement< GUM_SCALAR >::safeName().

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

95  {
96  if (!exists(elt.safeName())) {
97  GUM_ERROR(NotFound, "<" + elt.safeName() + "> is not in <" + name() + ">");
100  try {
101  _getIOFlag(elt).second = b;
102  } catch (NotFound&) { _setIOFlag(elt, std::make_pair(false, b)); }
103 
104  if (b) { _updateDescendants(elt); }
105  } else {
106  GUM_ERROR(WrongClassElement,
107  "given ClassElement<GUM_SCALAR> is not an "
108  "PRMAttribute or an PRMAggregate");
109  }
110  }
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...
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:32
static INLINE bool isAttribute(const PRMClassElement &elt)
Returns true if obj_ptr is of type PRMAttribute.
virtual std::pair< bool, bool > & _getIOFlag(const PRMClassElement< GUM_SCALAR > &elt)
Returns the IO flags of a PRMClassElement<GUM_SCALAR>.
static INLINE bool isAggregate(const PRMClassElement &elt)
Return true if obj is of type PRMAggregate.
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 _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...
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

References gum::prm::PRMInterface< GUM_SCALAR >::__superInterface, and GUM_ERROR.

Referenced by gum::prm::PRMClass< GUM_SCALAR >::__addIOInterfaceFlags(), and gum::prm::PRMInterface< GUM_SCALAR >::overload().

370  {
371  if (__superInterface)
372  return *__superInterface;
373  else
374  GUM_ERROR(NotFound, "this Interface is ! a sub interface");
375  }
PRMInterface * __superInterface
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
Definition: PRMInterface.h:345
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the caller graph for this function:

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

References gum::prm::PRMInterface< GUM_SCALAR >::__superInterface, and GUM_ERROR.

379  {
380  if (__superInterface)
381  return *__superInterface;
382  else
383  GUM_ERROR(NotFound, "this Interface is ! a sub interface");
384  }
PRMInterface * __superInterface
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
Definition: PRMInterface.h:345
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

Friends And Related Function Documentation

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

Definition at line 56 of file PRMInterface.h.

Member Data Documentation

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

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

Definition at line 356 of file PRMInterface.h.

Referenced by gum::prm::PRMInterface< GUM_SCALAR >::__addExtension(), and gum::prm::PRMInterface< GUM_SCALAR >::_findAllSubtypes().

template<typename GUM_SCALAR>
Set< PRMClass< GUM_SCALAR >* > gum::prm::PRMInterface< GUM_SCALAR >::__implementations
private
template<typename GUM_SCALAR>
Set< PRMReferenceSlot< GUM_SCALAR >* > gum::prm::PRMInterface< GUM_SCALAR >::__referenceSlots
private
template<typename GUM_SCALAR>
PRMInterface* 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 345 of file PRMInterface.h.

Referenced by gum::prm::PRMInterface< GUM_SCALAR >::inheritInterface(), gum::prm::PRMInterface< GUM_SCALAR >::isOutputNode(), gum::prm::PRMInterface< GUM_SCALAR >::isSubTypeOf(), and gum::prm::PRMInterface< GUM_SCALAR >::super().


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