28 #ifndef GUM_MULTI_DIM_IMPLEMENTATION_H 29 #define GUM_MULTI_DIM_IMPLEMENTATION_H 33 #include <agrum/agrum.h> 35 #include <agrum/tools/multidim/implementations/multiDimContainer.h> 64 template <
typename GUM_SCALAR >
65 class MultiDimImplementation:
public MultiDimContainer< GUM_SCALAR > {
153 virtual void add(
const DiscreteVariable& v)
override;
155 virtual void erase(
const DiscreteVariable& v)
override;
165 virtual bool contains(
const DiscreteVariable& v)
const override;
167 virtual bool empty()
const override;
185 using MultiDimContainer< GUM_SCALAR >::get;
243 virtual void replace_(
const DiscreteVariable* x,
244 const DiscreteVariable* y)
override;
255 virtual void invert_(Idx p1, Idx p2);
262 virtual const MultiDimImplementation< GUM_SCALAR >*
content()
const final;
267 virtual MultiDimImplementation< GUM_SCALAR >*
content()
final;
309 template <
typename GUM_SCALAR >
315 #include <agrum/tools/multidim/implementations/multiDimImplementation_tpl.h> InternalChangeState__
Used to represent in which change state this MultiDimImplementation is.
float compressionRate() const
The compression ratio of the table (depending on the type of implementation).
InternalChangeState__ internalChangeState__
The current change state.
const List< Instantiation *> & slaves_() const
Returns a constant reference over the list of slaved instantiations.
INLINE void emplace(Args &&... args)
const DiscreteVariable & variable(const std::string &name) const override
Returns the variable with the name.
virtual void erase(const DiscreteVariable &v) override
Removes a var from the variables of the multidimensional matrix.
virtual void commitMultipleChanges_()
Synchronize content after MultipleChanges.
void endMultipleChanges(const GUM_SCALAR &) override
Call this method after doing important changes in this MultiDimContainer.
Sequence< const DiscreteVariable *> vars__
List of discrete variables (dimensions).
const DiscreteVariable & variable(Idx i) const override
Returns a const ref to the ith var.
virtual MultiDimImplementation< GUM_SCALAR > * content() final
Returns the implementation for this object (may be *this).
virtual bool unregisterSlave(Instantiation &slave) override
Unregister i as a slave of this MultiDimAdressable.
virtual bool empty() const override
Returns true if no var is in *this.
InternalChangeMethod__ internalChangeMethod__
The current change method.
virtual const MultiDimImplementation< GUM_SCALAR > * content() const final
Returns the implementation for this object (may be *this).
virtual void commitMultipleChanges_(const GUM_SCALAR &value)
Synchronize content after MultipleChanges.
MultiDimImplementation()
Default constructor.
List< Instantiation *> slaveInstantiations__
List of instantiations of the tuples (sequences) of variables.
virtual void invert_(Idx p1, Idx p2)
Inverts variables at position p1 and p2.
bool isInMultipleChangeMethod_() const
Get the actual change method of this MultiDimImplementation.
virtual const std::string & name() const =0
Returns the real name of the multiDim implementation.
Size domainSize__
This MultiDimImplementation domain size.
MultiDimImplementation(const MultiDimImplementation< GUM_SCALAR > &from)
Copy constructor.
virtual Size realSize() const =0
Returns the real number of parameters used for this table.
std::ostream & operator<<(std::ostream &, const MultiDimImplementation< GUM_SCALAR > &)
For friendly displaying the content of the array.
virtual void add(const DiscreteVariable &v) override
Adds a new var to the variables of the multidimensional matrix.
virtual ~MultiDimImplementation()
Class destructor.
void endMultipleChanges() override
Call this method after doing important changes in this MultiDimContainer.
virtual const Sequence< const DiscreteVariable *> & variablesSequence() const override
Returns a const ref to the sequence of DiscreteVariable*.
virtual Idx nbrDim() const override
Returns the number of vars in the multidimensional container.
void beginMultipleChanges() override
Call this method before doing important changes in this MultiDimContainer.
virtual Size domainSize() const override
Returns the product of the variables domain size.
void setNotCommitedChange__()
Change the internalChangeState__ to NOT_COMMITTED_CHANGE.
InternalChangeMethod__
Used to represent in which change method this MultiDimImplementation is.
virtual Idx pos(const DiscreteVariable &v) const override
Returns the index of a variable.
bool isCommitNeeded_() const
Get the actual state of *this.
virtual void replace_(const DiscreteVariable *x, const DiscreteVariable *y) override
Replace variable x by y.
virtual bool contains(const DiscreteVariable &v) const override
Returns true if var is in *this.
virtual MultiDimContainer< GUM_SCALAR > * newFactory() const override=0
Creates an empty clone of this MultiDimContainer.
const std::string & basename() const
Returns the base class name of this MultiDimImplementation.
virtual bool registerSlave(Instantiation &slave) override
Register i as a slave of this MultiDimAdressable.