26 #ifndef GUM_MULTI_DIM_IMPLEMENTATION_H 27 #define GUM_MULTI_DIM_IMPLEMENTATION_H 62 template <
typename GUM_SCALAR >
63 class MultiDimImplementation :
public MultiDimContainer< GUM_SCALAR > {
105 virtual const std::string&
name()
const = 0;
113 const std::string&
basename()
const;
151 virtual void add(
const DiscreteVariable& v)
override;
153 virtual void erase(
const DiscreteVariable& v)
override;
155 virtual const Sequence< const DiscreteVariable* >&
158 virtual const DiscreteVariable&
variable(
Idx i)
const override;
159 virtual const DiscreteVariable&
162 virtual Idx pos(
const DiscreteVariable& v)
const override;
164 virtual bool contains(
const DiscreteVariable& v)
const override;
166 virtual bool empty()
const override;
186 virtual MultiDimContainer< GUM_SCALAR >*
newFactory()
const override = 0;
231 const List< Instantiation* >&
_slaves()
const;
242 virtual void _replace(
const DiscreteVariable* x,
243 const DiscreteVariable* y)
override;
261 virtual const MultiDimImplementation< GUM_SCALAR >*
content() const final;
300 template <
typename GUM_SCALAR >
float compressionRate() const
The compression ratio of the table (depending on the type of implementation).
__InternalChangeState __internalChangeState
The current change state.
virtual void erase(const DiscreteVariable &v) override
Removes a var from the variables of the multidimensional matrix.
The generic class for storing (ordered) sequences of objects.
Size __domainSize
This MultiDimImplementation domain size.
virtual const DiscreteVariable & variable(Idx i) const override
Returns a const ref to the ith var.
bool _isCommitNeeded() const
Get the actual state of *this.
const List< Instantiation *> & _slaves() const
Returns a constant reference over the list of slaved instantiations.
Implementation of gum::MultiDimImplementation.
Base class for discrete random variable.
Generic doubly linked lists.
virtual bool unregisterSlave(Instantiation &slave) override
Unregister i as a slave of this MultiDimAdressable.
virtual void _invert(Idx p1, Idx p2)
Inverts variables at position p1 and p2.
gum is the global namespace for all aGrUM entities
virtual bool empty() const override
Returns true if no var is in *this.
Sequence< const DiscreteVariable *> __vars
List of discrete variables (dimensions).
virtual const MultiDimImplementation< GUM_SCALAR > * content() const final
Returns the implementation for this object (may be *this).
bool _isInMultipleChangeMethod() const
Get the actual change method of this MultiDimImplementation.
std::ostream & operator<<(std::ostream &output, const BayesNet< GUM_SCALAR > &bn)
Prints map's DAG in output using the Graphviz-dot format.
void __setNotCommitedChange()
Change the __internalChangeState to NOT_COMMITTED_CHANGE.
virtual void _replace(const DiscreteVariable *x, const DiscreteVariable *y) override
Replace variable x by y.
MultiDimImplementation()
Default constructor.
virtual const std::string & name() const =0
Returns the real name of the multiDim implementation.
List< Instantiation *> __slaveInstantiations
List of instantiations of the tuples (sequences) of variables.
virtual Size realSize() const =0
Returns the real number of parameters used for this table.
virtual void add(const DiscreteVariable &v) override
Adds a new var to the variables of the multidimensional matrix.
virtual ~MultiDimImplementation()
Class destructor.
virtual void endMultipleChanges() override
Call this method after doing important changes in this MultiDimContainer.
__InternalChangeMethod __internalChangeMethod
The current change method.
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.
Class for assigning/browsing values to tuples of discrete variables.
virtual 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.
Headers of the MultiDimContainer class.
__InternalChangeMethod
Used to represent in which change method this MultiDimImplementation is.
virtual void _commitMultipleChanges()
Synchronize content after MultipleChanges.
<agrum/multidim/multiDimImplementation.h>
virtual Idx pos(const DiscreteVariable &v) const override
Returns the index of a variable.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
virtual GUM_SCALAR get(const Instantiation &i) const
Returns the value pointed by i.
virtual bool contains(const DiscreteVariable &v) const override
Returns true if var is in *this.
__InternalChangeState
Used to represent in which change state this MultiDimImplementation is.
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.