aGrUM  0.13.2
gum::prm::PRMClassElementContainer< GUM_SCALAR > Class Template Referenceabstract

<agrum/PRM/classElementContainer.h> More...

#include <PRMClassElementContainer.h>

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

Public Member Functions

Protected constructors & destructor.
 PRMClassElementContainer (const std::string &name)
 Default constructor. More...
 
virtual ~PRMClassElementContainer ()
 Destructor. More...
 
Getters on the gum::PRMClassElement<GUM_SCALAR>.
virtual bool belongsTo (const PRMClassElement< GUM_SCALAR > &elt) const
 Returns true if elt belongs to this PRMClassElementContainer. More...
 
virtual bool exists (const std::string &name) const
 Returns true if a member with the given name exists in this PRMClassElementContainer or in the PRMClassElementContainer hierarchy. More...
 
virtual PRMClassElement< GUM_SCALAR > & get (const std::string &name)=0
 Getter on a member of this PRMClassElementContainer. More...
 
virtual const PRMClassElement< GUM_SCALAR > & get (const std::string &name) const =0
 Constant getter on a member of this PRMClassElementContainer. More...
 
virtual NodeId add (PRMClassElement< GUM_SCALAR > *elt)=0
 Add a PRMClassElement<GUM_SCALAR> to this PRMClassElementContainer. More...
 
virtual NodeId overload (PRMClassElement< GUM_SCALAR > *elt)=0
 Add a PRMClassElement<GUM_SCALAR> which overload an inherited PRMClassElement<GUM_SCALAR>. More...
 
virtual void addArc (const std::string &tail, const std::string &head)=0
 Add an arc between two PRMClassElement<GUM_SCALAR>. More...
 
virtual bool isInputNode (const PRMClassElement< GUM_SCALAR > &elt) const
 Returns true if the node is an input node. More...
 
virtual void setInputNode (const PRMClassElement< GUM_SCALAR > &elt, bool b)
 Set the input flag value of id at b. More...
 
virtual bool isOutputNode (const PRMClassElement< GUM_SCALAR > &elt) const =0
 Returns true if the node is an output node. More...
 
virtual void setOutputNode (const PRMClassElement< GUM_SCALAR > &elt, bool b)
 Set the output flag value of id at b. More...
 
virtual bool isInnerNode (const PRMClassElement< GUM_SCALAR > &elt) const
 Returns true if the node is an inner node. More...
 
Graphical operator
virtual const DAGcontainerDag () const
 Returns the gum::DAG of this PRMClassElementContainer. More...
 
virtual bool exists (NodeId id) const
 Returns true if a member with the given id exists in this PRMClassElementContainer or in the PRMClassElementContainer hierarchy. More...
 
virtual PRMClassElement< GUM_SCALAR > & get (NodeId id)=0
 Getter on a member of this PRMClassElementContainer. More...
 
virtual const PRMClassElement< GUM_SCALAR > & get (NodeId id) const =0
 Constant getter on a member of this PRMClassElementContainer. More...
 
Getters & setters operators
virtual PRMClassElement< GUM_SCALAR > & operator[] (NodeId id)=0
 Getter on a member of this PRMClassElementContainer. More...
 
virtual const PRMClassElement< GUM_SCALAR > & operator[] (NodeId id) const =0
 Constant getter on a member of this PRMClassElementContainer. More...
 
virtual PRMClassElement< GUM_SCALAR > & operator[] (const std::string &name)=0
 Getter on a member of this PRMClassElementContainer. More...
 
virtual const PRMClassElement< GUM_SCALAR > & operator[] (const std::string &name) const =0
 Constant getter on a member of this PRMClassElementContainer. More...
 
Inheritance getters and setters
virtual bool isSubTypeOf (const PRMClassElementContainer &cec) const =0
 Test if this PRMClassElementContainer is a subtype of cec. More...
 
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...
 
virtual prm_type obj_type () const =0
 Returns the type of this object. More...
 
Operators
bool operator== (const PRMObject &obj) const
 To PRMObject are equal if they have the same name (which is unique). More...
 
bool operator!= (const PRMObject &obj) const
 To PRMObject are equal if they have the same name (which is unique). More...
 

Protected Member Functions

PRMClassElementContaineroperator= (const PRMClassElementContainer &source)
 Copy operator. Don't use it. More...
 
 PRMClassElementContainer (const PRMClassElementContainer &source)
 Copy constructor. Don't use it. More...
 
virtual const DAG_dag () const =0
 
virtual DAG_dag ()=0
 Returns a non constant reference over this PRMClassElementContainer's DAG. More...
 
virtual void _findAllSubtypes (Set< PRMClassElementContainer * > &set)=0
 Fills set with all the subtypes of this PRMInterface, this includes extensions and implementations. More...
 
virtual std::pair< bool, bool > & _getIOFlag (const PRMClassElement< GUM_SCALAR > &elt)
 Returns the IO flags of a PRMClassElement<GUM_SCALAR>. More...
 
virtual const std::pair< bool, bool > & _getIOFlag (const PRMClassElement< GUM_SCALAR > &elt) const
 Returns the IO flags of a PRMClassElement<GUM_SCALAR>. More...
 
virtual void _setIOFlag (const PRMClassElement< GUM_SCALAR > &elt, const std::pair< bool, bool > &flags)
 Defines the IO flags of a PRMClassElement<GUM_SCALAR>. More...
 
virtual void _copyIOFlags (const PRMClassElementContainer &c)
 Copy the IO Flags of c in this PRMClassElementContainer. More...
 
virtual void _updateDescendants (const PRMClassElement< GUM_SCALAR > &elt)=0
 When a PRMClassElement<GUM_SCALAR> becomes an Output node we must update any the IO flags of every descendant of this PRMClassElementContainer. Note that after its declaration, input flags can not be changed and output flags can only become true. More...
 

Friends

class PRMClassElementContainterIterator
 
class PRMClassElementContainterConstIterator
 

Built-in types.

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

Detailed Description

template<typename GUM_SCALAR>
class gum::prm::PRMClassElementContainer< GUM_SCALAR >

<agrum/PRM/classElementContainer.h>

Abstract class for classes containing gum::PRMClassElement<GUM_SCALAR>.

To print a PRMClassElementContainer you can use the following operator: gum::operator<<(std::ostream&, const PRMClassElementContainer&) which print the PRMClassElementContainer in the graphviz-dot format.

Definition at line 64 of file PRMClassElementContainer.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 >
INLINE gum::prm::PRMClassElementContainer< GUM_SCALAR >::PRMClassElementContainer ( const std::string &  name)

Default constructor.

Definition at line 41 of file PRMClassElementContainer_tpl.h.

42  :
43  PRMObject(name) {
44  GUM_CONSTRUCTOR(PRMClassElementContainer);
45  }
PRMClassElementContainer(const std::string &name)
Default constructor.
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:32
PRMObject(const std::string &name)
Constructor.
Definition: PRMObject.cpp:40
template<typename GUM_SCALAR >
INLINE gum::prm::PRMClassElementContainer< GUM_SCALAR >::~PRMClassElementContainer ( )
virtual

Destructor.

Definition at line 48 of file PRMClassElementContainer_tpl.h.

References gum::prm::PRMClassElementContainer< GUM_SCALAR >::operator=().

48  {
49  GUM_DESTRUCTOR(PRMClassElementContainer);
50  }
PRMClassElementContainer(const std::string &name)
Default constructor.

+ Here is the call graph for this function:

template<typename GUM_SCALAR >
INLINE gum::prm::PRMClassElementContainer< GUM_SCALAR >::PRMClassElementContainer ( const PRMClassElementContainer< GUM_SCALAR > &  source)
protected

Copy constructor. Don't use it.

Definition at line 60 of file PRMClassElementContainer_tpl.h.

References GUM_ERROR.

61  :
62  PRMObject(source) {
63  GUM_CONS_CPY(PRMClassElementContainer);
64  GUM_ERROR(FatalError,
65  "illegal call to ClassElementContainer copy constructor");
66  }
PRMClassElementContainer(const std::string &name)
Default constructor.
PRMObject(const std::string &name)
Constructor.
Definition: PRMObject.cpp:40
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

Member Function Documentation

template<typename GUM_SCALAR >
void gum::prm::PRMClassElementContainer< GUM_SCALAR >::_copyIOFlags ( const PRMClassElementContainer< GUM_SCALAR > &  c)
protectedvirtual

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>
virtual const DAG& gum::prm::PRMClassElementContainer< GUM_SCALAR >::_dag ( ) const
protectedpure virtual

Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.

Referenced by gum::prm::PRMClassElementContainer< GUM_SCALAR >::containerDag().

+ Here is the caller graph for this function:

template<typename GUM_SCALAR>
virtual DAG& gum::prm::PRMClassElementContainer< GUM_SCALAR >::_dag ( )
protectedpure virtual
template<typename GUM_SCALAR>
virtual void gum::prm::PRMClassElementContainer< GUM_SCALAR >::_findAllSubtypes ( Set< PRMClassElementContainer< GUM_SCALAR > * > &  set)
protectedpure virtual

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

Implemented in gum::prm::PRMClass< GUM_SCALAR >, and gum::prm::PRMInterface< GUM_SCALAR >.

template<typename GUM_SCALAR>
INLINE std::pair< bool, bool > & gum::prm::PRMClassElementContainer< GUM_SCALAR >::_getIOFlag ( const PRMClassElement< GUM_SCALAR > &  elt)
protectedvirtual

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
protectedvirtual

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 
)
protectedvirtual

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>
virtual void gum::prm::PRMClassElementContainer< GUM_SCALAR >::_updateDescendants ( const PRMClassElement< GUM_SCALAR > &  elt)
protectedpure virtual

When a PRMClassElement<GUM_SCALAR> becomes an Output node we must update any the IO flags of every descendant of this PRMClassElementContainer. Note that after its declaration, input flags can not be changed and output flags can only become true.

Parameters
eltA PRMClassElement<GUM_SCALAR>.

Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.

Referenced by gum::prm::PRMClassElementContainer< GUM_SCALAR >::setOutputNode().

+ Here is the caller graph for this function:

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

Add a PRMClassElement<GUM_SCALAR> to this PRMClassElementContainer.

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

The NodeId of elt is defined when it is added to this, discarding any previous value.

If you want to overload an inherited PRMClassElement<GUM_SCALAR> call Class::overload().

When adding an PRMAttribute or an PRMAggregate its type safe name is automatically added, the syntax is <type>name. So you can either use its type safe name or its real name. See the ref prm_typ_inh "type inheritance section" for further details.

Parameters
eltThe PRMClassElement<GUM_SCALAR> added to this Class.
Returns
Returns the NodeId assigned to elt.
Exceptions
DuplicateElementRaised if elt's name is already used in this class.

Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.

Referenced by gum::prm::PRMFactory< GUM_SCALAR >::__addParent(), gum::prm::PRMFactory< GUM_SCALAR >::addReferenceSlot(), and gum::prm::PRMFactory< GUM_SCALAR >::startAttribute().

+ Here is the caller graph for this function:

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

Add an arc between two PRMClassElement<GUM_SCALAR>.

Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.

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

+ Here is the caller graph for this function:

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

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
virtual

Returns the gum::DAG of this PRMClassElementContainer.

Be very careful when using NodeId with PRMClassElement<GUM_SCALAR>: there is no guarantee that an inherited PRMClassElement<GUM_SCALAR> will have the same NodeId than its superclass counterpart.

When dealing with different classes and interfaces ALWAYS use safe-name as identifier.

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:

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
virtual

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::PRMInterface< GUM_SCALAR >::overload(), gum::prm::PRMClass< 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
virtual

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>
virtual PRMClassElement< GUM_SCALAR >& gum::prm::PRMClassElementContainer< GUM_SCALAR >::get ( const std::string &  name)
pure virtual

Getter on a member of this PRMClassElementContainer.

Parameters
nameThe member's name.
Returns
Returns a constant reference on the member.
Exceptions
NotFoundRaised if no attribute matches name.

Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.

Referenced by gum::prm::ClassDependencyGraph< GUM_SCALAR >::__addArcs(), gum::prm::PRMFactory< GUM_SCALAR >::__addParent(), gum::prm::PRMFactory< GUM_SCALAR >::__buildSlotChain(), gum::prm::PRMFactory< GUM_SCALAR >::continueAggregator(), gum::prm::PRMFactory< GUM_SCALAR >::continueAttribute(), and operator<<().

+ Here is the caller graph for this function:

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

Constant getter on a member of this PRMClassElementContainer.

Parameters
nameThe member's name.
Returns
Returns a constant reference on the member.
Exceptions
NotFoundRaised if no attribute matches name.

Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.

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

Getter on a member of this PRMClassElementContainer.

Parameters
idThe member's id.
Returns
Returns a constant reference on the member.
Exceptions
NotFoundRaised if no attribute matches name.

Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.

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

Constant getter on a member of this PRMClassElementContainer.

Parameters
idThe member's id.
Returns
Returns a constant reference on the member.
Exceptions
NotFoundRaised if no attribute matches name.

Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.

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
virtual

Returns true if the node is an inner node.

PRMAttribute or PRMAggregate can either be input, output, both or internal nodes.

By defaut, attributes and aggregates are inner nodes.

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
virtual

Returns true if the node is an input node.

PRMAttribute or PRMAggregate can either be input, output, both or internal nodes.

By defaut, attributes and aggregates are inner nodes.

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>
virtual bool gum::prm::PRMClassElementContainer< GUM_SCALAR >::isOutputNode ( const PRMClassElement< GUM_SCALAR > &  elt) const
pure virtual

Returns true if the node is an output node.

PRMAttribute or PRMAggregate can either be input, output, both or internal nodes.

By defaut, attributes and aggregates are inner nodes.

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

Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.

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

Test if this PRMClassElementContainer is a subtype of cec.

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

Implemented in gum::prm::PRMClass< GUM_SCALAR >, and gum::prm::PRMInterface< GUM_SCALAR >.

Referenced by gum::prm::PRMClassElementContainer< GUM_SCALAR >::isSuperTypeOf().

+ Here is the caller graph for this function:

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

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:

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 >
INLINE PRMClassElementContainer< GUM_SCALAR > & gum::prm::PRMClassElementContainer< GUM_SCALAR >::operator= ( const PRMClassElementContainer< GUM_SCALAR > &  source)
protected

Copy operator. Don't use it.

Definition at line 55 of file PRMClassElementContainer_tpl.h.

References GUM_ERROR.

Referenced by gum::prm::PRMClassElementContainer< GUM_SCALAR >::~PRMClassElementContainer().

55  {
56  GUM_ERROR(FatalError, "illegal call to ClassElementContainer copy operator");
57  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the caller graph for this function:

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>
virtual PRMClassElement< GUM_SCALAR >& gum::prm::PRMClassElementContainer< GUM_SCALAR >::operator[] ( NodeId  id)
pure virtual

Getter on a member of this PRMClassElementContainer.

Parameters
idThe member's id.
Returns
Returns a constant reference on the member.
Exceptions
NotFoundRaised if no attribute matches name.

Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.

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

Constant getter on a member of this PRMClassElementContainer.

Parameters
idThe member's id.
Returns
Returns a constant reference on the member.
Exceptions
NotFoundRaised if no attribute matches name.

Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.

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

Getter on a member of this PRMClassElementContainer.

Parameters
nameThe member's name.
Returns
Returns a constant reference on the member.
Exceptions
NotFoundRaised if no attribute matches name.

Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.

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

Constant getter on a member of this PRMClassElementContainer.

Parameters
nameThe member's name.
Returns
Returns a constant reference on the member.
Exceptions
NotFoundRaised if no attribute matches name.

Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMClass< double >, gum::prm::PRMInterface< GUM_SCALAR >, and gum::prm::PRMInterface< double >.

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

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

The pointer is "given" to this class, which will delete it when ~PRMClassElementContainer() is called.

The NodeId of elt is defined when it is added to this, discarding any previous value. There is no guaranty that elt will have the same NodeId than the PRMClassElement<GUM_SCALAR> it overloaded.

You can only overload inherited PRMClassElement<GUM_SCALAR> and only if elt is a subtype of the inherited PRMClassElement<GUM_SCALAR>. Thus you can only overload PRMReferenceSlot and PRMAttribute. In the case of PRMAttribute you can overload an inherited PRMAttribute even if they are of the same type: this is useful when you want to redefine the dependencies of an PRMAttribute or its CPF. You can also overload an PRMAttribute with an PRMAggregate, as long as their respective PRMType allow it.

Parameters
eltThe PRMClassElement<GUM_SCALAR> overloading an inherited PRMClassElement<GUM_SCALAR> in this PRMClassElementContainer.
Returns
the NodeId assigned to elt.
Exceptions
OperationNotAllowedRaised if overloading is illegal.

Implemented in gum::prm::PRMClass< GUM_SCALAR >, gum::prm::PRMInterface< GUM_SCALAR >, gum::prm::PRMClass< double >, and gum::prm::PRMInterface< double >.

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

+ Here is the caller graph for this function:

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 
)
virtual

Set the input flag value of id at b.

PRMAttribute or PRMAggregate can either be input, output, both or internal nodes.

By defaut, attributes and aggregates are inner nodes.

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 
)
virtual

Set the output flag value of id at b.

PRMAttribute or PRMAggregate can either be input, output, both or internal nodes.

By defaut, attributes and aggregates are inner nodes.

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:

Friends And Related Function Documentation

template<typename GUM_SCALAR>
friend class PRMClassElementContainterConstIterator
friend

Definition at line 66 of file PRMClassElementContainer.h.

template<typename GUM_SCALAR>
friend class PRMClassElementContainterIterator
friend

Definition at line 65 of file PRMClassElementContainer.h.

Member Data Documentation

template<typename GUM_SCALAR>
HashTable< std::string, std::pair< bool, bool > > gum::prm::PRMClassElementContainer< GUM_SCALAR >::__IOFlags
private

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