![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
#include <PRMAggregate.h>
Public Member Functions | |
Constructor & destructor. | |
PRMAggregate (const std::string &name, AggregateType aggType, const PRMType &rvType) | |
Default constructor. More... | |
PRMAggregate (const std::string &name, AggregateType aggType, const PRMType &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< Idx > | sharedLabel () 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... | |
bool | isDecomposable () const |
Returns true if the aggregator is decomposable. 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 & | type () |
See gum::PRMClassElement::type(). More... | |
virtual const PRMType & | 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 &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, AggregateType::SUM } |
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< 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... | |
Definition at line 69 of file PRMAggregate.h.
|
strong |
The different type of aggregates we can have.
Enumerator | |
---|---|
MIN | |
MAX | |
COUNT | |
EXISTS | |
FORALL | |
OR | |
AND | |
AMPLITUDE | |
MEDIAN | |
SUM |
Definition at line 79 of file PRMAggregate.h.
|
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.
|
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.
gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate | ( | const std::string & | name, |
AggregateType | aggType, | ||
const PRMType & | rvType | ||
) |
Default constructor.
name | The name of this aggregate. |
aggType | The aggregate type of this aggregate. |
rvType | The random variable type of this aggregate, which is copied. |
Definition at line 46 of file PRMAggregate_tpl.h.
gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate | ( | const std::string & | name, |
AggregateType | aggType, | ||
const PRMType & | rvType, | ||
Idx | label | ||
) |
Default constructor.
name | The name of this aggregate. |
aggType | The aggregate type of this aggregate. |
rvType | The random variable type of this aggregate, which is copied. |
label | The index of the label on which this aggregate applies. |
Definition at line 58 of file PRMAggregate_tpl.h.
|
virtual |
Destructor.
Definition at line 71 of file PRMAggregate_tpl.h.
|
private |
Copy constructor. Don't use it.
Definition at line 77 of file PRMAggregate_tpl.h.
|
virtual |
See gum::PRMClassElement::addChild_().
Implements gum::prm::PRMClassElement< GUM_SCALAR >.
Definition at line 233 of file PRMAggregate_tpl.h.
|
virtual |
See gum::PRMClassElement::addParent_().
Implements gum::prm::PRMClassElement< GUM_SCALAR >.
Definition at line 229 of file PRMAggregate_tpl.h.
INLINE PRMAggregate< GUM_SCALAR >::AggregateType gum::prm::PRMAggregate< GUM_SCALAR >::agg_type | ( | ) | const |
Returns the aggregate of *this.
Definition at line 97 of file PRMAggregate_tpl.h.
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 187 of file PRMAggregate_tpl.h.
|
virtualinherited |
Returns the name of the cast descendant with PRMType t of this PRMClassElement.
t | The type in which we want to cast this PRMClassElement. |
OperationNotAllowed | If the cast is impossible. |
Definition at line 71 of file PRMClassElement_tpl.h.
|
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 177 of file PRMAggregate_tpl.h.
|
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 182 of file PRMAggregate_tpl.h.
|
virtual |
See gum::PRMClassElement::elt_type().
Implements gum::prm::PRMClassElement< GUM_SCALAR >.
Definition at line 91 of file PRMAggregate_tpl.h.
|
inlinestaticinherited |
|
inlinestaticinherited |
Returns true if obj_ptr is of type PRMReferenceSlot.
Definition at line 103 of file PRMClassElement.h.
|
virtual |
See gum::PRMClassElement::elt_type().
Implements gum::prm::PRMClassElement< GUM_SCALAR >.
Definition at line 236 of file PRMAggregate_tpl.h.
INLINE bool gum::prm::PRMAggregate< GUM_SCALAR >::hasLabel | ( | ) | const |
Returns true if the label is defined.
Definition at line 123 of file PRMAggregate_tpl.h.
|
inherited |
Returns the NodeId of this element in it's class DAG.
Definition at line 51 of file PRMClassElement_tpl.h.
|
inlinestaticinherited |
|
inlinestaticinherited |
Returns true if obj_ptr is of type Class.
Definition at line 109 of file PRMObject.h.
References gum::prm::PRMObject::PRMObject().
INLINE bool gum::prm::PRMAggregate< GUM_SCALAR >::isDecomposable | ( | ) | const |
Returns true if the aggregator is decomposable.
Definition at line 128 of file PRMAggregate_tpl.h.
Returns true if obj_ptr is of type PRMInstance.
Definition at line 117 of file PRMObject.h.
References gum::prm::PRMObject::PRMObject().
Returns true if obj_ptr is of type PRMInterface.
Definition at line 112 of file PRMObject.h.
References gum::prm::PRMObject::PRMObject().
|
inlinestaticinherited |
|
inlinestaticinherited |
Returns true if obj_ptr is of type PRMReferenceSlot.
Definition at line 126 of file PRMClassElement.h.
|
inlinestaticinherited |
INLINE Idx gum::prm::PRMAggregate< GUM_SCALAR >::label | ( | ) | const |
Returns the label's index on which this aggregate applies.
OperationNotAllowed | Raised if the aggregate does not applies on a label. |
Definition at line 102 of file PRMAggregate_tpl.h.
INLINE const std::string & gum::prm::PRMAggregate< GUM_SCALAR >::labelValue | ( | ) | const |
See gum::PRMClassElement::elt_type().
Definition at line 108 of file PRMAggregate_tpl.h.
|
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.
|
inherited |
Returns the name of this object.
Definition at line 34 of file PRMObject_inl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
inherited |
Change the name of the PRM Object.
Definition at line 38 of file PRMObject_inl.h.
References gum::prm::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
virtualinherited |
Implements gum::prm::PRMObject.
Definition at line 56 of file PRMClassElement_tpl.h.
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::ParamScopeData< GUM_SCALAR >::ParamScopeData().
|
private |
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().
|
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.
|
inherited |
Returns the safe name of this PRMClassElement, if any.
This will only work if this PRMClassElement is an PRMAttribute or an PRMAggregate.
NotFound& | Raised if this PRMClassElement does not have any safe name. |
Definition at line 66 of file PRMClassElement_tpl.h.
|
virtualinherited |
Used to assign the id of this element.
Definition at line 61 of file PRMClassElement_tpl.h.
INLINE void gum::prm::PRMAggregate< GUM_SCALAR >::setLabel | ( | Idx | idx | ) |
Set the aggregator's label.
Definition at line 113 of file PRMAggregate_tpl.h.
INLINE void gum::prm::PRMAggregate< GUM_SCALAR >::setLabel | ( | const std::string & | label | ) |
See gum::PRMClassElement::elt_type().
Definition at line 118 of file PRMAggregate_tpl.h.
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 262 of file PRMAggregate_tpl.h.
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 267 of file PRMAggregate_tpl.h.
|
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.
Raise | NotFound exception if no matches is found. |
Definition at line 101 of file PRMAggregate.h.
|
virtual |
See gum::PRMClassElement::type().
Implements gum::prm::PRMClassElement< GUM_SCALAR >.
Definition at line 167 of file PRMAggregate_tpl.h.
|
virtual |
See gum::PRMClassElement::type().
Implements gum::prm::PRMClassElement< GUM_SCALAR >.
Definition at line 172 of file PRMAggregate_tpl.h.
|
friend |
Definition at line 70 of file PRMAggregate.h.
|
private |
The AggregateType of this aggregate.
Definition at line 265 of file PRMAggregate.h.
|
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 274 of file PRMAggregate.h.
|
private |
The AggregateType of this aggregate.
Definition at line 276 of file PRMAggregate.h.
|
private |
The random variable type of this aggregate It is deleted with the aggregate.
Definition at line 269 of file PRMAggregate.h.
|
protectedinherited |
The safe name of this PRMClassElement.
Definition at line 265 of file PRMClassElement.h.