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

A PRMSlotChain represents a sequence of gum::prm::PRMClassElement<GUM_SCALAR> where the n-1 first gum::prm::PRMClassElement<GUM_SCALAR> are gum::prm::PRMReferenceSlot and the last gum::prm::PRMClassElement<GUM_SCALAR> an gum::prm::PRMAttribute or an gum::prm::PRMAggregate. More...

#include <PRMObject.h>

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

Public Member Functions

Constructors & destructor
 PRMSlotChain (const std::string &name, const Sequence< PRMClassElement< GUM_SCALAR > * > &chain)
 Default constructor. More...
 
 PRMSlotChain (Sequence< PRMClassElement< GUM_SCALAR > * > *chain, const std::string &name)
 Tweak constructor. More...
 
 PRMSlotChain (const PRMSlotChain< GUM_SCALAR > &source)
 Copy constructor. More...
 
virtual ~PRMSlotChain ()
 Destructor. More...
 
Getters & setters
virtual PRMClassElement< GUM_SCALAR >::ClassElementType elt_type () const
 See gum::PRMClassElement<GUM_SCALAR>::elt_type(). More...
 
virtual PRMTypetype ()
 This is similar to the following call: this->lastElt().type() More...
 
virtual const PRMTypetype () const
 This is similar to the following call: this->lastElt().type() More...
 
virtual const Potential< GUM_SCALAR > & cpf () const
 This is similar to the following call: this->lastElt().cpf() More...
 
bool isMultiple () const
 Return true if this slot chain contains at least one multiple reference slot. More...
 
PRMClassElementContainer< GUM_SCALAR > & end ()
 Returns the PRMClassElement<GUM_SCALAR>Container over which this slot chain ends. More...
 
const PRMClassElementContainer< GUM_SCALAR > & end () const
 Returns the PRMClassElement<GUM_SCALAR>Container over which this slot chain ends. More...
 
PRMClassElement< GUM_SCALAR > & lastElt ()
 Returns the last element of the slot chain, typically this is an gum::PRMAttribute or a gum::PRMAggregate. More...
 
const PRMClassElement< GUM_SCALAR > & lastElt () const
 Returns the last element of the slot chain, typically this is an gum::PRMAttribute or a gum::PRMAggregate. More...
 
Sequence< PRMClassElement< GUM_SCALAR > *> & chain ()
 Return the sequence representing the chain of elements in this PRMSlotChain. More...
 
const Sequence< PRMClassElement< GUM_SCALAR > *> & chain () const
 Return the sequence representing the chain of elements in this PRMSlotChain. More...
 
virtual void addParent (const PRMClassElement< GUM_SCALAR > &elt)
 See gum::PRMClassElement<GUM_SCALAR>::addParent_(). More...
 
virtual void addChild (const PRMClassElement< GUM_SCALAR > &elt)
 See gum::PRMClassElement<GUM_SCALAR>::addChild_(). More...
 
virtual PRMAttribute< GUM_SCALAR > * getCastDescendant () const
 Raise a gum::OperationNotAllowed exception See gum::PRMClassElement<GUM_SCALAR>::getCastDescendant() More...
 
Getters & setters
NodeId id () const
 Returns the NodeId of this element in it's class DAG. More...
 
virtual void setId (NodeId id)
 Used to assign the id of this element. More...
 
virtual PRMObject::prm_type obj_type () const
 
Fast access to random variable's properties
const std::string & safeName () const
 Returns the safe name of this PRMClassElement, if any. More...
 
virtual std::string cast (const PRMType &t) const
 Returns the name of the cast descendant with PRMType t of this PRMClassElement. 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 Attributes

std::string safeName_
 The safe name of this PRMClassElement. More...
 

Built-in type

enum  ClassElementType {
  prm_attribute, prm_aggregate, prm_refslot, prm_slotchain,
  prm_parameter
}
 Returns true if obj_ptr is of type PRMReferenceSlot. More...
 
static std::string enum2str (ClassElementType type)
 Returns true if obj_ptr is of type PRMReferenceSlot. More...
 
static INLINE bool isReferenceSlot (const PRMClassElement< GUM_SCALAR > &elt)
 Returns true if obj_ptr is of type PRMReferenceSlot. More...
 
static INLINE bool isAttribute (const PRMClassElement< GUM_SCALAR > &elt)
 Returns true if obj_ptr is of type PRMAttribute. More...
 
static INLINE bool isAggregate (const PRMClassElement< GUM_SCALAR > &elt)
 Return true if obj is of type PRMAggregate. More...
 
static INLINE bool isSlotChain (const PRMClassElement< GUM_SCALAR > &elt)
 Return true if obj is of type PRMSlotChain. More...
 
static INLINE bool isParameter (const PRMClassElement< GUM_SCALAR > &elt)
 Return true if obj is of type PRMParameter. 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 enum2str (prm_type type)
 Returns the string representation of a PRMObject. 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 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...
 

Private members of PRMSlotChain.

Sequence< PRMClassElement< GUM_SCALAR > *> * chain__
 The sequence of PRMClassElement<GUM_SCALAR> composing the slot chain. More...
 
bool isMultiple__
 Flag indicating if this slot chain is multiple or not. More...
 
void copyLastElt__ ()
 Copy the last element, this prevents unwanted DuplicateElement exceptions. More...
 

Detailed Description

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

A PRMSlotChain represents a sequence of gum::prm::PRMClassElement<GUM_SCALAR> where the n-1 first gum::prm::PRMClassElement<GUM_SCALAR> are gum::prm::PRMReferenceSlot and the last gum::prm::PRMClassElement<GUM_SCALAR> an gum::prm::PRMAttribute or an gum::prm::PRMAggregate.

A PRMSlotChain behaves as an gum::prm::PRMAttribute or an gum::prm::PRMAggregate (depending the gum::prm::PRMClassElement<GUM_SCALAR> type of it's last element) regarding the following methods: gum::prm::PRMClassElement<GUM_SCALAR>::type() and gum::prm::PRMClassElement<GUM_SCALAR>::cpf().

Definition at line 228 of file PRMObject.h.

Member Enumeration Documentation

◆ ClassElementType

template<typename GUM_SCALAR>
enum gum::prm::PRMClassElement::ClassElementType
inherited

Returns true if obj_ptr is of type PRMReferenceSlot.

Enumerator
prm_attribute 
prm_aggregate 
prm_refslot 
prm_slotchain 
prm_parameter 

Definition at line 94 of file PRMClassElement.h.

◆ prm_type

enum gum::prm::PRMObject::prm_type : char
stronginherited

Enumeration of the different types of objects handled by a PRM.

The "all" type is used to tell that we want any kind of PRMType (useful with iterators for example). No PRMObject will ever have "all" as type.

Enumerator
ALL 
CLASS 
PRM_INTERFACE 
CLASS_ELT 
TYPE 
SYSTEM 
INSTANCE 

Definition at line 68 of file PRMObject.h.

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

Constructor & Destructor Documentation

◆ PRMSlotChain() [1/3]

template<typename GUM_SCALAR>
gum::prm::PRMSlotChain< GUM_SCALAR >::PRMSlotChain ( const std::string &  name,
const Sequence< PRMClassElement< GUM_SCALAR > * > &  chain 
)

Default constructor.

Chain's n-1 first elements must be PRMReferenceSlot and the last element must either be an PRMAttribute or an PRMAggregate.

Warning: the last element in chain is copied !

Parameters
nameThe name of this PRMSlotChain.
chainThe chain of gum::prm::PRMClassElement<GUM_SCALAR> in this PRMSlotChain.
Exceptions
OperationNotAllowedRaised if the chain contains less than two PRMClassElement<GUM_SCALAR>.
WrongClassElement<GUM_SCALAR>Raised contains invalid PRMClassElement<GUM_SCALAR>.

Definition at line 34 of file PRMSlotChain_tpl.h.

36  :
37  PRMClassElement< GUM_SCALAR >(name),
38  chain__(new Sequence< PRMClassElement< GUM_SCALAR >* >(chain)),
39  isMultiple__(false) {
40  GUM_CONSTRUCTOR(PRMSlotChain);
41 
42  if (chain__->size() < 2) {
43  GUM_ERROR(OperationNotAllowed,
44  "chain must contain at least two ClassElement");
45  }
46 
47  for (Size i = 0; i < chain__->size() - 1; ++i) {
48  if (chain__->atPos(i)->elt_type()
50  GUM_ERROR(WrongClassElement, "illegal ClassElement in chain");
51  } else {
53  = isMultiple__
54  || static_cast< PRMReferenceSlot< GUM_SCALAR >* >(chain__->atPos(i))
55  ->isArray();
56  }
57  }
58 
59  copyLastElt__();
60 
61  this->safeName_ = PRMObject::LEFT_CAST() + lastElt().type().name()
63  this->lastElt().type().variable().setName(name);
64  }
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:34
Sequence< PRMClassElement< GUM_SCALAR > *> * chain__
The sequence of PRMClassElement<GUM_SCALAR> composing the slot chain.
Definition: PRMSlotChain.h:209
std::string safeName_
The safe name of this PRMClassElement.
bool isMultiple__
Flag indicating if this slot chain is multiple or not.
Definition: PRMSlotChain.h:212
void copyLastElt__()
Copy the last element, this prevents unwanted DuplicateElement exceptions.
static std::string LEFT_CAST()
Enumeration of the different types of objects handled by a PRM.
Definition: PRMObject.h:79
PRMSlotChain(const std::string &name, const Sequence< PRMClassElement< GUM_SCALAR > * > &chain)
Default constructor.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:47
PRMClassElement< GUM_SCALAR > & lastElt()
Returns the last element of the slot chain, typically this is an gum::PRMAttribute or a gum::PRMAggre...
static std::string RIGHT_CAST()
Enumeration of the different types of objects handled by a PRM.
Definition: PRMObject.h:80
#define GUM_ERROR(type, msg)
Definition: exceptions.h:54
Sequence< PRMClassElement< GUM_SCALAR > *> & chain()
Return the sequence representing the chain of elements in this PRMSlotChain.

◆ PRMSlotChain() [2/3]

template<typename GUM_SCALAR>
gum::prm::PRMSlotChain< GUM_SCALAR >::PRMSlotChain ( Sequence< PRMClassElement< GUM_SCALAR > * > *  chain,
const std::string &  name 
)

Tweak constructor.

Chain's n-1 first elements must be PRMReferenceSlot and the last element must either be an PRMAttribute or an PRMAggregate.

Warning: the last element in chain is copied !

Parameters
nameThe name of this PRMSlotChain.
chainThe chain given to this PRMSlotChain, it is deleted when PRMSlotChain::~PRMSlotChain() is called.
Exceptions
OperationNotAllowedRaised if the chain contains less than two PRMClassElement<GUM_SCALAR>.
WrongClassElement<GUM_SCALAR>Raised contains invalid PRMClassElement<GUM_SCALAR>.

Definition at line 69 of file PRMSlotChain_tpl.h.

71  :
73  // No need to
74  // GUM_CONSTRUCTOR(PRMSlotChain);
75 
76  // if (chain__->size() < 2) {
77  // GUM_ERROR(OperationNotAllowed,
78  // "chain must containt at least two PRMClassElement");
79  //}
80 
81  // for (Size i = 0; i < chain__->size() - 1; ++i) {
82  // if (not(chain__->atPos(i)->elt_type() !=
83  // PRMClassElement<GUM_SCALAR>::prm_refslot)) {
84  // GUM_ERROR(WrongClassElement, "illegal PRMClassElement in chain");
85  // } else {
86  // isMultiple__ =
87  // isMultiple__ or
88  // static_cast<PRMReferenceSlot<GUM_SCALAR>
89  // *>(chain__->atPos(i))->isArray();
90  // }
91  //}
92 
93  //__copyLastElt();
94  // this->safeName_ = PRMObject::LEFT_CAST() + lastElt().type().name() +
95  // PRMObject::RIGHT_CAST() + name;
96  }
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:34
PRMSlotChain(const std::string &name, const Sequence< PRMClassElement< GUM_SCALAR > * > &chain)
Default constructor.
Sequence< PRMClassElement< GUM_SCALAR > *> & chain()
Return the sequence representing the chain of elements in this PRMSlotChain.

◆ PRMSlotChain() [3/3]

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

Copy constructor.

This creates a copy of the slot chain.

Definition at line 145 of file PRMSlotChain_tpl.h.

146  :
147  PRMClassElement< GUM_SCALAR >(source.name()),
148  chain__(new Sequence< PRMClassElement< GUM_SCALAR >* >(source.chain())),
149  isMultiple__(source.isMultiple()) {
150  GUM_CONS_CPY(PRMSlotChain);
151  copyLastElt__();
152  }
Sequence< PRMClassElement< GUM_SCALAR > *> * chain__
The sequence of PRMClassElement<GUM_SCALAR> composing the slot chain.
Definition: PRMSlotChain.h:209
bool isMultiple__
Flag indicating if this slot chain is multiple or not.
Definition: PRMSlotChain.h:212
void copyLastElt__()
Copy the last element, this prevents unwanted DuplicateElement exceptions.
PRMSlotChain(const std::string &name, const Sequence< PRMClassElement< GUM_SCALAR > * > &chain)
Default constructor.

◆ ~PRMSlotChain()

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

Destructor.

Definition at line 138 of file PRMSlotChain_tpl.h.

138  {
139  GUM_DESTRUCTOR(PRMSlotChain);
140  delete chain__->back();
141  delete chain__;
142  }
Sequence< PRMClassElement< GUM_SCALAR > *> * chain__
The sequence of PRMClassElement<GUM_SCALAR> composing the slot chain.
Definition: PRMSlotChain.h:209
PRMSlotChain(const std::string &name, const Sequence< PRMClassElement< GUM_SCALAR > * > &chain)
Default constructor.

Member Function Documentation

◆ addChild()

template<typename GUM_SCALAR>
INLINE void gum::prm::PRMSlotChain< GUM_SCALAR >::addChild ( const PRMClassElement< GUM_SCALAR > &  elt)
virtual

See gum::PRMClassElement<GUM_SCALAR>::addChild_().

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

Definition at line 226 of file PRMSlotChain_tpl.h.

227  {}

◆ addParent()

template<typename GUM_SCALAR>
INLINE void gum::prm::PRMSlotChain< GUM_SCALAR >::addParent ( const PRMClassElement< GUM_SCALAR > &  elt)
virtual

See gum::PRMClassElement<GUM_SCALAR>::addParent_().

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

Definition at line 222 of file PRMSlotChain_tpl.h.

223  {}

◆ cast()

template<typename GUM_SCALAR >
INLINE std::string gum::prm::PRMClassElement< GUM_SCALAR >::cast ( const PRMType t) const
virtualinherited

Returns the name of the cast descendant with PRMType t of this PRMClassElement.

Parameters
tThe type in which we want to cast this PRMClassElement.
Exceptions
OperationNotAllowedIf the cast is impossible.

Definition at line 75 of file PRMClassElement_tpl.h.

75  {
76  if (type().isSubTypeOf(t)) {
77  return PRMObject::LEFT_CAST() + t.name() + PRMObject::RIGHT_CAST()
78  + name();
79  } else {
80  GUM_ERROR(OperationNotAllowed, "illegal cast");
81  }
82  }
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:34
virtual PRMType & type()=0
Return a reference over the gum::PRMType of this class element.
static std::string LEFT_CAST()
Enumeration of the different types of objects handled by a PRM.
Definition: PRMObject.h:79
static std::string RIGHT_CAST()
Enumeration of the different types of objects handled by a PRM.
Definition: PRMObject.h:80
#define GUM_ERROR(type, msg)
Definition: exceptions.h:54

◆ chain() [1/2]

template<typename GUM_SCALAR >
INLINE Sequence< PRMClassElement< GUM_SCALAR > *> & gum::prm::PRMSlotChain< GUM_SCALAR >::chain ( )

Return the sequence representing the chain of elements in this PRMSlotChain.

Definition at line 211 of file PRMSlotChain_tpl.h.

211  {
212  return *chain__;
213  }
Sequence< PRMClassElement< GUM_SCALAR > *> * chain__
The sequence of PRMClassElement<GUM_SCALAR> composing the slot chain.
Definition: PRMSlotChain.h:209

◆ chain() [2/2]

template<typename GUM_SCALAR >
INLINE const Sequence< PRMClassElement< GUM_SCALAR > *> & gum::prm::PRMSlotChain< GUM_SCALAR >::chain ( ) const

Return the sequence representing the chain of elements in this PRMSlotChain.

Definition at line 217 of file PRMSlotChain_tpl.h.

217  {
218  return *chain__;
219  }
Sequence< PRMClassElement< GUM_SCALAR > *> * chain__
The sequence of PRMClassElement<GUM_SCALAR> composing the slot chain.
Definition: PRMSlotChain.h:209

◆ copyLastElt__()

template<typename GUM_SCALAR >
void gum::prm::PRMSlotChain< GUM_SCALAR >::copyLastElt__ ( )
private

Copy the last element, this prevents unwanted DuplicateElement exceptions.

Definition at line 99 of file PRMSlotChain_tpl.h.

99  {
100  PRMClassElement< GUM_SCALAR >* new_elt = nullptr;
101 
102  switch (chain__->back()->elt_type()) {
104  auto old_attr
105  = static_cast< const PRMAttribute< GUM_SCALAR >* >(chain__->back());
106 
107  Bijection< const DiscreteVariable*, const DiscreteVariable* > bij;
108  for (auto var: old_attr->cpf().variablesSequence()) {
109  if (var != &(old_attr->type().variable())) { bij.insert(var, var); }
110  }
111 
112  new_elt = old_attr->copy(bij);
113  break;
114  }
115 
117  const PRMAggregate< GUM_SCALAR >* c_agg
118  = static_cast< const PRMAggregate< GUM_SCALAR >* >(chain__->back());
119  PRMAggregate< GUM_SCALAR >* agg
120  = new PRMAggregate< GUM_SCALAR >(c_agg->name(),
121  c_agg->agg_type(),
122  c_agg->type(),
123  c_agg->id());
124  new_elt = agg;
125  break;
126  }
127 
128  default: {
129  GUM_ERROR(WrongClassElement, "last element of chain is not valid");
130  }
131  }
132 
133  new_elt->setId(chain__->back()->id());
134  chain__->setAtPos(chain__->size() - 1, new_elt);
135  }
Sequence< PRMClassElement< GUM_SCALAR > *> * chain__
The sequence of PRMClassElement<GUM_SCALAR> composing the slot chain.
Definition: PRMSlotChain.h:209
#define GUM_ERROR(type, msg)
Definition: exceptions.h:54

◆ cpf()

template<typename GUM_SCALAR >
INLINE const Potential< GUM_SCALAR > & gum::prm::PRMSlotChain< GUM_SCALAR >::cpf ( ) const
virtual

This is similar to the following call: this->lastElt().cpf()

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

Definition at line 178 of file PRMSlotChain_tpl.h.

178  {
179  return chain__->back()->cpf();
180  }
Sequence< PRMClassElement< GUM_SCALAR > *> * chain__
The sequence of PRMClassElement<GUM_SCALAR> composing the slot chain.
Definition: PRMSlotChain.h:209

◆ elt_type()

template<typename GUM_SCALAR >
INLINE PRMClassElement< GUM_SCALAR >::ClassElementType gum::prm::PRMSlotChain< GUM_SCALAR >::elt_type ( ) const
virtual

See gum::PRMClassElement<GUM_SCALAR>::elt_type().

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

Definition at line 163 of file PRMSlotChain_tpl.h.

163  {
164  return this->prm_slotchain;
165  }

◆ end() [1/2]

template<typename GUM_SCALAR >
INLINE PRMClassElementContainer< GUM_SCALAR > & gum::prm::PRMSlotChain< GUM_SCALAR >::end ( )

Returns the PRMClassElement<GUM_SCALAR>Container over which this slot chain ends.

Definition at line 184 of file PRMSlotChain_tpl.h.

184  {
185  return static_cast< PRMReferenceSlot< GUM_SCALAR >* >(
186  chain__->atPos(chain__->size() - 2))
187  ->slotType();
188  }
Sequence< PRMClassElement< GUM_SCALAR > *> * chain__
The sequence of PRMClassElement<GUM_SCALAR> composing the slot chain.
Definition: PRMSlotChain.h:209

◆ end() [2/2]

template<typename GUM_SCALAR >
INLINE const PRMClassElementContainer< GUM_SCALAR > & gum::prm::PRMSlotChain< GUM_SCALAR >::end ( ) const

Returns the PRMClassElement<GUM_SCALAR>Container over which this slot chain ends.

Definition at line 192 of file PRMSlotChain_tpl.h.

192  {
193  return static_cast< PRMReferenceSlot< GUM_SCALAR >* >(
194  chain__->atPos(chain__->size() - 2))
195  ->slotType();
196  }
Sequence< PRMClassElement< GUM_SCALAR > *> * chain__
The sequence of PRMClassElement<GUM_SCALAR> composing the slot chain.
Definition: PRMSlotChain.h:209

◆ enum2str() [1/2]

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

Returns the string representation of a PRMObject.

Definition at line 83 of file PRMObject.h.

83  {
84  switch (type) {
85  case prm_type::CLASS:
86  return "PRMType::CLASS";
87 
89  return "PRMType::CLASS_ELT";
90 
91  case prm_type::TYPE:
92  return "PRMType::TYPE";
93 
94  case prm_type::SYSTEM:
95  return "PRMType::SYSTEM";
96 
97  case prm_type::INSTANCE:
98  return "PRMType::INSTANCE";
99 
101  return "PRMType::PRM_INTERFACE";
102 
103  default:
104  return "unknown";
105  }
106  }

◆ enum2str() [2/2]

template<typename GUM_SCALAR>
static std::string gum::prm::PRMClassElement< GUM_SCALAR >::enum2str ( ClassElementType  type)
inlinestaticinherited

Returns true if obj_ptr is of type PRMReferenceSlot.

Definition at line 103 of file PRMClassElement.h.

103  {
104  switch (type) {
105  case prm_attribute:
106  return "prm_attribute";
107 
108  case prm_aggregate:
109  return "prm_aggregate";
110 
111  case prm_refslot:
112  return "prm_refslot";
113 
114  case prm_slotchain:
115  return "prm_slotchain";
116 
117  case prm_parameter:
118  return "prm_parameter";
119 
120  default:
121  return "unknown";
122  }
123  }
virtual PRMType & type()=0
Return a reference over the gum::PRMType of this class element.

◆ getCastDescendant()

template<typename GUM_SCALAR >
INLINE PRMAttribute< GUM_SCALAR > * gum::prm::PRMSlotChain< GUM_SCALAR >::getCastDescendant ( ) const
virtual

Raise a gum::OperationNotAllowed exception See gum::PRMClassElement<GUM_SCALAR>::getCastDescendant()

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

Definition at line 236 of file PRMSlotChain_tpl.h.

236  {
237  GUM_ERROR(OperationNotAllowed, "This is a slotchain");
238  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:54

◆ id()

template<typename GUM_SCALAR >
INLINE NodeId gum::prm::PRMClassElement< GUM_SCALAR >::id ( ) const
inherited

Returns the NodeId of this element in it's class DAG.

Definition at line 54 of file PRMClassElement_tpl.h.

54  {
55  return id__;
56  }
NodeId id__
The node&#39;s id of this element.

◆ isAggregate()

template<typename GUM_SCALAR>
static INLINE bool gum::prm::PRMClassElement< GUM_SCALAR >::isAggregate ( const PRMClassElement< GUM_SCALAR > &  elt)
inlinestaticinherited

Return true if obj is of type PRMAggregate.

Definition at line 137 of file PRMClassElement.h.

137  {
138  return elt.elt_type() == prm_aggregate;
139  }

◆ isAttribute()

template<typename GUM_SCALAR>
static INLINE bool gum::prm::PRMClassElement< GUM_SCALAR >::isAttribute ( const PRMClassElement< GUM_SCALAR > &  elt)
inlinestaticinherited

Returns true if obj_ptr is of type PRMAttribute.

Definition at line 132 of file PRMClassElement.h.

132  {
133  return elt.elt_type() == prm_attribute;
134  }

◆ isClass()

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

Returns true if obj_ptr is of type Class.

Definition at line 109 of file PRMObject.h.

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

109  {
110  return obj.obj_type() == prm_type::CLASS;
111  }
+ Here is the call graph for this function:

◆ isInstance()

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

Returns true if obj_ptr is of type PRMInstance.

Definition at line 119 of file PRMObject.h.

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

119  {
120  return obj.obj_type() == prm_type::INSTANCE;
121  }
+ Here is the call graph for this function:

◆ isInterface()

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

Returns true if obj_ptr is of type PRMInterface.

Definition at line 114 of file PRMObject.h.

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

114  {
115  return obj.obj_type() == prm_type::PRM_INTERFACE;
116  }
+ Here is the call graph for this function:

◆ isMultiple()

template<typename GUM_SCALAR >
INLINE bool gum::prm::PRMSlotChain< GUM_SCALAR >::isMultiple ( ) const

Return true if this slot chain contains at least one multiple reference slot.

Definition at line 230 of file PRMSlotChain_tpl.h.

230  {
231  return isMultiple__;
232  }
bool isMultiple__
Flag indicating if this slot chain is multiple or not.
Definition: PRMSlotChain.h:212

◆ isParameter()

template<typename GUM_SCALAR>
static INLINE bool gum::prm::PRMClassElement< GUM_SCALAR >::isParameter ( const PRMClassElement< GUM_SCALAR > &  elt)
inlinestaticinherited

Return true if obj is of type PRMParameter.

Definition at line 147 of file PRMClassElement.h.

147  {
148  return elt.elt_type() == prm_parameter;
149  }

◆ isReferenceSlot()

template<typename GUM_SCALAR>
static INLINE bool gum::prm::PRMClassElement< GUM_SCALAR >::isReferenceSlot ( const PRMClassElement< GUM_SCALAR > &  elt)
inlinestaticinherited

Returns true if obj_ptr is of type PRMReferenceSlot.

Definition at line 127 of file PRMClassElement.h.

127  {
128  return elt.elt_type() == prm_refslot;
129  }

◆ isSlotChain()

template<typename GUM_SCALAR>
static INLINE bool gum::prm::PRMClassElement< GUM_SCALAR >::isSlotChain ( const PRMClassElement< GUM_SCALAR > &  elt)
inlinestaticinherited

Return true if obj is of type PRMSlotChain.

Definition at line 142 of file PRMClassElement.h.

142  {
143  return elt.elt_type() == prm_slotchain;
144  }

◆ lastElt() [1/2]

template<typename GUM_SCALAR >
INLINE PRMClassElement< GUM_SCALAR > & gum::prm::PRMSlotChain< GUM_SCALAR >::lastElt ( )

Returns the last element of the slot chain, typically this is an gum::PRMAttribute or a gum::PRMAggregate.

Definition at line 199 of file PRMSlotChain_tpl.h.

199  {
200  return *(chain__->back());
201  }
Sequence< PRMClassElement< GUM_SCALAR > *> * chain__
The sequence of PRMClassElement<GUM_SCALAR> composing the slot chain.
Definition: PRMSlotChain.h:209

◆ lastElt() [2/2]

template<typename GUM_SCALAR >
INLINE const PRMClassElement< GUM_SCALAR > & gum::prm::PRMSlotChain< GUM_SCALAR >::lastElt ( ) const

Returns the last element of the slot chain, typically this is an gum::PRMAttribute or a gum::PRMAggregate.

Definition at line 205 of file PRMSlotChain_tpl.h.

205  {
206  return *(chain__->back());
207  }
Sequence< PRMClassElement< GUM_SCALAR > *> * chain__
The sequence of PRMClassElement<GUM_SCALAR> composing the slot chain.
Definition: PRMSlotChain.h:209

◆ LEFT_CAST()

static std::string gum::prm::PRMObject::LEFT_CAST ( )
inlinestaticinherited

Enumeration of the different types of objects handled by a PRM.

The "all" type is used to tell that we want any kind of PRMType (useful with iterators for example). No PRMObject will ever have "all" as type.

Definition at line 79 of file PRMObject.h.

79 { return "("; }

◆ name() [1/2]

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

Returns the name of this object.

Definition at line 34 of file PRMObject_inl.h.

References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().

34 { return name__; }
std::string name__
Definition: PRMObject.h:207
+ Here is the call graph for this function:

◆ name() [2/2]

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

Change the name of the PRM Object.

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

Definition at line 38 of file PRMObject_inl.h.

References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().

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

◆ obj_type()

template<typename GUM_SCALAR >
INLINE PRMObject::prm_type gum::prm::PRMClassElement< GUM_SCALAR >::obj_type ( ) const
virtualinherited
See also
gum::PRMObject::obj_type().

Implements gum::prm::PRMObject.

Definition at line 59 of file PRMClassElement_tpl.h.

◆ operator!=()

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

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

Definition at line 48 of file PRMObject_inl.h.

References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().

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

◆ operator=()

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

Copy operator. Don't use it.

Definition at line 155 of file PRMSlotChain_tpl.h.

156  {
157  GUM_ERROR(FatalError,
158  "Illegal call to gum::SlotChain<GUM_SCALAR> copy constructor.");
159  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:54

◆ operator==()

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

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

Definition at line 42 of file PRMObject_inl.h.

References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().

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

◆ RIGHT_CAST()

static std::string gum::prm::PRMObject::RIGHT_CAST ( )
inlinestaticinherited

Enumeration of the different types of objects handled by a PRM.

The "all" type is used to tell that we want any kind of PRMType (useful with iterators for example). No PRMObject will ever have "all" as type.

Definition at line 80 of file PRMObject.h.

80 { return ")"; }

◆ safeName()

template<typename GUM_SCALAR >
INLINE const std::string & gum::prm::PRMClassElement< GUM_SCALAR >::safeName ( ) const
inherited

Returns the safe name of this PRMClassElement, if any.

This will only work if this PRMClassElement is an PRMAttribute or an PRMAggregate.

Returns
Returns the safe name of this PRMClassElement.
Exceptions
NotFound&Raised if this PRMClassElement does not have any safe name.

Definition at line 69 of file PRMClassElement_tpl.h.

69  {
70  return safeName_;
71  }
std::string safeName_
The safe name of this PRMClassElement.

◆ setId()

template<typename GUM_SCALAR >
INLINE void gum::prm::PRMClassElement< GUM_SCALAR >::setId ( NodeId  id)
virtualinherited

Used to assign the id of this element.

Definition at line 64 of file PRMClassElement_tpl.h.

64  {
65  id__ = id;
66  }
NodeId id__
The node&#39;s id of this element.
NodeId id() const
Returns the NodeId of this element in it&#39;s class DAG.

◆ type() [1/2]

template<typename GUM_SCALAR >
INLINE PRMType & gum::prm::PRMSlotChain< GUM_SCALAR >::type ( )
virtual

This is similar to the following call: this->lastElt().type()

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

Definition at line 168 of file PRMSlotChain_tpl.h.

168  {
169  return chain__->back()->type();
170  }
Sequence< PRMClassElement< GUM_SCALAR > *> * chain__
The sequence of PRMClassElement<GUM_SCALAR> composing the slot chain.
Definition: PRMSlotChain.h:209

◆ type() [2/2]

template<typename GUM_SCALAR >
INLINE const PRMType & gum::prm::PRMSlotChain< GUM_SCALAR >::type ( ) const
virtual

This is similar to the following call: this->lastElt().type()

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

Definition at line 173 of file PRMSlotChain_tpl.h.

173  {
174  return chain__->back()->type();
175  }
Sequence< PRMClassElement< GUM_SCALAR > *> * chain__
The sequence of PRMClassElement<GUM_SCALAR> composing the slot chain.
Definition: PRMSlotChain.h:209

Member Data Documentation

◆ chain__

template<typename GUM_SCALAR>
Sequence< PRMClassElement< GUM_SCALAR >* >* gum::prm::PRMSlotChain< GUM_SCALAR >::chain__
private

The sequence of PRMClassElement<GUM_SCALAR> composing the slot chain.

Definition at line 209 of file PRMSlotChain.h.

◆ isMultiple__

template<typename GUM_SCALAR>
bool gum::prm::PRMSlotChain< GUM_SCALAR >::isMultiple__
private

Flag indicating if this slot chain is multiple or not.

Definition at line 212 of file PRMSlotChain.h.

◆ safeName_

template<typename GUM_SCALAR>
std::string gum::prm::PRMClassElement< GUM_SCALAR >::safeName_
protectedinherited

The safe name of this PRMClassElement.

Definition at line 266 of file PRMClassElement.h.


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