49#ifndef GUM_AGGREGATE_H
50#define GUM_AGGREGATE_H
80 template <
typename GUM_SCALAR >
115 }
else if (
toLower(str) ==
"max") {
117 }
else if (
toLower(str) ==
"count") {
119 }
else if (
toLower(str) ==
"exists") {
121 }
else if (
toLower(str) ==
"or") {
123 }
else if (
toLower(str) ==
"and") {
125 }
else if (
toLower(str) ==
"forall") {
127 }
else if (
toLower(str) ==
"amplitude") {
129 }
else if (
toLower(str) ==
"median") {
131 }
else if (
toLower(str) ==
"sum") {
134 std::string msg =
"Unknown aggregate: ";
164 AggregateType aggType,
238 virtual Tensor< GUM_SCALAR >&
cpf();
245 virtual const Tensor< GUM_SCALAR >&
cpf()
const;
294#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
Inline implementation of gum::PRMAggregate.
Headers of gum::PRMScalarAttribute.
<agrum/base/multidim/multiDimImplementation.h>
Exception : the element we looked for cannot be found.
Idx label() const
Returns the label's index on which this aggregate applies.
virtual void addParent(const PRMClassElement< GUM_SCALAR > &elt)
See gum::PRMClassElement::addParent_().
virtual void addChild(const PRMClassElement< GUM_SCALAR > &elt)
See gum::PRMClassElement::addChild_().
virtual PRMType & type()
See gum::PRMClassElement::type().
AggregateType
The different type of aggregates we can have.
PRMAggregate< GUM_SCALAR > & operator=(const PRMAggregate< GUM_SCALAR > &source)
Copy operator. Don't use it.
virtual PRMAttribute< GUM_SCALAR > * getCastDescendant() const
See gum::PRMClassElement::elt_type().
PRMAggregate(const std::string &name, AggregateType aggType, const PRMType &rvType)
Default constructor.
static AggregateType str2enum(const std::string &str)
Static method which returns the AggregateType given its string representation.
AggregateType agg_type() const
Returns the aggregate of *this.
AggregateType _agg_type_
The AggregateType of this aggregate.
bool hasLabel() const
Returns true if the label is defined.
std::shared_ptr< Idx > sharedLabel() const
Returns the shared_ptr holding this Aggregate label.
void setLabel(Idx idx)
Set the aggregator's label.
std::string _label_value_
The AggregateType of this aggregate.
std::shared_ptr< Idx > _label_
Some aggregators applies only on a given label. This attribute must have the concerned Idx....
virtual Tensor< GUM_SCALAR > & cpf()
Aggregates don't have Tensor until they are instantiated as PRMAttribute, so this will raise an Opera...
virtual PRMClassElement< GUM_SCALAR >::ClassElementType elt_type() const
See gum::PRMClassElement::elt_type().
MultiDimImplementation< GUM_SCALAR > * buildImpl() const
Returns a pointer over an empty gum::MultiDimImplementation of the good type for this PRMAggregate.
PRMType * _type_
The random variable type of this aggregate It is deleted with the aggregate.
virtual ~PRMAggregate()
Destructor.
const std::string & labelValue() const
See gum::PRMClassElement::elt_type().
bool isDecomposable() const
Returns true if the aggregator is decomposable.
PRMAttribute is a member of a Class in a PRM.
Abstract class representing an element of PRM class.
PRMClassElement(const std::string &name)
Default constructor of a PRMClassElement.
ClassElementType
Returns true if obj_ptr is of type PRMReferenceSlot.
A PRMClass is an object of a PRM representing a fragment of a Bayesian network which can be instantia...
const std::string & name() const
Returns the name of this object.
This is a decoration of the DiscreteVariable class.
#define GUM_ERROR(type, msg)
Size Idx
Type for indexes.
std::string toLower(std::string str)
Returns the lowercase version of str.
namespace for all probabilistic relational models entities
gum is the global namespace for all aGrUM entities