50#ifndef GUM_MULTIDIM_BUCKET_H
51#define GUM_MULTIDIM_BUCKET_H
89 template <
typename GUM_SCALAR >
228 void compute(
bool force =
false)
const;
238 const std::string&
name()
const override;
253 Idx newval)
override;
366#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
Set of pairs of elements with fast search for both elements.
Set of pairs of elements with fast search for both elements.
Base class for discrete random variable.
The class for generic Hash Tables.
Class for assigning/browsing values to tuples of discrete variables.
Abstract base class for all multi dimensionnal addressable.
Multidimensional matrix stored as an array in memory.
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...
bool bucketChanged() const
Returns true if the bucket need re-computation since the last computation.
bool isBucketEmpty() const
Returns true if this bucket is empty.
virtual void setChangeNotification(const Instantiation &i) override
Listen to an assignment of a value in a Instantiation.
virtual GUM_SCALAR get(const Instantiation &i) const override
Returns the value pointed by i.
Size bucketSize() const
Returns the number of MultiDimContainer in in this bukcet.
virtual void setDecNotification(const Instantiation &i) override
Listen to increment in each recorded Instantiation.
Instantiation _allVarsInst_
Instantiation over all variable in this.
MultiDimArray< GUM_SCALAR > * _bucket_
The result table of this bucket.
virtual Size realSize() const override
Returns the real number of parameters used for this table.
virtual MultiDimContainer< GUM_SCALAR > * newFactory() const override
Default constructor.
virtual bool unregisterSlave(Instantiation &i) override
Unregister i as a slave of this MultiDimAdressable.
virtual void commitMultipleChanges_() override
Synchronize content after MultipleChanges.
const gum::VariableSet & allVariables() const
Returns the sequence of all the variables contained in the bucket.
void _initializeBuffer_()
Initialize the internal buffer.
Size _bufferSize_
The number of element allowed in bucket.
const MultiDimArray< GUM_SCALAR > & bucket() const
Returns the MultiDimArray used by this MultiDimBucket.
void setBufferSize(Size amount)
Changes the amount of memory allowed for this bucket.
Bijection< Instantiation *, Instantiation * > _instantiations_
Bijection between instantiations registered on this and their equivalent on bucket.
void _eraseVariable_(const DiscreteVariable *var)
Erase a variable from allVariables if no other multidimensional table uses it in this bucket.
GUM_SCALAR _computeValue_(const Instantiation &value) const
Compute the value of the final table of this bucket given i.
virtual MultiDimAdressable & getMasterRef() override
In order to insure the dereference for decorators, we need to virtualize the access to master pointer...
bool contains(const MultiDimContainer< GUM_SCALAR > &impl) const
Returns true if the MultiDimContainer is in this bucket.
void _eraseBuffer_()
Clean the buffer and switch it's instantiation to this bucket.
virtual ~MultiDimBucket()
Destructor.
bool _changed_
Flag used to know if changes has occurred in the bucket since last computation.
virtual bool registerSlave(Instantiation &i) override
Register i as a slave of this MultiDimAdressable.
void erase(const MultiDimContainer< GUM_SCALAR > &impl)
Remove a MultiDimContainer from this bucket.
const HashTable< const MultiDimContainer< GUM_SCALAR > *, Instantiation * > & multidims() const
Returns the MultiDimContainer and their respective Instantiation.
void add(const MultiDimContainer< GUM_SCALAR > &impl)
Add a MultiDimContainer in the bucket.
virtual void setLastNotification(const Instantiation &i) override
Listen to setLast in a given Instantiation.
const std::string & name() const override
Returns the real name of the multiDim implementation.
virtual void setFirstNotification(const Instantiation &i) override
Listen to setFirst in a given Instantiation.
std::string _name_
The class name.
virtual void replace_(const DiscreteVariable *x, const DiscreteVariable *y) override
Replace variable x by y.
Size bufferSize() const
Returns the amount of memory allowed for this bucket.
HashTable< const MultiDimContainer< GUM_SCALAR > *, Instantiation * > _multiDims_
The set of MultiDimContainer in this bucket.
void _addVariable_(const DiscreteVariable *var)
Add a variable to allVariables, and do nothing if var is already in the set.
void compute(bool force=false) const
This method computes the final table of this bucket.
virtual void changeNotification(const Instantiation &i, const DiscreteVariable *const var, Idx oldval, Idx newval) override
Listen to changes in a given Instantiation.
MultiDimBucket(Size bufferSize=INT_MAX)
Default constructor.
virtual void setIncNotification(const Instantiation &i) override
Listen to increment in a given Instantiation.
virtual GUM_SCALAR & get_(const Instantiation &i) const override
gum::VariableSet _allVariables_
The set of all variables of the multidims in this bucket.
Abstract base class for all multi dimensionnal containers.
virtual std::string toString() const
Returns a representation of this MultiDimContainer.
MultiDimReadOnly()
Default constructor.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size Idx
Type for indexes.
Header of the MultiDimArray class.
Implementation of the MultiDimBucket class.
Header of the MultiDimReadOnly class.
gum is the global namespace for all aGrUM entities
Set< const DiscreteVariable * > VariableSet