29 #ifndef GUM_AGGREGATE_H 30 #define GUM_AGGREGATE_H 35 #include <agrum/tools/multidim/aggregators/multiDimAggregator.h> 36 #include <agrum/tools/multidim/implementations/multiDimImplementation.h> 37 #include <agrum/tools/multidim/potential.h> 39 #include <agrum/PRM/elements/PRMType.h> 40 #include <agrum/PRM/elements/PRMClassElement.h> 41 #include <agrum/PRM/elements/PRMAttribute.h> 42 #include <agrum/PRM/elements/PRMAggregate.h> 43 #include <agrum/PRM/elements/PRMScalarAttribute.h> 68 template <
typename GUM_SCALAR >
102 if (toLower(str) ==
"min") {
104 }
else if (toLower(str) ==
"max") {
106 }
else if (toLower(str) ==
"count") {
108 }
else if (toLower(str) ==
"exists") {
110 }
else if (toLower(str) ==
"or") {
112 }
else if (toLower(str) ==
"and") {
114 }
else if (toLower(str) ==
"forall") {
116 }
else if (toLower(str) ==
"amplitude") {
118 }
else if (toLower(str) ==
"median") {
120 }
else if (toLower(str) ==
"sum") {
123 std::string msg =
"Unknown aggregate: ";
125 GUM_ERROR(NotFound, msg)
154 const PRMType& rvType,
198 void setLabel(
const std::string& label);
211 virtual void addParent(
const PRMClassElement< GUM_SCALAR >& elt);
214 virtual void addChild(
const PRMClassElement< GUM_SCALAR >& elt);
253 PRMAggregate< GUM_SCALAR >(
const PRMAggregate< GUM_SCALAR >& source);
282 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS 289 #include <agrum/PRM/elements/PRMAggregate_tpl.h>
virtual PRMClassElement< GUM_SCALAR >::ClassElementType elt_type() const
See gum::PRMClassElement::elt_type().
static AggregateType str2enum(const std::string &str)
Static method which returns the AggregateType given its string representation.
MultiDimImplementation< GUM_SCALAR > * buildImpl() const
Returns a pointer over an empty gum::MultiDimImplementation of the good type for this PRMAggregate...
INLINE void emplace(Args &&... args)
virtual ~PRMAggregate()
Destructor.
virtual void addParent(const PRMClassElement< GUM_SCALAR > &elt)
See gum::PRMClassElement::addParent_().
void setLabel(const std::string &label)
See gum::PRMClassElement::elt_type().
std::shared_ptr< Idx > _label_
Some aggregators applies only on a given label. This attribute must have the concerned Idx...
void sharedLabel(std::shared_ptr< Idx > label)
Sets the shared_ptr of this Aggregate.
void setLabel(Idx idx)
Set the aggregator's label.
virtual PRMAttribute< GUM_SCALAR > * getCastDescendant() const
See gum::PRMClassElement::elt_type().
PRMAggregate< GUM_SCALAR > & operator=(const PRMAggregate< GUM_SCALAR > &source)
Copy operator. Don't use it.
std::shared_ptr< Idx > sharedLabel() const
Returns the shared_ptr holding this Aggregate label.
PRMAggregate(const std::string &name, AggregateType aggType, const PRMType &rvType)
Default constructor.
virtual void addChild(const PRMClassElement< GUM_SCALAR > &elt)
See gum::PRMClassElement::addChild_().
const std::string & labelValue() const
See gum::PRMClassElement::elt_type().
AggregateType agg_type() const
Returns the aggregate of *this.
ParamScopeData(const std::string &s, const PRMReferenceSlot< GUM_SCALAR > &ref, Idx d)
bool isDecomposable() const
Returns true if the aggregator is decomposable.
virtual const PRMType & type() const
See gum::PRMClassElement::type().
virtual Potential< GUM_SCALAR > & cpf()
Aggregates don't have Potential until they are instantiated as PRMAttribute, so this will raise an Op...
std::string _label_value_
The AggregateType of this aggregate.
AggregateType
The different type of aggregates we can have.
virtual PRMType & type()
See gum::PRMClassElement::type().
virtual const Potential< GUM_SCALAR > & cpf() const
Aggregates don't have Potential until they are instantiated as PRMAttribute, so this will raise an Op...
bool hasLabel() const
Returns true if the label is defined.
PRMAggregate(const std::string &name, AggregateType aggType, const PRMType &rvType, Idx label)
Default constructor.
PRMType * _type_
The random variable type of this aggregate It is deleted with the aggregate.
AggregateType _agg_type_
The AggregateType of this aggregate.
Idx label() const
Returns the label's index on which this aggregate applies.