aGrUM  0.16.0
multiDimAggregator.h
Go to the documentation of this file.
1 
30 #ifndef GUM_MULTI_DIM_AGGREGATOR_H
31 #define GUM_MULTI_DIM_AGGREGATOR_H
32 
34 
35 namespace gum {
36  namespace aggregator {
37  // =========================================================================
38  // === GUM_MULTI_DIM_AGGREGATOR ===
39  // =========================================================================
40 
63  template < typename GUM_SCALAR >
64  class MultiDimAggregator : public MultiDimReadOnly< GUM_SCALAR > {
65  public:
66  // =======================================================================
68  // =======================================================================
70 
75 
80 
84  virtual ~MultiDimAggregator();
85 
87 
105  virtual MultiDimContainer< GUM_SCALAR >* newFactory() const override = 0;
106 
107  // =======================================================================
109  // =======================================================================
111 
112  public:
113  virtual GUM_SCALAR get(const Instantiation& i) const override;
114 
115  virtual std::string aggregatorName() const = 0;
116  const std::string toString() const override;
117 
119  const gum::DiscreteVariable* const,
120  gum::Idx,
121  gum::Idx) override{};
122 
123  void setFirstNotification(const gum::Instantiation&) override{};
124 
125  void setLastNotification(const gum::Instantiation&) override{};
126 
127  void setIncNotification(const gum::Instantiation&) override{};
128 
129  void setDecNotification(const gum::Instantiation&) override{};
130 
131  void setChangeNotification(const gum::Instantiation&) override{};
132 
133  const std::string toString(const gum::Instantiation* i) const override {
134  return i->toString();
135  };
136 
142  Size realSize() const override { return 0; };
143 
155  const std::string& name() const override;
156 
166  void copyFrom(const MultiDimContainer< GUM_SCALAR >& src) const override;
167 
169  protected:
174  virtual Idx _buildValue(const gum::Instantiation& i) const;
175 
176 
178  virtual Idx _neutralElt() const = 0;
179 
183  virtual Idx _fold(const DiscreteVariable& v,
184  Idx i1,
185  Idx i2,
186  bool& stop_iteration) const = 0;
187  };
188 
189 
190 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
191  extern template class MultiDimAggregator< double >;
192 #endif
193 
195  template < typename GUM_SCALAR >
196  std::ostream& operator<<(std::ostream& s,
198 
199  } /* namespace aggregator */
200 } /* namespace gum */
201 
203 
204 #endif /* GUM_MULTI_DIM_AGGREGATOR_H */
virtual ~MultiDimAggregator()
Class destructor.
const std::string toString() const override
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
const std::string & name() const override
Returns the real name of the multiDimArray.
void setChangeNotification(const gum::Instantiation &) override
const std::string toString(const gum::Instantiation *i) const override
void setDecNotification(const gum::Instantiation &) override
virtual Idx _fold(const DiscreteVariable &v, Idx i1, Idx i2, bool &stop_iteration) const =0
_fold is applied on value i1 for variable v. the actual result for precedent applications is i2...
virtual std::string aggregatorName() const =0
Base class for discrete random variable.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
Abstract base class for all multi dimensionnal containers.
void copyFrom(const MultiDimContainer< GUM_SCALAR > &src) const override
Copy of a multiDimICIModel.
Abstract base class for all multi dimensionnal read only structure.
void changeNotification(const gum::Instantiation &, const gum::DiscreteVariable *const, gum::Idx, gum::Idx) override
<agrum/multidim/aggregators/multiDimAggregator.h>
void setIncNotification(const gum::Instantiation &) override
void setFirstNotification(const gum::Instantiation &) override
virtual Idx _neutralElt() const =0
_neutralElt() is the result value for the first application of _fold
std::string toString() const
Give a string version of instantiation.
void setLastNotification(const gum::Instantiation &) override
Class for assigning/browsing values to tuples of discrete variables.
Definition: instantiation.h:83
virtual Idx _buildValue(const gum::Instantiation &i) const
by default, _buildValue uses a "fold" scheme and the user has to implement _neutralElt and _fold but ...
virtual MultiDimContainer< GUM_SCALAR > * newFactory() const override=0
This method creates a clone of this object, withouth its content (including variable), you must use this method if you want to ensure that the generated object has the same type than the object containing the called newFactory()
Size Idx
Type for indexes.
Definition: types.h:53
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:48
std::ostream & operator<<(std::ostream &s, const MultiDimAggregator< GUM_SCALAR > &ag)
For friendly displaying the content of the array.