49#ifndef GUM_MULTIDIM_CONTAINER_H
50#define GUM_MULTIDIM_CONTAINER_H
61#include <initializer_list>
65 template <
typename GUM_ELEMENT >
112 template <
typename GUM_ELEMENT >
190 virtual void fill(
const GUM_ELEMENT& d)
const = 0;
210 virtual void populate(
const std::vector< GUM_ELEMENT >& v)
const;
230 virtual void populate(std::initializer_list< GUM_ELEMENT > l)
const;
346 virtual std::string
toString()
const;
365 virtual void apply(std::function< GUM_ELEMENT(GUM_ELEMENT) > f)
const;
372 virtual GUM_ELEMENT
reduce(std::function< GUM_ELEMENT(GUM_ELEMENT, GUM_ELEMENT) > f,
373 GUM_ELEMENT base)
const;
Class for assigning/browsing values to tuples of discrete variables.
MultiDimAdressable()
Default constructor.
bool operator==(const MultiDimContainer< GUM_ELEMENT > &p) const
Test if this MultiDimContainer is equal to p.
MultiDimContainer & operator=(const MultiDimContainer< GUM_ELEMENT > &src)
Default constructor.
virtual void beginMultipleChanges()=0
Call this method before doing important changes in this MultiDimContainer.
std::string toString(const Instantiation *i) const override=0
Display the internal representation of i.
virtual void set(const Instantiation &i, const GUM_ELEMENT &value) const
Changes the value pointed by i.
virtual void copy(const MultiDimContainer< GUM_ELEMENT > &src)
Removes all variables in this MultiDimContainer and copy the content of src, variables included.
virtual void copyFrom(const MultiDimContainer< GUM_ELEMENT > &src) const
Basic copy of a MultiDimContainer.
virtual void fill(const GUM_ELEMENT &d) const =0
Fill the table with d.
virtual void populate(const std::vector< GUM_ELEMENT > &v) const
Automatically fills this MultiDimContainer with the values in v.
virtual GUM_ELEMENT get(const Instantiation &i) const
Returns the value pointed by i.
virtual GUM_ELEMENT reduce(std::function< GUM_ELEMENT(GUM_ELEMENT, GUM_ELEMENT) > f, GUM_ELEMENT base) const
compute lfold for this container
virtual const MultiDimImplementation< GUM_ELEMENT > * content() const =0
Returns the implementation for this object (may be *this).
MultiDimContainer()
Default constructor.
virtual void endMultipleChanges(const GUM_ELEMENT &v)=0
Call this method after doing important changes in this MultiDimContainer.
virtual void endMultipleChanges()=0
Call this method after doing important changes in this MultiDimContainer.
GUM_ELEMENT operator[](const Instantiation &i) const
An [] operator using a Instantiation as argument.
virtual void extractFrom(const MultiDimContainer< GUM_ELEMENT > &src, const Instantiation &mask)
Basic extraction of a MultiDimContainer.
virtual MultiDimImplementation< GUM_ELEMENT > * content()=0
Returns the implementation for this object (may be *this).
virtual void apply(std::function< GUM_ELEMENT(GUM_ELEMENT) > f) const
Apply a function on every element of the container.
virtual std::string toString() const
Returns a representation of this MultiDimContainer.
MultiDimAdressable & getMasterRef() override
In order to insure the dereference for decorators, we need to virtualize the access to master pointer...
virtual MultiDimContainer< GUM_ELEMENT > * newFactory() const =0
Creates an empty clone of this MultiDimContainer.
virtual GUM_ELEMENT & get_(const Instantiation &i) const =0
Return a data, given a Instantiation.
~MultiDimContainer() override
Destructor.
<agrum/base/multidim/multiDimImplementation.h>
Headers for the abstract base class for all multi dimensionnal containers.
Implementation of the MultiDimContainer class.
gum is the global namespace for all aGrUM entities