aGrUM  0.13.2
gum::prm::PRMType< GUM_SCALAR > Class Template Reference

This is a decoration of the DiscreteVariable class. More...

#include <PRMObject.h>

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

Public Member Functions

Constructors & destructor
 PRMType (const DiscreteVariable &var)
 Default Constructor. More...
 
 PRMType (PRMType &super_type, const std::vector< Idx > &label_map, const DiscreteVariable &var)
 Sub type constructor. More...
 
 PRMType (const PRMType &from)
 Copy constructor. More...
 
virtual ~PRMType ()
 Destructor. More...
 
Getters & setters
DiscreteVariablevariable ()
 Return a reference on the DiscreteVariable contained in this. More...
 
const DiscreteVariablevariable () const
 Return a reference on the DiscreteVariable contained in this. More...
 
virtual prm_type obj_type () const
 Implementation of the pure virtual method of PRMObject. More...
 
const std::string & name () const
 Returns the name of this object. More...
 
bool isSubType () const
 Returns true if this type is a sub-type. More...
 
bool isSubTypeOf (const PRMType &super) const
 Returns true if this is a subtype of super. More...
 
bool isSuperTypeOf (const PRMType &t) const
 Returns true if this is a super type of t. More...
 
PRMTypesuperType ()
 Returns the super type of this type. More...
 
const PRMTypesuperType () const
 Returns the super type of this type. More...
 
void setSuper (PRMType &t)
 Changes the PRMType of this PRMType super. More...
 
const std::vector< Idx > & label_map () const
 Returns the vector in which the i-th element is the Idx of the super type's label for the i-th label of this. More...
 
Operators
DiscreteVariableoperator* ()
 Indirection on the DiscreteVariable contained in this. More...
 
const DiscreteVariableoperator* () const
 Constant indirection on the DiscreteVariable contained in this. More...
 
DiscreteVariableoperator-> ()
 Dereference the DiscreteVariable contained in this. More...
 
DiscreteVariable const * operator-> () const
 Constant dereference the DiscreteVariable contained in this. More...
 
bool operator== (const PRMObject &from) const
 Equality operator. More...
 
bool operator!= (const PRMObject &from) const
 Difference operator. More...
 
Getters & setters.
void name (const std::string &name)
 Change the name of the PRM Object. More...
 

Static Public Member Functions

Static methods for primitive types
static PRMTypeboolean ()
 Returns a pointer on type boolean. More...
 

Friends

Friends of PRMType
class PRMFactory< GUM_SCALAR >
 

Built-in types.

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...
 
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...
 

Private members.

DiscreteVariable__var
 The discrete variable. More...
 
PRMType__superType
 The super type of this, if any. More...
 
std::vector< Idx > * __label_map
 A vector in which the i-th element is the Idx of the super type's label for the i-th label of this. More...
 
bool __isValid () const
 Returns true if this is a valid type or subtype. More...
 
void __updateName ()
 Used at construction to set a unique name to this class underlying DiscreteVariable. More...
 

Detailed Description

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

This is a decoration of the DiscreteVariable class.

The name of the DiscreteVariable will be the name of the type (i.e. of the PRMObject). As for all PRMObject, a type's name is unique in a given PRM, so equality tests will be based on the types names.

Since MultiDim use pointers to handle DiscreteVariables, it is necessary to create a new instance of a type for each PRMAttribute.

Definition at line 207 of file PRMObject.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::PRMType< GUM_SCALAR >::PRMType ( const DiscreteVariable var)
explicit

Default Constructor.

A copy is made of var.

Definition at line 41 of file PRMType_tpl.h.

References gum::prm::PRMType< GUM_SCALAR >::__updateName().

Referenced by gum::prm::PRMType< double >::boolean().

41  :
42  PRMObject(var.name()), __var(var.clone()), __superType(0), __label_map(0) {
43  GUM_CONSTRUCTOR(PRMType);
44  this->__updateName();
45  }
std::vector< Idx > * __label_map
A vector in which the i-th element is the Idx of the super type&#39;s label for the i-th label of this...
Definition: PRMType.h:278
DiscreteVariable * __var
The discrete variable.
Definition: PRMType.h:271
PRMType(const DiscreteVariable &var)
Default Constructor.
Definition: PRMType_tpl.h:41
PRMType * __superType
The super type of this, if any.
Definition: PRMType.h:274
void __updateName()
Used at construction to set a unique name to this class underlying DiscreteVariable.
Definition: PRMType_tpl.h:33
PRMObject(const std::string &name)
Constructor.
Definition: PRMObject.cpp:40

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
gum::prm::PRMType< GUM_SCALAR >::PRMType ( PRMType< GUM_SCALAR > &  super_type,
const std::vector< Idx > &  label_map,
const DiscreteVariable var 
)

Sub type constructor.

A copy is made of var.

Exceptions
OperationNotAllowedRaised if label_map is invalid.

Definition at line 48 of file PRMType_tpl.h.

References gum::prm::PRMType< GUM_SCALAR >::__isValid(), gum::prm::PRMType< GUM_SCALAR >::__label_map, gum::prm::PRMType< GUM_SCALAR >::__updateName(), and GUM_ERROR.

50  :
51  PRMObject(var.name()),
52  __var(var.clone()), __superType(&super_type),
53  __label_map(new std::vector< Idx >(label_map)) {
54  GUM_CONSTRUCTOR(PRMType);
55  this->__updateName();
56 
57  if (!__isValid()) {
58  delete __label_map;
59  __label_map = 0;
60  GUM_ERROR(OperationNotAllowed, "Invalid label map.");
61  }
62  }
std::vector< Idx > * __label_map
A vector in which the i-th element is the Idx of the super type&#39;s label for the i-th label of this...
Definition: PRMType.h:278
bool __isValid() const
Returns true if this is a valid type or subtype.
Definition: PRMType_tpl.h:111
DiscreteVariable * __var
The discrete variable.
Definition: PRMType.h:271
PRMType(const DiscreteVariable &var)
Default Constructor.
Definition: PRMType_tpl.h:41
PRMType * __superType
The super type of this, if any.
Definition: PRMType.h:274
void __updateName()
Used at construction to set a unique name to this class underlying DiscreteVariable.
Definition: PRMType_tpl.h:33
PRMObject(const std::string &name)
Constructor.
Definition: PRMObject.cpp:40
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the call graph for this function:

template<typename GUM_SCALAR >
gum::prm::PRMType< GUM_SCALAR >::PRMType ( const PRMType< GUM_SCALAR > &  from)

Copy constructor.

The DiscreteVariable is copied.

Definition at line 65 of file PRMType_tpl.h.

References gum::prm::PRMType< GUM_SCALAR >::__label_map, gum::prm::PRMType< GUM_SCALAR >::__superType, gum::prm::PRMType< GUM_SCALAR >::__updateName(), and gum::prm::PRMType< GUM_SCALAR >::label_map().

65  :
66  PRMObject(from), __var(from.__var->clone()), __superType(from.__superType),
67  __label_map(0) {
68  GUM_CONS_CPY(PRMType);
69  this->__updateName();
70 
71  if (__superType) { __label_map = new std::vector< Idx >(from.label_map()); }
72  }
std::vector< Idx > * __label_map
A vector in which the i-th element is the Idx of the super type&#39;s label for the i-th label of this...
Definition: PRMType.h:278
DiscreteVariable * __var
The discrete variable.
Definition: PRMType.h:271
PRMType(const DiscreteVariable &var)
Default Constructor.
Definition: PRMType_tpl.h:41
PRMType * __superType
The super type of this, if any.
Definition: PRMType.h:274
void __updateName()
Used at construction to set a unique name to this class underlying DiscreteVariable.
Definition: PRMType_tpl.h:33
PRMObject(const std::string &name)
Constructor.
Definition: PRMObject.cpp:40

+ Here is the call graph for this function:

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

Destructor.

Definition at line 82 of file PRMType_tpl.h.

References gum::prm::PRMType< GUM_SCALAR >::__label_map, and gum::prm::PRMType< GUM_SCALAR >::__var.

Referenced by gum::prm::PRMType< double >::boolean().

82  {
83  GUM_DESTRUCTOR(PRMType);
84  delete __var;
85  if (__label_map) { delete __label_map; }
86  }
std::vector< Idx > * __label_map
A vector in which the i-th element is the Idx of the super type&#39;s label for the i-th label of this...
Definition: PRMType.h:278
DiscreteVariable * __var
The discrete variable.
Definition: PRMType.h:271
PRMType(const DiscreteVariable &var)
Default Constructor.
Definition: PRMType_tpl.h:41

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
gum::prm::PRMType< GUM_SCALAR >::PRMType ( PRMType< GUM_SCALAR > &&  from)
private

Move constructor.

Not implemented, will raise an exception.

Definition at line 75 of file PRMType_tpl.h.

References GUM_ERROR.

75  :
76  PRMObject(from) {
77  GUM_CONS_MOV(PRMType);
78  GUM_ERROR(FatalError, "Move constructor must not be used");
79  }
PRMType(const DiscreteVariable &var)
Default Constructor.
Definition: PRMType_tpl.h:41
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 >
bool gum::prm::PRMType< GUM_SCALAR >::__isValid ( ) const
private

Returns true if this is a valid type or subtype.

Definition at line 111 of file PRMType_tpl.h.

References gum::prm::PRMType< GUM_SCALAR >::__label_map, gum::prm::PRMType< GUM_SCALAR >::__superType, gum::prm::PRMType< GUM_SCALAR >::__var, and gum::DiscreteVariable::domainSize().

Referenced by gum::prm::PRMType< double >::boolean(), gum::prm::PRMFactory< GUM_SCALAR >::endDiscreteType(), and gum::prm::PRMType< GUM_SCALAR >::PRMType().

111  {
112  if (!__superType) { return __var->domainSize() > 1; }
113 
114  if (__label_map->size() == __var->domainSize()) {
115  for (size_t i = 0; i < __label_map->size(); ++i) {
116  if (__label_map->at(i) >= (**__superType).domainSize()) { return false; }
117  }
118 
119  return true;
120  }
121 
122  return false;
123  }
std::vector< Idx > * __label_map
A vector in which the i-th element is the Idx of the super type&#39;s label for the i-th label of this...
Definition: PRMType.h:278
virtual Size domainSize() const =0
DiscreteVariable * __var
The discrete variable.
Definition: PRMType.h:271
PRMType * __superType
The super type of this, if any.
Definition: PRMType.h:274

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
void gum::prm::PRMType< GUM_SCALAR >::__updateName ( )
private

Used at construction to set a unique name to this class underlying DiscreteVariable.

Definition at line 33 of file PRMType_tpl.h.

Referenced by gum::prm::PRMType< double >::boolean(), and gum::prm::PRMType< GUM_SCALAR >::PRMType().

33  {
34  const void* address = static_cast< const void* >(this);
35  std::stringstream ss;
36  ss << this->name() << "-" << address;
37  this->__var->setName(ss.str());
38  }
const std::string & name() const
Returns the name of this object.
Definition: PRMType_tpl.h:170
void setName(const std::string &theValue)
sets the name of the variable
DiscreteVariable * __var
The discrete variable.
Definition: PRMType.h:271

+ Here is the caller graph for this function:

template<typename GUM_SCALAR>
static PRMType* gum::prm::PRMType< GUM_SCALAR >::boolean ( )
inlinestatic

Returns a pointer on type boolean.

Definition at line 75 of file PRMType.h.

75  {
76  LabelizedVariable var("boolean", "Boolean variable", 0);
77  var.addLabel("false");
78  var.addLabel("true");
79  return new PRMType(var);
80  }
PRMType(const DiscreteVariable &var)
Default Constructor.
Definition: PRMType_tpl.h:41
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:

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:

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::PRMType< GUM_SCALAR >::isSubType ( ) const

Returns true if this type is a sub-type.

Definition at line 207 of file PRMType_tpl.h.

References gum::prm::PRMType< GUM_SCALAR >::__superType.

Referenced by gum::prm::PRMFactory< GUM_SCALAR >::__retrieveCommonType(), gum::prm::PRMFactory< GUM_SCALAR >::__typeDepth(), and gum::prm::PRMType< double >::boolean().

207  {
208  return __superType != nullptr;
209  }
PRMType * __superType
The super type of this, if any.
Definition: PRMType.h:274

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
bool gum::prm::PRMType< GUM_SCALAR >::isSubTypeOf ( const PRMType< GUM_SCALAR > &  super) const

Returns true if this is a subtype of super.

Note that two types that are equal are also subtypes, if a == b then a.isSubTypeOf(b) == b.isSubTypeOf(a) == true.

Definition at line 99 of file PRMType_tpl.h.

References gum::prm::PRMType< GUM_SCALAR >::__superType.

Referenced by gum::prm::PRMType< double >::boolean(), and gum::prm::PRMType< GUM_SCALAR >::isSuperTypeOf().

100  {
101  if ((*this) == super) {
102  return true;
103  } else if (__superType) {
104  return __superType->isSubTypeOf(super);
105  } else {
106  return false;
107  }
108  }
PRMType * __superType
The super type of this, if any.
Definition: PRMType.h:274

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE bool gum::prm::PRMType< GUM_SCALAR >::isSuperTypeOf ( const PRMType< GUM_SCALAR > &  t) const

Returns true if this is a super type of t.

Definition at line 213 of file PRMType_tpl.h.

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

Referenced by gum::prm::PRMType< double >::boolean().

213  {
214  return t.isSubTypeOf(*this);
215  }

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE const std::vector< Idx > & gum::prm::PRMType< GUM_SCALAR >::label_map ( ) const

Returns the vector in which the i-th element is the Idx of the super type's label for the i-th label of this.

Exceptions
NotFoundRaised if this type has no super type.

Definition at line 198 of file PRMType_tpl.h.

References gum::prm::PRMType< GUM_SCALAR >::__label_map, and GUM_ERROR.

Referenced by gum::prm::PRMFormAttribute< GUM_SCALAR >::becomeCastDescendant(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::becomeCastDescendant(), gum::prm::PRMType< double >::boolean(), and gum::prm::PRMType< GUM_SCALAR >::PRMType().

198  {
199  if (__label_map) {
200  return *__label_map;
201  } else {
202  GUM_ERROR(NotFound, "No super type for this type.");
203  }
204  }
std::vector< Idx > * __label_map
A vector in which the i-th element is the Idx of the super type&#39;s label for the i-th label of this...
Definition: PRMType.h:278
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the caller 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 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 const std::string & gum::prm::PRMType< GUM_SCALAR >::name ( ) const

Returns the name of this object.

Definition at line 170 of file PRMType_tpl.h.

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

Referenced by gum::prm::PRMFactory< GUM_SCALAR >::__retrieveCommonType(), gum::prm::PRMFactory< GUM_SCALAR >::__retrieveInputs(), gum::prm::PRMType< double >::boolean(), gum::prm::PRMClassElement< GUM_SCALAR >::cast(), gum::prm::PRMFactory< GUM_SCALAR >::endDiscreteType(), gum::prm::PRMFactory< GUM_SCALAR >::endDiscretizedType(), gum::prm::PRMType< GUM_SCALAR >::operator!=(), gum::prm::PRMType< GUM_SCALAR >::operator==(), gum::prm::PRMFuncAttribute< GUM_SCALAR >::PRMFuncAttribute(), gum::prm::PRMFormAttribute< GUM_SCALAR >::swap(), and gum::prm::PRMScalarAttribute< GUM_SCALAR >::swap().

170  {
171  return PRMObject::name();
172  }
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 PRMObject::prm_type gum::prm::PRMType< GUM_SCALAR >::obj_type ( ) const
virtual

Implementation of the pure virtual method of PRMObject.

Implements gum::prm::PRMObject.

Definition at line 165 of file PRMType_tpl.h.

References gum::prm::PRMObject::TYPE.

Referenced by gum::prm::PRMType< double >::boolean().

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE bool gum::prm::PRMType< GUM_SCALAR >::operator!= ( const PRMObject from) const

Difference operator.

Definition at line 223 of file PRMType_tpl.h.

References gum::prm::PRMObject::name(), and gum::prm::PRMType< GUM_SCALAR >::name().

Referenced by gum::prm::PRMType< double >::boolean().

223  {
224  return name() != obj.name();
225  }
const std::string & name() const
Returns the name of this object.
Definition: PRMType_tpl.h:170

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE DiscreteVariable & gum::prm::PRMType< GUM_SCALAR >::operator* ( )

Indirection on the DiscreteVariable contained in this.

Definition at line 145 of file PRMType_tpl.h.

References gum::prm::PRMType< GUM_SCALAR >::__var.

Referenced by gum::prm::PRMType< double >::boolean().

145  {
146  return *__var;
147  }
DiscreteVariable * __var
The discrete variable.
Definition: PRMType.h:271

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE const DiscreteVariable & gum::prm::PRMType< GUM_SCALAR >::operator* ( ) const

Constant indirection on the DiscreteVariable contained in this.

Definition at line 150 of file PRMType_tpl.h.

References gum::prm::PRMType< GUM_SCALAR >::__var.

150  {
151  return *__var;
152  }
DiscreteVariable * __var
The discrete variable.
Definition: PRMType.h:271
template<typename GUM_SCALAR >
INLINE DiscreteVariable * gum::prm::PRMType< GUM_SCALAR >::operator-> ( )

Dereference the DiscreteVariable contained in this.

Definition at line 155 of file PRMType_tpl.h.

References gum::prm::PRMType< GUM_SCALAR >::__var.

Referenced by gum::prm::PRMType< double >::boolean().

155  {
156  return __var;
157  }
DiscreteVariable * __var
The discrete variable.
Definition: PRMType.h:271

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE DiscreteVariable const * gum::prm::PRMType< GUM_SCALAR >::operator-> ( ) const

Constant dereference the DiscreteVariable contained in this.

Definition at line 160 of file PRMType_tpl.h.

References gum::prm::PRMType< GUM_SCALAR >::__var.

160  {
161  return __var;
162  }
DiscreteVariable * __var
The discrete variable.
Definition: PRMType.h:271
template<typename GUM_SCALAR >
PRMType< GUM_SCALAR > & gum::prm::PRMType< GUM_SCALAR >::operator= ( const PRMType< GUM_SCALAR > &  from)
private

Copy operator.

Not implemented.

Definition at line 89 of file PRMType_tpl.h.

References GUM_ERROR.

Referenced by gum::prm::PRMType< double >::boolean().

89  {
90  GUM_ERROR(FatalError, "Copy operator must not be used");
91  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
PRMType< GUM_SCALAR > & gum::prm::PRMType< GUM_SCALAR >::operator= ( PRMType< GUM_SCALAR > &&  from)
private

Move operator.

Not implemented.

Definition at line 94 of file PRMType_tpl.h.

References GUM_ERROR.

94  {
95  GUM_ERROR(FatalError, "Move operator must not be used");
96  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66
template<typename GUM_SCALAR >
INLINE bool gum::prm::PRMType< GUM_SCALAR >::operator== ( const PRMObject from) const

Equality operator.

Definition at line 218 of file PRMType_tpl.h.

References gum::prm::PRMObject::name(), and gum::prm::PRMType< GUM_SCALAR >::name().

Referenced by gum::prm::PRMType< double >::boolean().

218  {
219  return name() == obj.name();
220  }
const std::string & name() const
Returns the name of this object.
Definition: PRMType_tpl.h:170

+ Here is the call graph for this function:

+ 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::PRMType< GUM_SCALAR >::setSuper ( PRMType< GUM_SCALAR > &  t)

Changes the PRMType of this PRMType super.

You can only change this PRMType super only if t and this->superType() are equal. Thus you should use this method only if you want to change the DiscreteVariable pointer of this PRMType super.

This is useful to maintain consistence between PRMAttribute's PRMType and their CPF.

Parameters
tThe PRMType to replace this PRMType super.
Exceptions
OperationNotAllowedIf this PRMType has no super.
TypeErrorIf t is not equal to this PRMType super.

Definition at line 184 of file PRMType_tpl.h.

References gum::prm::PRMType< GUM_SCALAR >::__superType, GUM_ERROR, and gum::prm::PRMType< GUM_SCALAR >::superType().

Referenced by gum::prm::PRMType< double >::boolean().

184  {
185  try {
186  if (t != superType()) {
187  GUM_ERROR(WrongType,
188  "The given type is not a valid super type for this Type");
189  }
190  } catch (NotFound&) {
191  GUM_ERROR(OperationNotAllowed, "This Type has no super Type");
192  }
193 
194  __superType = &t;
195  }
PRMType * __superType
The super type of this, if any.
Definition: PRMType.h:274
PRMType & superType()
Returns the super type of this type.
Definition: PRMType_tpl.h:126
#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 PRMType< GUM_SCALAR > & gum::prm::PRMType< GUM_SCALAR >::superType ( )

Returns the super type of this type.

Exceptions
NotFoundRaised if this type has no super type.

Definition at line 126 of file PRMType_tpl.h.

References gum::prm::PRMType< GUM_SCALAR >::__superType, and GUM_ERROR.

Referenced by gum::prm::PRMFactory< GUM_SCALAR >::__retrieveCommonType(), gum::prm::PRMFactory< GUM_SCALAR >::__typeDepth(), gum::prm::PRMType< double >::boolean(), and gum::prm::PRMType< GUM_SCALAR >::setSuper().

126  {
127  if (__superType) {
128  return *__superType;
129  } else {
130  GUM_ERROR(NotFound, "No super type for this type.");
131  }
132  }
PRMType * __superType
The super type of this, if any.
Definition: PRMType.h:274
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE const PRMType< GUM_SCALAR > & gum::prm::PRMType< GUM_SCALAR >::superType ( ) const

Returns the super type of this type.

Exceptions
NotFoundRaised if this type has no super type.

Definition at line 175 of file PRMType_tpl.h.

References gum::prm::PRMType< GUM_SCALAR >::__superType, and GUM_ERROR.

175  {
176  if (__superType) {
177  return *__superType;
178  } else {
179  GUM_ERROR(NotFound, "No super type for this type.");
180  }
181  }
PRMType * __superType
The super type of this, if any.
Definition: PRMType.h:274
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66
template<typename GUM_SCALAR >
INLINE const DiscreteVariable & gum::prm::PRMType< GUM_SCALAR >::variable ( ) const

Return a reference on the DiscreteVariable contained in this.

Definition at line 140 of file PRMType_tpl.h.

References gum::prm::PRMType< GUM_SCALAR >::__var.

140  {
141  return *__var;
142  }
DiscreteVariable * __var
The discrete variable.
Definition: PRMType.h:271

Friends And Related Function Documentation

template<typename GUM_SCALAR>
friend class PRMFactory< GUM_SCALAR >
friend

Definition at line 66 of file PRMType.h.

Member Data Documentation

template<typename GUM_SCALAR>
std::vector< Idx >* gum::prm::PRMType< GUM_SCALAR >::__label_map
private

A vector in which the i-th element is the Idx of the super type's label for the i-th label of this.

Definition at line 278 of file PRMType.h.

Referenced by gum::prm::PRMType< GUM_SCALAR >::__isValid(), gum::prm::PRMFactory< GUM_SCALAR >::addLabel(), gum::prm::PRMType< GUM_SCALAR >::label_map(), gum::prm::PRMType< GUM_SCALAR >::PRMType(), and gum::prm::PRMType< GUM_SCALAR >::~PRMType().


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