31 #ifndef GUM_MULTIDIM_BUCKET_H 32 #define GUM_MULTIDIM_BUCKET_H 74 template <
typename GUM_SCALAR >
213 void compute(
bool force =
false)
const;
223 const std::string&
name()
const override;
233 virtual GUM_SCALAR
get(
const Instantiation& i)
const override;
238 Idx newval)
override;
354 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS virtual bool unregisterSlave(Instantiation &i) override
Unregister i as a slave of this MultiDimAdressable.
virtual void setDecNotification(const Instantiation &i) override
Listen to increment in each recorded Instantiation.
Size __bufferSize
The number of element allowed in __bucket.
Instantiation __allVarsInst
Instantiation over all variable in this.
MultiDimArray< GUM_SCALAR > * __bucket
The result table of this bucket.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
HashTable< const MultiDimContainer< GUM_SCALAR > *, Instantiation *> __multiDims
The set of MultiDimContainer in this bucket.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual void setChangeNotification(const Instantiation &i) override
Listen to an assignment of a value in a Instantiation.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
std::string __name
The class name.
virtual Size realSize() const override
Returns the real number of parameters used for this table.
bool isBucketEmpty() const
Returns true if this bucket is empty.
virtual const std::string toString() const
Returns a representation of this MultiDimContainer.
A multidim implementation for buckets.
HashTable< const Instantiation *, GUM_SCALAR > __slavesValue
This table is used to keep the last value computed for an instantiation when the value are computed o...
GUM_SCALAR __computeValue(const Instantiation &value) const
Compute the value of the final table of this bucket given i.
Base class for discrete random variable.
bool contains(const MultiDimContainer< GUM_SCALAR > &impl) const
Returns true if the MultiDimContainer is in this bucket.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Abstract base class for all multi dimensionnal containers.
virtual MultiDimContainer< GUM_SCALAR > * newFactory() const override
Default constructor.
Abstract base class for all multi dimensionnal read only structure.
The class for generic Hash Tables.
virtual ~MultiDimBucket()
Destructor.
void __addVariable(const DiscreteVariable *var)
Add a variable to __allVariables, and do nothing if var is already in the set.
Representation of a setA Set is a structure that contains arbitrary elements.
void __initializeBuffer()
Initialize the internal buffer.
void __eraseBuffer()
Clean the buffer and switch it's instantiation to this bucket.
void erase(const MultiDimContainer< GUM_SCALAR > &impl)
Remove a MultiDimContainer from this bucket.
virtual void changeNotification(const Instantiation &i, const DiscreteVariable *const var, Idx oldval, Idx newval) override
Listen to changes in a given Instantiation.
virtual void setLastNotification(const Instantiation &i) override
Listen to setLast in a given Instantiation.
const MultiDimArray< GUM_SCALAR > & bucket() const
Returns the MultiDimArray used by this MultiDimBucket.
void __eraseVariable(const DiscreteVariable *var)
Erase a variable from __allVariables if no other multidimensional table uses it in this bucket...
Size bucketSize() const
Returns the number of MultiDimContainer in in this bukcet.
MultiDimBucket(Size bufferSize=INT_MAX)
Default constructor.
virtual GUM_SCALAR & _get(const Instantiation &i) const override
void compute(bool force=false) const
This method computes the final table of this bucket.
virtual void setIncNotification(const Instantiation &i) override
Listen to increment in a given Instantiation.
Multidimensional matrix stored as an array in memory.
Set of pairs of elements with fast search for both elements.
Bijection< Instantiation *, Instantiation *> __instantiations
Bijection between instantiations registered on this and their equivalent on __bucket.
bool bucketChanged() const
Returns true if the bucket need re-computation since the last computation.
bool __changed
Flag used to know if changes has occurred in the bucket since last computation.
virtual void setFirstNotification(const Instantiation &i) override
Listen to setFirst in a given Instantiation.
Abstract base class for all multi dimensionnal addressable.
Class for assigning/browsing values to tuples of discrete variables.
virtual void _commitMultipleChanges() override
Synchronize content after MultipleChanges.
Set< const DiscreteVariable *> __allVariables
The set of all variables of the multidims in this bucket.
Size bufferSize() const
Returns the amount of memory allowed for this bucket.
virtual bool registerSlave(Instantiation &i) override
Register i as a slave of this MultiDimAdressable.
Size Idx
Type for indexes.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void setBufferSize(Size amount)
Changes the amount of memory allowed for this bucket.
const Set< const DiscreteVariable *> & allVariables() const
Returns the sequence of all the variables contained in the bucket.
const HashTable< const MultiDimContainer< GUM_SCALAR > *, Instantiation *> & multidims() const
Returns the MultiDimContainer and their respective Instantiation.
const std::string & name() const override
Returns the real name of the multiDim implementation.
virtual MultiDimAdressable & getMasterRef() override
In order to insure the dereference for decorators, we need to virtualize the access to master pointer...
void add(const MultiDimContainer< GUM_SCALAR > &impl)
Add a MultiDimContainer in the bucket.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual void _replace(const DiscreteVariable *x, const DiscreteVariable *y) override
Replace variable x by y.