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

#include <PRMAggregate.h>

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

Public Member Functions

Constructor & destructor.
 PRMAggregate (const std::string &name, AggregateType aggType, const PRMType< GUM_SCALAR > &rvType)
 Default constructor. More...
 
 PRMAggregate (const std::string &name, AggregateType aggType, const PRMType< GUM_SCALAR > &rvType, Idx label)
 Default constructor. More...
 
virtual ~PRMAggregate ()
 Destructor. More...
 
Getters and Setters.
virtual PRMClassElement< GUM_SCALAR >::ClassElementType elt_type () const
 See gum::PRMClassElement::elt_type(). More...
 
AggregateType agg_type () const
 Returns the aggregate of *this. More...
 
Idx label () const
 Returns the label's index on which this aggregate applies. More...
 
const std::string & labelValue () const
 See gum::PRMClassElement::elt_type(). More...
 
std::shared_ptr< IdxsharedLabel () const
 Returns the shared_ptr holding this Aggregate label. More...
 
void sharedLabel (std::shared_ptr< Idx > label)
 Sets the shared_ptr of this Aggregate. More...
 
void setLabel (Idx idx)
 Set the aggregator's label. More...
 
void setLabel (const std::string &label)
 See gum::PRMClassElement::elt_type(). More...
 
bool hasLabel () const
 Returns true if the label is defined. More...
 
virtual void addParent (const PRMClassElement< GUM_SCALAR > &elt)
 See gum::PRMClassElement::_addParent(). More...
 
virtual void addChild (const PRMClassElement< GUM_SCALAR > &elt)
 See gum::PRMClassElement::_addChild(). More...
 
virtual PRMType< GUM_SCALAR > & type ()
 See gum::PRMClassElement::type(). More...
 
virtual const PRMType< GUM_SCALAR > & type () const
 See gum::PRMClassElement::type(). More...
 
virtual Potential< GUM_SCALAR > & cpf ()
 Aggregates don't have Potential until they are instantiated as PRMAttribute, so this will raise an OperationNotAllowed exception. More...
 
virtual const Potential< GUM_SCALAR > & cpf () const
 Aggregates don't have Potential until they are instantiated as PRMAttribute, so this will raise an OperationNotAllowed exception. More...
 
MultiDimImplementation< GUM_SCALAR > * buildImpl () const
 Returns a pointer over an empty gum::MultiDimImplementation of the good type for this PRMAggregate. More...
 
virtual PRMAttribute< GUM_SCALAR > * getCastDescendant () const
 See gum::PRMClassElement::elt_type(). 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< GUM_SCALAR > &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...
 

Friends

class PRMClass< GUM_SCALAR >
 

Built-in types.

enum  AggregateType : char {
  AggregateType::MIN, AggregateType::MAX, AggregateType::COUNT, AggregateType::EXISTS,
  AggregateType::FORALL, AggregateType::OR, AggregateType::AND, AggregateType::AMPLITUDE,
  AggregateType::MEDIAN
}
 The different type of aggregates we can have. More...
 
static AggregateType str2enum (const std::string &str)
 Static method which returns the AggregateType given its string representation. 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 &elt)
 Returns true if obj_ptr is of type PRMReferenceSlot. More...
 
static INLINE bool isAttribute (const PRMClassElement &elt)
 Returns true if obj_ptr is of type PRMAttribute. More...
 
static INLINE bool isAggregate (const PRMClassElement &elt)
 Return true if obj is of type PRMAggregate. More...
 
static INLINE bool isSlotChain (const PRMClassElement &elt)
 Return true if obj is of type PRMSlotChain. More...
 
static INLINE bool isParameter (const PRMClassElement &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...
 

Detailed Description

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

Definition at line 58 of file PRMAggregate.h.

Member Enumeration Documentation

template<typename GUM_SCALAR>
enum gum::prm::PRMAggregate::AggregateType : char
strong

The different type of aggregates we can have.

Enumerator
MIN 
MAX 
COUNT 
EXISTS 
FORALL 
OR 
AND 
AMPLITUDE 
MEDIAN 

Definition at line 68 of file PRMAggregate.h.

68  : char {
69  MIN,
70  MAX,
71  COUNT,
72  EXISTS,
73  FORALL,
74  OR,
75  AND,
76  AMPLITUDE,
77  MEDIAN
78  };
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 90 of file PRMClassElement.h.

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::PRMAggregate< GUM_SCALAR >::PRMAggregate ( const std::string &  name,
AggregateType  aggType,
const PRMType< GUM_SCALAR > &  rvType 
)

Default constructor.

Parameters
nameThe name of this aggregate.
aggTypeThe aggregate type of this aggregate.
rvTypeThe random variable type of this aggregate, which is copied.

Definition at line 48 of file PRMAggregate_tpl.h.

References gum::prm::PRMAggregate< GUM_SCALAR >::__type, gum::prm::PRMClassElement< GUM_SCALAR >::_safeName, gum::prm::PRMObject::LEFT_CAST(), gum::prm::PRMObject::name(), and gum::prm::PRMObject::RIGHT_CAST().

Referenced by gum::prm::PRMAggregate< double >::str2enum().

50  :
51  PRMClassElement< GUM_SCALAR >(name),
52  __agg_type(aggType), __type(new PRMType< GUM_SCALAR >(rvType)),
53  __label(std::shared_ptr< Idx >(new Idx(INT_MAX))) {
54  GUM_CONSTRUCTOR(PRMAggregate);
55  this->_safeName =
57  this->__type->variable().setName(name);
58  }
PRMAggregate(const std::string &name, AggregateType aggType, const PRMType< GUM_SCALAR > &rvType)
Default constructor.
AggregateType __agg_type
The AggregateType of this aggregate.
Definition: PRMAggregate.h:248
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:32
std::shared_ptr< Idx > __label
Some aggregators applies only on a given label. This attribute must have the concerned Idx...
Definition: PRMAggregate.h:257
PRMType< GUM_SCALAR > * __type
The random variable type of this aggregate It is deleted with the aggregate.
Definition: PRMAggregate.h:252
static std::string LEFT_CAST()
Enumeration of the different types of objects handled by a PRM.
Definition: PRMObject.h:76
unsigned long Idx
Type for indexes.
Definition: types.h:43
static std::string RIGHT_CAST()
Enumeration of the different types of objects handled by a PRM.
Definition: PRMObject.h:77
std::string _safeName
The safe name of this PRMClassElement.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename GUM_SCALAR>
gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate ( const std::string &  name,
AggregateType  aggType,
const PRMType< GUM_SCALAR > &  rvType,
Idx  label 
)

Default constructor.

Parameters
nameThe name of this aggregate.
aggTypeThe aggregate type of this aggregate.
rvTypeThe random variable type of this aggregate, which is copied.
labelThe index of the label on which this aggregate applies.

Definition at line 61 of file PRMAggregate_tpl.h.

References gum::prm::PRMAggregate< GUM_SCALAR >::__type, gum::prm::PRMClassElement< GUM_SCALAR >::_safeName, gum::prm::PRMObject::LEFT_CAST(), gum::prm::PRMObject::name(), and gum::prm::PRMObject::RIGHT_CAST().

64  :
65  PRMClassElement< GUM_SCALAR >(name),
66  __agg_type(aggType), __type(new PRMType< GUM_SCALAR >(rvType)),
67  __label(std::shared_ptr< Idx >(new Idx(label))) {
68  GUM_CONSTRUCTOR(PRMAggregate);
69  this->_safeName =
71  this->__type->variable().setName(name);
72  }
PRMAggregate(const std::string &name, AggregateType aggType, const PRMType< GUM_SCALAR > &rvType)
Default constructor.
AggregateType __agg_type
The AggregateType of this aggregate.
Definition: PRMAggregate.h:248
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:32
std::shared_ptr< Idx > __label
Some aggregators applies only on a given label. This attribute must have the concerned Idx...
Definition: PRMAggregate.h:257
PRMType< GUM_SCALAR > * __type
The random variable type of this aggregate It is deleted with the aggregate.
Definition: PRMAggregate.h:252
static std::string LEFT_CAST()
Enumeration of the different types of objects handled by a PRM.
Definition: PRMObject.h:76
unsigned long Idx
Type for indexes.
Definition: types.h:43
static std::string RIGHT_CAST()
Enumeration of the different types of objects handled by a PRM.
Definition: PRMObject.h:77
std::string _safeName
The safe name of this PRMClassElement.
Idx label() const
Returns the label&#39;s index on which this aggregate applies.

+ Here is the call graph for this function:

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

Destructor.

Definition at line 75 of file PRMAggregate_tpl.h.

References gum::prm::PRMAggregate< GUM_SCALAR >::__type.

Referenced by gum::prm::PRMAggregate< double >::str2enum().

75  {
76  GUM_DESTRUCTOR(PRMAggregate);
77  delete __type;
78  }
PRMAggregate(const std::string &name, AggregateType aggType, const PRMType< GUM_SCALAR > &rvType)
Default constructor.
PRMType< GUM_SCALAR > * __type
The random variable type of this aggregate It is deleted with the aggregate.
Definition: PRMAggregate.h:252

+ Here is the caller graph for this function:

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

Copy constructor. Don't use it.

Definition at line 81 of file PRMAggregate_tpl.h.

References GUM_ERROR, and gum::prm::PRMAggregate< GUM_SCALAR >::operator=().

82  :
83  PRMClassElement< GUM_SCALAR >(source) {
84  GUM_CONS_CPY(PRMAggregate);
85  GUM_ERROR(FatalError, "illegal call to gum::PRMAggregate copy constructor.");
86  }
PRMAggregate(const std::string &name, AggregateType aggType, const PRMType< GUM_SCALAR > &rvType)
Default constructor.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the call graph for this function:

Member Function Documentation

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

See gum::PRMClassElement::_addChild().

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

Definition at line 195 of file PRMAggregate_tpl.h.

Referenced by gum::prm::PRMAggregate< double >::str2enum().

196  {}

+ Here is the caller graph for this function:

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

See gum::PRMClassElement::_addParent().

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

Definition at line 190 of file PRMAggregate_tpl.h.

Referenced by gum::prm::PRMAggregate< double >::str2enum().

191  {}

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE PRMAggregate< GUM_SCALAR >::AggregateType gum::prm::PRMAggregate< GUM_SCALAR >::agg_type ( ) const

Returns the aggregate of *this.

Definition at line 102 of file PRMAggregate_tpl.h.

References gum::prm::PRMAggregate< GUM_SCALAR >::__agg_type.

Referenced by gum::prm::PRMFactory< GUM_SCALAR >::__addParent(), gum::prm::PRMSlotChain< GUM_SCALAR >::__copyLastElt(), gum::prm::PRMSystem< GUM_SCALAR >::__groundAgg(), gum::prm::PRMAggregate< GUM_SCALAR >::buildImpl(), and gum::prm::PRMAggregate< double >::str2enum().

102  {
103  return __agg_type;
104  }
AggregateType __agg_type
The AggregateType of this aggregate.
Definition: PRMAggregate.h:248

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE MultiDimImplementation< GUM_SCALAR > * gum::prm::PRMAggregate< GUM_SCALAR >::buildImpl ( ) const

Returns a pointer over an empty gum::MultiDimImplementation of the good type for this PRMAggregate.

This should be use when manipulating instantiations of aggregates.

Definition at line 154 of file PRMAggregate_tpl.h.

References gum::prm::PRMAggregate< GUM_SCALAR >::agg_type(), gum::prm::PRMAggregate< GUM_SCALAR >::AMPLITUDE, gum::prm::PRMAggregate< GUM_SCALAR >::AND, gum::prm::PRMAggregate< GUM_SCALAR >::COUNT, gum::prm::PRMAggregate< GUM_SCALAR >::EXISTS, gum::prm::PRMAggregate< GUM_SCALAR >::FORALL, GUM_ERROR, gum::prm::PRMAggregate< GUM_SCALAR >::label(), gum::prm::PRMAggregate< GUM_SCALAR >::MAX, gum::prm::PRMAggregate< GUM_SCALAR >::MEDIAN, gum::prm::PRMAggregate< GUM_SCALAR >::MIN, and gum::prm::PRMAggregate< GUM_SCALAR >::OR.

Referenced by gum::prm::PRMInstance< GUM_SCALAR >::__copyAggregates(), gum::prm::PRMFactory< GUM_SCALAR >::addAggregator(), and gum::prm::PRMAggregate< double >::str2enum().

154  {
155  switch (agg_type()) {
156  case AggregateType::MIN: {
157  return new aggregator::Min< GUM_SCALAR >();
158  }
159  case AggregateType::MAX: {
160  return new aggregator::Max< GUM_SCALAR >();
161  }
162  case AggregateType::OR: {
163  return new aggregator::Or< GUM_SCALAR >();
164  }
165  case AggregateType::AND: {
166  return new aggregator::And< GUM_SCALAR >();
167  }
169  return new aggregator::Amplitude< GUM_SCALAR >();
170  }
171  case AggregateType::MEDIAN: {
172  return new aggregator::Median< GUM_SCALAR >();
173  }
174  case AggregateType::EXISTS: {
175  return new aggregator::Exists< GUM_SCALAR >(label());
176  }
177  case AggregateType::FORALL: {
178  return new aggregator::Forall< GUM_SCALAR >(label());
179  }
180  case AggregateType::COUNT: {
181  return new aggregator::Count< GUM_SCALAR >(label());
182  }
183  default: { GUM_ERROR(OperationNotAllowed, "Unknown aggregator."); }
184  }
185  return nullptr;
186  }
AggregateType agg_type() const
Returns the aggregate of *this.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66
Idx label() const
Returns the label&#39;s index on which this aggregate applies.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename GUM_SCALAR>
INLINE std::string gum::prm::PRMClassElement< GUM_SCALAR >::cast ( const PRMType< GUM_SCALAR > &  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 71 of file PRMClassElement_tpl.h.

References GUM_ERROR, gum::prm::PRMObject::LEFT_CAST(), gum::prm::PRMObject::name(), gum::prm::PRMType< GUM_SCALAR >::name(), gum::prm::PRMObject::RIGHT_CAST(), and gum::prm::PRMClassElement< GUM_SCALAR >::type().

Referenced by gum::prm::PRMFactory< GUM_SCALAR >::addNoisyOrCompound(), gum::prm::PRMFormAttribute< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMAggregate< GUM_SCALAR >::getCastDescendant(), and gum::prm::PRMClassElement< double >::isParameter().

71  {
72  if (type().isSubTypeOf(t)) {
73  return PRMObject::LEFT_CAST() + t.name() + PRMObject::RIGHT_CAST()
74  + name();
75  } else {
76  GUM_ERROR(OperationNotAllowed, "illegal cast");
77  }
78  }
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:32
static std::string LEFT_CAST()
Enumeration of the different types of objects handled by a PRM.
Definition: PRMObject.h:76
static std::string RIGHT_CAST()
Enumeration of the different types of objects handled by a PRM.
Definition: PRMObject.h:77
virtual PRMType< GUM_SCALAR > & type()=0
Return a reference over the gum::PRMType of this class element.
#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 Potential< GUM_SCALAR > & gum::prm::PRMAggregate< GUM_SCALAR >::cpf ( )
virtual

Aggregates don't have Potential until they are instantiated as PRMAttribute, so this will raise an OperationNotAllowed exception.

See gum::PRMClassElement::cpf().

Definition at line 143 of file PRMAggregate_tpl.h.

References GUM_ERROR.

Referenced by gum::prm::PRMAggregate< double >::str2enum().

143  {
144  GUM_ERROR(OperationNotAllowed, "This is an aggregate.");
145  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the caller graph for this function:

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

Aggregates don't have Potential until they are instantiated as PRMAttribute, so this will raise an OperationNotAllowed exception.

See gum::PRMClassElement::cpf().

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

Definition at line 148 of file PRMAggregate_tpl.h.

References GUM_ERROR.

148  {
149  GUM_ERROR(OperationNotAllowed, "This is an aggregate.");
150  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66
template<typename GUM_SCALAR >
INLINE PRMClassElement< GUM_SCALAR >::ClassElementType gum::prm::PRMAggregate< GUM_SCALAR >::elt_type ( ) const
virtual

See gum::PRMClassElement::elt_type().

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

Definition at line 96 of file PRMAggregate_tpl.h.

References gum::prm::PRMClassElement< GUM_SCALAR >::prm_aggregate.

Referenced by gum::prm::PRMAggregate< double >::str2enum().

+ 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>
static std::string gum::prm::PRMClassElement< GUM_SCALAR >::enum2str ( ClassElementType  type)
inlinestaticinherited

Returns true if obj_ptr is of type PRMReferenceSlot.

Definition at line 98 of file PRMClassElement.h.

98  {
99  switch (type) {
100  case prm_attribute: return "prm_attribute";
101 
102  case prm_aggregate: return "prm_aggregate";
103 
104  case prm_refslot: return "prm_refslot";
105 
106  case prm_slotchain: return "prm_slotchain";
107 
108  case prm_parameter: return "prm_parameter";
109 
110  default: return "unknown";
111  }
112  }
virtual PRMType< GUM_SCALAR > & type()=0
Return a reference over the gum::PRMType of this class element.
template<typename GUM_SCALAR >
PRMAttribute< GUM_SCALAR > * gum::prm::PRMAggregate< GUM_SCALAR >::getCastDescendant ( ) const
virtual

See gum::PRMClassElement::elt_type().

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

Definition at line 200 of file PRMAggregate_tpl.h.

References gum::prm::PRMScalarAttribute< GUM_SCALAR >::addParent(), gum::prm::PRMClassElement< GUM_SCALAR >::cast(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::cpf(), GUM_ERROR, gum::prm::PRMObject::name(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::type(), and gum::prm::PRMAggregate< GUM_SCALAR >::type().

Referenced by gum::prm::PRMAggregate< double >::str2enum().

200  {
201  PRMScalarAttribute< GUM_SCALAR >* cast = 0;
202 
203  try {
204  cast =
205  new PRMScalarAttribute< GUM_SCALAR >(this->name(), type().superType());
206  } catch (NotFound&) {
207  GUM_ERROR(OperationNotAllowed,
208  "this PRMAggregate can not have cast descendant");
209  }
210 
211  cast->addParent(*this);
212  const DiscreteVariable& my_var = type().variable();
213  DiscreteVariable& cast_var = cast->type().variable();
214  Instantiation inst(cast->cpf());
215 
216  for (inst.setFirst(); !inst.end(); inst.inc()) {
217  if (type().label_map()[inst.val(my_var)] == inst.val(cast_var)) {
218  cast->cpf().set(inst, 1);
219  } else {
220  cast->cpf().set(inst, 0);
221  }
222  }
223 
224  return cast;
225  }
virtual PRMType< GUM_SCALAR > & type()
See gum::PRMClassElement::type().
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:32
virtual std::string cast(const PRMType< GUM_SCALAR > &t) const
Returns the name of the cast descendant with PRMType t of this PRMClassElement.
#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 bool gum::prm::PRMAggregate< GUM_SCALAR >::hasLabel ( ) const

Returns true if the label is defined.

Definition at line 128 of file PRMAggregate_tpl.h.

References gum::prm::PRMAggregate< GUM_SCALAR >::__label.

Referenced by gum::prm::PRMFactory< GUM_SCALAR >::__addParent(), and gum::prm::PRMAggregate< double >::str2enum().

128  {
129  return *__label != INT_MAX;
130  }
std::shared_ptr< Idx > __label
Some aggregators applies only on a given label. This attribute must have the concerned Idx...
Definition: PRMAggregate.h:257

+ Here is the caller graph for this function:

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 50 of file PRMClassElement_tpl.h.

References gum::prm::PRMClassElement< GUM_SCALAR >::__id.

Referenced by gum::prm::PRMClass< GUM_SCALAR >::__addCastDescendants(), gum::prm::PRMInterface< GUM_SCALAR >::__addCastDescendants(), gum::prm::PRMClass< GUM_SCALAR >::__checkInterface(), gum::prm::PRMClass< GUM_SCALAR >::__checkRefInterface(), gum::prm::PRMInstance< GUM_SCALAR >::__copyAggregates(), gum::prm::PRMInstance< GUM_SCALAR >::__copyAttribute(), gum::prm::PRMSlotChain< GUM_SCALAR >::__copyLastElt(), gum::prm::SVE< GUM_SCALAR >::__getAggPotential(), gum::prm::PRMSystem< GUM_SCALAR >::__groundPotential(), gum::prm::PRMClass< GUM_SCALAR >::__inheritClass(), gum::prm::InstanceBayesNet< GUM_SCALAR >::__init(), gum::prm::ClassBayesNet< GUM_SCALAR >::__init(), gum::prm::PRMInstance< GUM_SCALAR >::__instantiateSlotChain(), 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::SVED< GUM_SCALAR >::_marginal(), gum::prm::SVE< GUM_SCALAR >::_marginal(), gum::prm::PRMInterface< GUM_SCALAR >::add(), gum::prm::PRMClass< GUM_SCALAR >::add(), gum::prm::PRMClass< GUM_SCALAR >::addArc(), gum::prm::PRMClass< GUM_SCALAR >::inheritAggregates(), gum::prm::PRMClassElement< double >::isParameter(), gum::prm::PRMInterface< GUM_SCALAR >::overload(), gum::prm::PRMClass< GUM_SCALAR >::overload(), gum::prm::PRMClassElement< GUM_SCALAR >::setId(), and gum::prm::PRMFactory< GUM_SCALAR >::startAttribute().

50  {
51  return __id;
52  }
NodeId __id
The node&#39;s id of this element.

+ Here is the caller graph for this function:

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 125 of file PRMClassElement.h.

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

125  {
126  return elt.elt_type() == prm_aggregate;
127  }

+ Here is the caller graph for this function:

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 120 of file PRMClassElement.h.

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

120  {
121  return elt.elt_type() == prm_attribute;
122  }

+ 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>
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 135 of file PRMClassElement.h.

135  {
136  return elt.elt_type() == prm_parameter;
137  }
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 115 of file PRMClassElement.h.

115  {
116  return elt.elt_type() == prm_refslot;
117  }
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 130 of file PRMClassElement.h.

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

130  {
131  return elt.elt_type() == prm_slotchain;
132  }

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE Idx gum::prm::PRMAggregate< GUM_SCALAR >::label ( ) const

Returns the label's index on which this aggregate applies.

Exceptions
OperationNotAllowedRaised if the aggregate does not applies on a label.

Definition at line 107 of file PRMAggregate_tpl.h.

References gum::prm::PRMAggregate< GUM_SCALAR >::__label, and GUM_ERROR.

Referenced by gum::prm::PRMSystem< GUM_SCALAR >::__groundAgg(), gum::prm::PRMFactory< GUM_SCALAR >::addAggregator(), gum::prm::PRMAggregate< GUM_SCALAR >::buildImpl(), gum::prm::PRMAggregate< GUM_SCALAR >::sharedLabel(), and gum::prm::PRMAggregate< double >::str2enum().

107  {
108  if (*__label != INT_MAX) return *__label;
109  GUM_ERROR(OperationNotAllowed, "no label defined for this aggregate");
110  }
std::shared_ptr< Idx > __label
Some aggregators applies only on a given label. This attribute must have the concerned Idx...
Definition: PRMAggregate.h:257
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE const std::string & gum::prm::PRMAggregate< GUM_SCALAR >::labelValue ( ) const

See gum::PRMClassElement::elt_type().

Definition at line 113 of file PRMAggregate_tpl.h.

References gum::prm::PRMAggregate< GUM_SCALAR >::__label_value.

Referenced by gum::prm::PRMFactory< GUM_SCALAR >::__addParent(), and gum::prm::PRMAggregate< double >::str2enum().

113  {
114  return __label_value;
115  }
std::string __label_value
The AggregateType of this aggregate.
Definition: PRMAggregate.h:259

+ 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 const std::string & gum::prm::PRMObject::name ( ) const
inherited

Returns the name of this object.

Definition at line 32 of file PRMObject_inl.h.

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

Referenced by gum::prm::SVE< GUM_SCALAR >::__addDelayedVariable(), gum::prm::PRMClass< GUM_SCALAR >::__addIOInterfaceFlags(), gum::prm::PRMFactory< GUM_SCALAR >::__addParent(), gum::prm::PRMInstance< GUM_SCALAR >::__addReferingInstance(), gum::prm::PRMClass< GUM_SCALAR >::__checkInterface(), gum::prm::PRMFactory< GUM_SCALAR >::__checkInterfaceImplementation(), gum::prm::PRMClass< GUM_SCALAR >::__checkInterfaces(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__checkRawCPT(), gum::prm::PRMClass< GUM_SCALAR >::__checkRefInterface(), gum::prm::PRMClass< GUM_SCALAR >::__checkRefInterfaces(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__checkRuleCPTSumsTo1(), gum::prm::PRMInstance< GUM_SCALAR >::__copyAggregates(), gum::prm::PRMInstance< GUM_SCALAR >::__copyAttribute(), gum::prm::PRMSlotChain< GUM_SCALAR >::__copyLastElt(), gum::prm::PRMSystem< GUM_SCALAR >::__groundAttr(), gum::prm::PRMSystem< GUM_SCALAR >::__groundPotential(), gum::prm::PRMSystem< GUM_SCALAR >::__groundRef(), gum::prm::PRMClass< GUM_SCALAR >::__inheritClass(), gum::prm::PRMInterface< GUM_SCALAR >::__overloadAttribute(), gum::prm::PRMClass< GUM_SCALAR >::__overloadAttribute(), gum::prm::PRMClass< GUM_SCALAR >::__overloadParameter(), gum::prm::PRMClass< GUM_SCALAR >::__overloadReference(), gum::prm::PRMInterface< GUM_SCALAR >::__overloadReferenceSlot(), gum::prm::__print_attribute__(), gum::prm::__print_instance__(), gum::prm::gspan::StrictSearch< GUM_SCALAR >::__str(), gum::prm::StructuredInference< GUM_SCALAR >::__str(), gum::prm::PRMInterface< GUM_SCALAR >::add(), gum::prm::PRMSystem< GUM_SCALAR >::add(), gum::prm::PRMClass< GUM_SCALAR >::add(), gum::prm::PRMFactory< GUM_SCALAR >::addAggregator(), gum::prm::PRMFormAttribute< GUM_SCALAR >::addParent(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::addParent(), gum::prm::PRMClassElement< GUM_SCALAR >::cast(), gum::prm::PRMClass< GUM_SCALAR >::completeInheritance(), gum::prm::PRMFormAttribute< GUM_SCALAR >::copy(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::copy(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::exists(), gum::prm::o3prmr::O3prmrInterpreter::findAttributeName(), gum::prm::o3prmr::O3prmrInterpreter::findInstanceName(), gum::prm::PRMInterface< GUM_SCALAR >::get(), gum::prm::PRMSystem< GUM_SCALAR >::get(), gum::prm::PRMClass< GUM_SCALAR >::get(), gum::prm::PRMSystem< GUM_SCALAR >::getArray(), gum::prm::PRMSystem< GUM_SCALAR >::getArrayType(), gum::prm::PRMFormAttribute< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMAggregate< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMSystem< GUM_SCALAR >::groundedBN(), gum::prm::PRMClass< GUM_SCALAR >::inheritAggregates(), gum::prm::PRMClass< GUM_SCALAR >::isCastDescendant(), gum::prm::PRMObject::isInstance(), gum::prm::PRMObject::name(), gum::prm::PRMType< GUM_SCALAR >::name(), gum::prm::PRMFormAttribute< GUM_SCALAR >::newFactory(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::newFactory(), gum::prm::PRMType< GUM_SCALAR >::operator!=(), gum::prm::PRMObject::operator!=(), operator<<(), gum::prm::PRMType< GUM_SCALAR >::operator==(), gum::prm::PRMObject::operator==(), gum::prm::PRMInterface< GUM_SCALAR >::operator[](), gum::prm::PRMClass< GUM_SCALAR >::operator[](), gum::prm::PRMInterface< GUM_SCALAR >::overload(), gum::prm::PRMClass< GUM_SCALAR >::overload(), gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), gum::prm::PRMParameter< GUM_SCALAR >::PRMParameter(), gum::prm::PRMReferenceSlot< GUM_SCALAR >::PRMReferenceSlot(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::PRMScalarAttribute(), gum::prm::PRMSlotChain< GUM_SCALAR >::PRMSlotChain(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::setInputNode(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::setOutputNode(), and gum::prm::PRMAggregate< double >::str2enum().

32 { return __name; }
std::string __name
Definition: PRMObject.h:197
INLINE void gum::prm::PRMObject::name ( const std::string &  name)
inherited

Change the name of the PRM Object.

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

Definition at line 36 of file PRMObject_inl.h.

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

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

+ Here is the call graph for this function:

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

Implements gum::prm::PRMObject.

Definition at line 55 of file PRMClassElement_tpl.h.

References gum::prm::PRMObject::CLASS_ELT.

Referenced by gum::prm::PRMClassElement< double >::isParameter().

+ 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 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 >
PRMAggregate< GUM_SCALAR > & gum::prm::PRMAggregate< GUM_SCALAR >::operator= ( const PRMAggregate< GUM_SCALAR > &  source)
private

Copy operator. Don't use it.

Definition at line 90 of file PRMAggregate_tpl.h.

References GUM_ERROR.

Referenced by gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), and gum::prm::PRMAggregate< double >::str2enum().

90  {
91  GUM_ERROR(FatalError, "illegal call to gum::PRMAggregate copy operator.");
92  }
#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:

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 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 65 of file PRMClassElement_tpl.h.

References gum::prm::PRMClassElement< GUM_SCALAR >::_safeName.

Referenced by gum::prm::PRMClass< GUM_SCALAR >::__addCastDescendants(), gum::prm::PRMInterface< GUM_SCALAR >::__addCastDescendants(), gum::prm::PRMFactory< GUM_SCALAR >::__addParent(), gum::prm::PRMInstance< GUM_SCALAR >::__copyAttributeCPF(), gum::prm::SVED< GUM_SCALAR >::__getAggPotential(), gum::prm::PRMSystem< GUM_SCALAR >::__groundPotential(), gum::prm::PRMSystem< GUM_SCALAR >::__groundRef(), gum::prm::PRMClass< GUM_SCALAR >::__inheritClass(), gum::prm::PRMClass< GUM_SCALAR >::__overloadAggregate(), 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::gspan::StrictSearch< GUM_SCALAR >::__str(), gum::prm::StructuredInference< GUM_SCALAR >::__str(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::_getIOFlag(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::_setIOFlag(), gum::prm::PRMInterface< GUM_SCALAR >::add(), gum::prm::PRMClass< GUM_SCALAR >::add(), gum::prm::PRMFactory< GUM_SCALAR >::addAggregator(), gum::prm::PRMFactory< GUM_SCALAR >::addAttribute(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::belongsTo(), gum::prm::PRMClass< GUM_SCALAR >::inheritAggregates(), gum::prm::PRMClassElement< double >::isParameter(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::setInputNode(), and gum::prm::PRMClassElementContainer< GUM_SCALAR >::setOutputNode().

65  {
66  return _safeName;
67  }
std::string _safeName
The safe name of this PRMClassElement.

+ Here is the caller graph for this function:

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 60 of file PRMClassElement_tpl.h.

References gum::prm::PRMClassElement< GUM_SCALAR >::__id, and gum::prm::PRMClassElement< GUM_SCALAR >::id().

Referenced by gum::prm::PRMClass< GUM_SCALAR >::__addCastDescendants(), gum::prm::PRMInterface< GUM_SCALAR >::__addCastDescendants(), gum::prm::PRMClass< GUM_SCALAR >::__checkInterface(), gum::prm::PRMClass< GUM_SCALAR >::__checkRefInterface(), gum::prm::PRMSlotChain< GUM_SCALAR >::__copyLastElt(), gum::prm::PRMClass< GUM_SCALAR >::__inheritClass(), gum::prm::PRMInterface< GUM_SCALAR >::__inheritInterface(), 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::PRMInterface< GUM_SCALAR >::add(), gum::prm::PRMClass< GUM_SCALAR >::add(), gum::prm::PRMClass< GUM_SCALAR >::inheritAggregates(), gum::prm::PRMClass< GUM_SCALAR >::inheritReferenceSlots(), and gum::prm::PRMClassElement< double >::isParameter().

60  {
61  __id = id;
62  }
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.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE void gum::prm::PRMAggregate< GUM_SCALAR >::setLabel ( Idx  idx)

Set the aggregator's label.

Definition at line 118 of file PRMAggregate_tpl.h.

Referenced by gum::prm::PRMFactory< GUM_SCALAR >::__addParent(), gum::prm::PRMClass< GUM_SCALAR >::inheritAggregates(), and gum::prm::PRMAggregate< double >::str2enum().

118  {
119  (*__label) = idx;
120  }

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE void gum::prm::PRMAggregate< GUM_SCALAR >::setLabel ( const std::string &  label)

See gum::PRMClassElement::elt_type().

Definition at line 123 of file PRMAggregate_tpl.h.

References gum::prm::PRMAggregate< GUM_SCALAR >::__label_value.

123  {
124  __label_value = value;
125  }
std::string __label_value
The AggregateType of this aggregate.
Definition: PRMAggregate.h:259
template<typename GUM_SCALAR >
INLINE std::shared_ptr< Idx > gum::prm::PRMAggregate< GUM_SCALAR >::sharedLabel ( ) const

Returns the shared_ptr holding this Aggregate label.

This is used for inherited Aggregates to share labels in O3PRM.

Definition at line 228 of file PRMAggregate_tpl.h.

References gum::prm::PRMAggregate< GUM_SCALAR >::__label.

Referenced by gum::prm::PRMClass< GUM_SCALAR >::inheritAggregates(), and gum::prm::PRMAggregate< double >::str2enum().

228  {
229  return __label;
230  }
std::shared_ptr< Idx > __label
Some aggregators applies only on a given label. This attribute must have the concerned Idx...
Definition: PRMAggregate.h:257

+ Here is the caller graph for this function:

template<typename GUM_SCALAR >
INLINE void gum::prm::PRMAggregate< GUM_SCALAR >::sharedLabel ( std::shared_ptr< Idx label)

Sets the shared_ptr of this Aggregate.

This is used for inherited aggregates to share labels in O3PRM.

Definition at line 234 of file PRMAggregate_tpl.h.

References gum::prm::PRMAggregate< GUM_SCALAR >::__label, and gum::prm::PRMAggregate< GUM_SCALAR >::label().

234  {
235  this->__label = label;
236  }
std::shared_ptr< Idx > __label
Some aggregators applies only on a given label. This attribute must have the concerned Idx...
Definition: PRMAggregate.h:257
Idx label() const
Returns the label&#39;s index on which this aggregate applies.

+ Here is the call graph for this function:

template<typename GUM_SCALAR>
static AggregateType gum::prm::PRMAggregate< GUM_SCALAR >::str2enum ( const std::string &  str)
inlinestatic

Static method which returns the AggregateType given its string representation.

We suppose that str is given either entirely in lower case or upper case. It will also match if only the first letter is in upper case.

Exceptions
RaiseNotFound exception if no matches is found.

Definition at line 88 of file PRMAggregate.h.

Referenced by gum::prm::PRMFactory< GUM_SCALAR >::addAggregator(), and gum::prm::PRMFactory< GUM_SCALAR >::startAggregator().

88  {
89  if (toLower(str) == "min") {
90  return AggregateType::MIN;
91  } else if (toLower(str) == "max") {
92  return AggregateType::MAX;
93  } else if (toLower(str) == "count") {
94  return AggregateType::COUNT;
95  } else if (toLower(str) == "exists") {
96  return AggregateType::EXISTS;
97  } else if (toLower(str) == "or") {
98  return AggregateType::OR;
99  } else if (toLower(str) == "and") {
100  return AggregateType::AND;
101  } else if (toLower(str) == "forall") {
102  return AggregateType::FORALL;
103  } else if (toLower(str) == "amplitude") {
105  } else if (toLower(str) == "median") {
106  return AggregateType::MEDIAN;
107  } else {
108  std::string msg = "Unknown aggregate: ";
109  msg.append(str);
110  GUM_ERROR(NotFound, msg);
111  }
112  }
std::string toLower(std::string str)
Returns the lowercase version of str.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:66

+ Here is the caller graph for this function:

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

See gum::PRMClassElement::type().

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

Definition at line 133 of file PRMAggregate_tpl.h.

References gum::prm::PRMAggregate< GUM_SCALAR >::__type.

Referenced by gum::prm::PRMInstance< GUM_SCALAR >::__copyAggregates(), gum::prm::PRMSlotChain< GUM_SCALAR >::__copyLastElt(), gum::prm::PRMClass< GUM_SCALAR >::__inheritClass(), gum::prm::PRMFactory< GUM_SCALAR >::addAggregator(), gum::prm::PRMAggregate< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMClass< GUM_SCALAR >::inheritAggregates(), and gum::prm::PRMAggregate< double >::str2enum().

133  {
134  return *__type;
135  }
PRMType< GUM_SCALAR > * __type
The random variable type of this aggregate It is deleted with the aggregate.
Definition: PRMAggregate.h:252

+ Here is the caller graph for this function:

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

See gum::PRMClassElement::type().

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

Definition at line 138 of file PRMAggregate_tpl.h.

References gum::prm::PRMAggregate< GUM_SCALAR >::__type.

138  {
139  return *__type;
140  }
PRMType< GUM_SCALAR > * __type
The random variable type of this aggregate It is deleted with the aggregate.
Definition: PRMAggregate.h:252

Friends And Related Function Documentation

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

Definition at line 59 of file PRMAggregate.h.

Member Data Documentation

template<typename GUM_SCALAR>
AggregateType gum::prm::PRMAggregate< GUM_SCALAR >::__agg_type
private

The AggregateType of this aggregate.

Definition at line 248 of file PRMAggregate.h.

Referenced by gum::prm::PRMAggregate< GUM_SCALAR >::agg_type().

template<typename GUM_SCALAR>
std::shared_ptr< Idx > gum::prm::PRMAggregate< GUM_SCALAR >::__label
private

Some aggregators applies only on a given label. This attribute must have the concerned Idx. If not initialized the pointer equals 0. It is deleted with the aggregate.

Definition at line 257 of file PRMAggregate.h.

Referenced by gum::prm::PRMAggregate< GUM_SCALAR >::hasLabel(), gum::prm::PRMAggregate< GUM_SCALAR >::label(), and gum::prm::PRMAggregate< GUM_SCALAR >::sharedLabel().

template<typename GUM_SCALAR>
std::string gum::prm::PRMAggregate< GUM_SCALAR >::__label_value
private

The AggregateType of this aggregate.

Definition at line 259 of file PRMAggregate.h.

Referenced by gum::prm::PRMAggregate< GUM_SCALAR >::labelValue(), and gum::prm::PRMAggregate< GUM_SCALAR >::setLabel().

template<typename GUM_SCALAR>
PRMType< GUM_SCALAR >* gum::prm::PRMAggregate< GUM_SCALAR >::__type
private

The random variable type of this aggregate It is deleted with the aggregate.

Definition at line 252 of file PRMAggregate.h.

Referenced by gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), gum::prm::PRMAggregate< GUM_SCALAR >::type(), and gum::prm::PRMAggregate< GUM_SCALAR >::~PRMAggregate().


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