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;
164 virtual bool contains(
const DiscreteVariable& v)
const override;
166 virtual bool empty()
const override;
184 using MultiDimContainer< GUM_SCALAR >::get;
242 virtual void replace_(
const DiscreteVariable* x,
const DiscreteVariable* y)
override;
253 virtual void invert_(Idx p1, Idx p2);
260 virtual const MultiDimImplementation< GUM_SCALAR >*
content()
const final;
265 virtual MultiDimImplementation< GUM_SCALAR >*
content()
final;
307 template <
typename GUM_SCALAR >
312 #include <agrum/tools/multidim/implementations/multiDimImplementation_tpl.h> float compressionRate() const
The compression ratio of the table (depending on the type of implementation).
const List< Instantiation *> & slaves_() const
Returns a constant reference over the list of slaved instantiations.
_InternalChangeMethod_ _internalChangeMethod_
The current change method.
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.
void _setNotCommitedChange_()
Change the internalChangeState to NOT_COMMITTED_CHANGE.
virtual void commitMultipleChanges_()
Synchronize content after MultipleChanges.
void endMultipleChanges(const GUM_SCALAR &) override
Call this method after doing important changes in this MultiDimContainer.
const DiscreteVariable & variable(Idx i) const override
Returns a const ref to the ith var.
_InternalChangeState_
Used to represent in which change state this MultiDimImplementation is.
Sequence< const DiscreteVariable *> _vars_
List of discrete variables (dimensions).
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.
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.
_InternalChangeMethod_
Used to represent in which change method this MultiDimImplementation is.
MultiDimImplementation()
Default constructor.
Size _domainSize_
This MultiDimImplementation domain size.
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.
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.
_InternalChangeState_ _internalChangeState_
The current change state.
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.
List< Instantiation *> _slaveInstantiations_
List of instantiations of the tuples (sequences) of variables.
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.