[aGrUM] internal bug fix

parent b250504f
...@@ -915,7 +915,7 @@ namespace gum { ...@@ -915,7 +915,7 @@ namespace gum {
attr.swap(old_type, new_type); attr.swap(old_type, new_type);
} else { } else {
GUM_ERROR(OperationNotAllowed, "unexpected ClassElement"); GUM_ERROR(OperationNotAllowed, "unexpected ClassElement");
// get( child ).cpf().swap( // get( child ).cpf().replace(
// slotchain->lastElt().type().variable(), // slotchain->lastElt().type().variable(),
// sc->lastElt().type().variable() ); // sc->lastElt().type().variable() );
} }
......
...@@ -343,11 +343,11 @@ namespace gum { ...@@ -343,11 +343,11 @@ namespace gum {
PRMFormAttribute< GUM_SCALAR >::swap(const PRMType< GUM_SCALAR >& old_type, PRMFormAttribute< GUM_SCALAR >::swap(const PRMType< GUM_SCALAR >& old_type,
const PRMType< GUM_SCALAR >& new_type) { const PRMType< GUM_SCALAR >& new_type) {
if (&(old_type) == __type) { if (&(old_type) == __type) {
GUM_ERROR(OperationNotAllowed, "Cannot swap attribute own type"); GUM_ERROR(OperationNotAllowed, "Cannot replace attribute own type");
} }
if (old_type->domainSize() != new_type->domainSize()) { if (old_type->domainSize() != new_type->domainSize()) {
GUM_ERROR(OperationNotAllowed, GUM_ERROR(OperationNotAllowed,
"Cannot swap types with difference domain size"); "Cannot replace types with difference domain size");
} }
if (!__formulas->contains(old_type.variable())) { if (!__formulas->contains(old_type.variable())) {
GUM_ERROR(NotFound, "could not find variable " + old_type.name()); GUM_ERROR(NotFound, "could not find variable " + old_type.name());
...@@ -395,7 +395,7 @@ namespace gum { ...@@ -395,7 +395,7 @@ namespace gum {
if (__type->variable().domainSize() != t->variable().domainSize()) { if (__type->variable().domainSize() != t->variable().domainSize()) {
GUM_ERROR(OperationNotAllowed, GUM_ERROR(OperationNotAllowed,
"Cannot swap types with difference domain size"); "Cannot replace types with difference domain size");
} }
auto old = __formulas; auto old = __formulas;
......
...@@ -238,11 +238,11 @@ namespace gum { ...@@ -238,11 +238,11 @@ namespace gum {
PRMScalarAttribute< GUM_SCALAR >::swap(const PRMType< GUM_SCALAR >& old_type, PRMScalarAttribute< GUM_SCALAR >::swap(const PRMType< GUM_SCALAR >& old_type,
const PRMType< GUM_SCALAR >& new_type) { const PRMType< GUM_SCALAR >& new_type) {
if (&(old_type) == __type) { if (&(old_type) == __type) {
GUM_ERROR(OperationNotAllowed, "Cannot swap attribute own type"); GUM_ERROR(OperationNotAllowed, "Cannot replace attribute own type");
} }
if (old_type->domainSize() != new_type->domainSize()) { if (old_type->domainSize() != new_type->domainSize()) {
GUM_ERROR(OperationNotAllowed, GUM_ERROR(OperationNotAllowed,
"Cannot swap types with difference domain size"); "Cannot replace types with difference domain size");
} }
if (!__cpf->contains(old_type.variable())) { if (!__cpf->contains(old_type.variable())) {
GUM_ERROR(NotFound, "could not find variable " + old_type.name()); GUM_ERROR(NotFound, "could not find variable " + old_type.name());
...@@ -285,7 +285,7 @@ namespace gum { ...@@ -285,7 +285,7 @@ namespace gum {
if (__type->variable().domainSize() != t->variable().domainSize()) { if (__type->variable().domainSize() != t->variable().domainSize()) {
GUM_ERROR(OperationNotAllowed, GUM_ERROR(OperationNotAllowed,
"Cannot swap types with difference domain size"); "Cannot replace types with difference domain size");
} }
auto old = __cpf; auto old = __cpf;
......
...@@ -2148,7 +2148,7 @@ namespace gum { ...@@ -2148,7 +2148,7 @@ namespace gum {
return **__getIthBucket(i); return **__getIthBucket(i);
} }
// swap the current list with another one // replace the current list with another one
template < typename Val, typename Alloc > template < typename Val, typename Alloc >
INLINE void List< Val, Alloc >::swap(List& other_list) { INLINE void List< Val, Alloc >::swap(List& other_list) {
std::swap(__deb_list, other_list.__deb_list); std::swap(__deb_list, other_list.__deb_list);
......
...@@ -49,7 +49,7 @@ namespace gum { ...@@ -49,7 +49,7 @@ namespace gum {
* @tparam Val The type referenced by both gum::RefPtr. * @tparam Val The type referenced by both gum::RefPtr.
* @param ptr1 The smart pointer the content of which we swap with that of * @param ptr1 The smart pointer the content of which we swap with that of
* ptr2. * ptr2.
* @param ptr2 The smart pointer the content of which we swap with that of * @param ptr2 The smart pointer the content of which we replace with that of
* ptr1. * ptr1.
*/ */
/// @brief Swap the contents of two RefPtr. /// @brief Swap the contents of two RefPtr.
......
...@@ -260,7 +260,7 @@ namespace gum { ...@@ -260,7 +260,7 @@ namespace gum {
return __refcount; return __refcount;
} }
// swap the contents of two RefPtr // replace the contents of two RefPtr
template < typename Val > template < typename Val >
void swap(RefPtr< Val >& ptr1, RefPtr< Val >& ptr2) { void swap(RefPtr< Val >& ptr1, RefPtr< Val >& ptr2) {
......
...@@ -546,7 +546,7 @@ namespace gum { ...@@ -546,7 +546,7 @@ namespace gum {
__v[i] = &new_key; __v[i] = &new_key;
} }
// swap two elements in the sequence // replace two elements in the sequence
template < typename Key, typename Alloc, bool Gen > template < typename Key, typename Alloc, bool Gen >
INLINE void SequenceImplementation< Key, Alloc, Gen >::swap(Idx i, Idx j) { INLINE void SequenceImplementation< Key, Alloc, Gen >::swap(Idx i, Idx j) {
if (i == j) return; if (i == j) return;
...@@ -959,7 +959,7 @@ namespace gum { ...@@ -959,7 +959,7 @@ namespace gum {
__v[i] = newKey; __v[i] = newKey;
} }
// swap two elements in the sequence // replace two elements in the sequence
template < typename Key, typename Alloc > template < typename Key, typename Alloc >
INLINE void SequenceImplementation< Key, Alloc, true >::swap(Idx i, Idx j) { INLINE void SequenceImplementation< Key, Alloc, true >::swap(Idx i, Idx j) {
if (i == j) return; if (i == j) return;
......
...@@ -31,7 +31,7 @@ distribution. ...@@ -31,7 +31,7 @@ distribution.
* - fixed buggy compares operator==(), operator<(), and operator>() * - fixed buggy compares operator==(), operator<(), and operator>()
* - fixed operator+=() to take a const ref argument, following spec. * - fixed operator+=() to take a const ref argument, following spec.
* - added "copy" constructor with length, and most compare operators. * - added "copy" constructor with length, and most compare operators.
* - added swap(), clear(), size(), capacity(), operator+(). * - added replace(), clear(), size(), capacity(), operator+().
*/ */
#ifndef TIXML_USE_STL #ifndef TIXML_USE_STL
...@@ -175,7 +175,7 @@ class TiXmlString { ...@@ -175,7 +175,7 @@ class TiXmlString {
void clear() { void clear() {
// Lee: // Lee:
// The original was just too strange, though correct: // The original was just too strange, though correct:
// TiXmlString().swap(*this); // TiXmlString().replace(*this);
// Instead use the quit & re-init: // Instead use the quit & re-init:
quit(); quit();
init(0, 0); init(0, 0);
......
...@@ -70,7 +70,7 @@ namespace gum { ...@@ -70,7 +70,7 @@ namespace gum {
Idx var3, Idx var3,
const std::vector< Idx >& conditioning_set, const std::vector< Idx >& conditioning_set,
double score) { double score) {
// if ( var1 > var2 ) std::swap( var1, var2 ); // if ( var1 > var2 ) std::replace( var1, var2 );
__scores.insert(std::tuple< IdSet<>, Idx, Idx, Idx >( __scores.insert(std::tuple< IdSet<>, Idx, Idx, Idx >(
IdSet<>(conditioning_set, 0), var1, var2, var3), IdSet<>(conditioning_set, 0), var1, var2, var3),
std::move(score)); std::move(score));
...@@ -83,7 +83,7 @@ namespace gum { ...@@ -83,7 +83,7 @@ namespace gum {
Idx var3, Idx var3,
IdSet< Alloc >& conditioning_set, IdSet< Alloc >& conditioning_set,
double score) { double score) {
// if ( var1 > var2 ) std::swap( var1, var2 ); // if ( var1 > var2 ) std::replace( var1, var2 );
__scores.insert( __scores.insert(
std::tuple< IdSet<>, Idx, Idx, Idx >(conditioning_set, var1, var2, var3), std::tuple< IdSet<>, Idx, Idx, Idx >(conditioning_set, var1, var2, var3),
std::move(score)); std::move(score));
...@@ -94,7 +94,7 @@ namespace gum { ...@@ -94,7 +94,7 @@ namespace gum {
Idx var2, Idx var2,
Idx var3, Idx var3,
const std::vector< Idx >& conditioning_set) { const std::vector< Idx >& conditioning_set) {
// if ( var1 > var2 ) std::swap( var1, var2 ); // if ( var1 > var2 ) std::replace( var1, var2 );
__scores.erase(std::tuple< IdSet<>, Idx, Idx, Idx >( __scores.erase(std::tuple< IdSet<>, Idx, Idx, Idx >(
IdSet<>(conditioning_set, 0), var1, var2, var3)); IdSet<>(conditioning_set, 0), var1, var2, var3));
} }
...@@ -105,7 +105,7 @@ namespace gum { ...@@ -105,7 +105,7 @@ namespace gum {
Idx var2, Idx var2,
Idx var3, Idx var3,
const IdSet< Alloc >& conditioning_set) { const IdSet< Alloc >& conditioning_set) {
// if ( var1 > var2 ) std::swap( var1, var2 ); // if ( var1 > var2 ) std::replace( var1, var2 );
__scores.erase( __scores.erase(
std::tuple< IdSet<>, Idx, Idx, Idx >(conditioning_set, var1, var2, var3)); std::tuple< IdSet<>, Idx, Idx, Idx >(conditioning_set, var1, var2, var3));
} }
...@@ -115,7 +115,7 @@ namespace gum { ...@@ -115,7 +115,7 @@ namespace gum {
Idx var2, Idx var2,
Idx var3, Idx var3,
const std::vector< Idx >& conditioning_set) { const std::vector< Idx >& conditioning_set) {
// if ( var1 > var2 ) std::swap( var1, var2 ); // if ( var1 > var2 ) std::replace( var1, var2 );
return __scores.exists(std::tuple< IdSet<>, Idx, Idx, Idx >( return __scores.exists(std::tuple< IdSet<>, Idx, Idx, Idx >(
IdSet<>(conditioning_set, 0), var1, var2, var3)); IdSet<>(conditioning_set, 0), var1, var2, var3));
} }
...@@ -123,7 +123,7 @@ namespace gum { ...@@ -123,7 +123,7 @@ namespace gum {
/// returns a given score /// returns a given score
INLINE double Cache43ptInfo::score( INLINE double Cache43ptInfo::score(
Idx var1, Idx var2, Idx var3, const std::vector< Idx >& conditioning_set) { Idx var1, Idx var2, Idx var3, const std::vector< Idx >& conditioning_set) {
// if ( var1 > var2 ) std::swap( var1, var2 ); // if ( var1 > var2 ) std::replace( var1, var2 );
return __scores[std::tuple< IdSet<>, Idx, Idx, Idx >( return __scores[std::tuple< IdSet<>, Idx, Idx, Idx >(
IdSet<>(conditioning_set, 0), var1, var2, var3)]; IdSet<>(conditioning_set, 0), var1, var2, var3)];
} }
......
...@@ -98,20 +98,20 @@ namespace gum { ...@@ -98,20 +98,20 @@ namespace gum {
// @todo : optimisation with a always up-to-date value associated to each // @todo : optimisation with a always up-to-date value associated to each
// instantiation // instantiation
virtual void changeNotification(gum::Instantiation&, virtual void changeNotification(const gum::Instantiation&,
const gum::DiscreteVariable* const, const gum::DiscreteVariable* const,
gum::Idx, gum::Idx,
gum::Idx) override{}; gum::Idx) override{};
virtual void setFirstNotification(gum::Instantiation&) override{}; virtual void setFirstNotification(const gum::Instantiation&) override{};
virtual void setLastNotification(gum::Instantiation&) override{}; virtual void setLastNotification(const gum::Instantiation&) override{};
virtual void setIncNotification(gum::Instantiation&) override{}; virtual void setIncNotification(const gum::Instantiation&) override{};
virtual void setDecNotification(gum::Instantiation&) override{}; virtual void setDecNotification(const gum::Instantiation&) override{};
virtual void setChangeNotification(gum::Instantiation&) override{}; virtual void setChangeNotification(const gum::Instantiation&) override{};
const std::string toString(const gum::Instantiation* i) const override { const std::string toString(const gum::Instantiation* i) const override {
return i->toString(); return i->toString();
...@@ -172,8 +172,8 @@ namespace gum { ...@@ -172,8 +172,8 @@ namespace gum {
mutable HashTable< const DiscreteVariable*, GUM_SCALAR > __causal_weights; mutable HashTable< const DiscreteVariable*, GUM_SCALAR > __causal_weights;
/// @} /// @}
virtual void _swap(const DiscreteVariable* x, virtual void _replace(const DiscreteVariable* x,
const DiscreteVariable* y) override; const DiscreteVariable* y) override;
}; };
......
...@@ -55,7 +55,7 @@ namespace gum { ...@@ -55,7 +55,7 @@ namespace gum {
__causal_weights = from.__causal_weights; __causal_weights = from.__causal_weights;
} }
// Copy constructor using a bijection to swap variables from source. // Copy constructor using a bijection to replace variables from source.
template < typename GUM_SCALAR > template < typename GUM_SCALAR >
INLINE MultiDimICIModel< GUM_SCALAR >::MultiDimICIModel( INLINE MultiDimICIModel< GUM_SCALAR >::MultiDimICIModel(
const Bijection< const DiscreteVariable*, const DiscreteVariable* >& bij, const Bijection< const DiscreteVariable*, const DiscreteVariable* >& bij,
...@@ -157,9 +157,9 @@ namespace gum { ...@@ -157,9 +157,9 @@ namespace gum {
} }
template < typename GUM_SCALAR > template < typename GUM_SCALAR >
INLINE void MultiDimICIModel< GUM_SCALAR >::_swap(const DiscreteVariable* x, INLINE void MultiDimICIModel< GUM_SCALAR >::_replace(const DiscreteVariable* x,
const DiscreteVariable* y) { const DiscreteVariable* y) {
MultiDimReadOnly< GUM_SCALAR >::_swap(x, y); MultiDimReadOnly< GUM_SCALAR >::_replace(x, y);
__causal_weights.insert(y, __causal_weights[x]); __causal_weights.insert(y, __causal_weights[x]);
__causal_weights.erase(x); __causal_weights.erase(x);
} }
......
...@@ -44,7 +44,7 @@ namespace gum { ...@@ -44,7 +44,7 @@ namespace gum {
GUM_CONS_CPY(MultiDimLogit); GUM_CONS_CPY(MultiDimLogit);
} }
// Copy constructor using a bijection to swap variables from source. // Copy constructor using a bijection to replace variables from source.
template < typename GUM_SCALAR > template < typename GUM_SCALAR >
INLINE MultiDimLogit< GUM_SCALAR >::MultiDimLogit( INLINE MultiDimLogit< GUM_SCALAR >::MultiDimLogit(
const Bijection< const DiscreteVariable*, const DiscreteVariable* >& bij, const Bijection< const DiscreteVariable*, const DiscreteVariable* >& bij,
......
...@@ -50,7 +50,7 @@ namespace gum { ...@@ -50,7 +50,7 @@ namespace gum {
GUM_CONS_CPY(MultiDimNoisyAND); GUM_CONS_CPY(MultiDimNoisyAND);
} }
// Copy constructor using a bijection to swap variables from source. // Copy constructor using a bijection to replace variables from source.
template < typename GUM_SCALAR > template < typename GUM_SCALAR >
INLINE MultiDimNoisyAND< GUM_SCALAR >::MultiDimNoisyAND( INLINE MultiDimNoisyAND< GUM_SCALAR >::MultiDimNoisyAND(
const Bijection< const DiscreteVariable*, const DiscreteVariable* >& bij, const Bijection< const DiscreteVariable*, const DiscreteVariable* >& bij,
......
...@@ -45,7 +45,7 @@ namespace gum { ...@@ -45,7 +45,7 @@ namespace gum {
GUM_CONS_CPY(MultiDimNoisyORNet); GUM_CONS_CPY(MultiDimNoisyORNet);
} }
// Copy constructor using a bijection to swap variables from source. // Copy constructor using a bijection to replace variables from source.
template < typename GUM_SCALAR > template < typename GUM_SCALAR >
INLINE MultiDimNoisyORNet< GUM_SCALAR >::MultiDimNoisyORNet( INLINE MultiDimNoisyORNet< GUM_SCALAR >::MultiDimNoisyORNet(
const Bijection< const DiscreteVariable*, const DiscreteVariable* >& bij, const Bijection< const DiscreteVariable*, const DiscreteVariable* >& bij,
......
...@@ -112,20 +112,20 @@ namespace gum { ...@@ -112,20 +112,20 @@ namespace gum {
virtual std::string aggregatorName() const = 0; virtual std::string aggregatorName() const = 0;
const std::string toString() const override; const std::string toString() const override;
void changeNotification(gum::Instantiation&, void changeNotification(const gum::Instantiation&,
const gum::DiscreteVariable* const, const gum::DiscreteVariable* const,
gum::Idx, gum::Idx,
gum::Idx) override{}; gum::Idx) override{};
void setFirstNotification(gum::Instantiation&) override{}; void setFirstNotification(const gum::Instantiation&) override{};
void setLastNotification(gum::Instantiation&) override{}; void setLastNotification(const gum::Instantiation&) override{};
void setIncNotification(gum::Instantiation&) override{}; void setIncNotification(const gum::Instantiation&) override{};
void setDecNotification(gum::Instantiation&) override{}; void setDecNotification(const gum::Instantiation&) override{};
void setChangeNotification(gum::Instantiation&) override{}; void setChangeNotification(const gum::Instantiation&) override{};
const std::string toString(const gum::Instantiation* i) const override { const std::string toString(const gum::Instantiation* i) const override {
return i->toString(); return i->toString();
...@@ -136,7 +136,7 @@ namespace gum { ...@@ -136,7 +136,7 @@ namespace gum {
* *
* This function is used for compute @see compressionRatio() * This function is used for compute @see compressionRatio()
*/ */
Size realSize() const override { return 0; }; Size realSize() const override { return 0; };
/** /**
* @brief Returns the real name of the multiDimArray. * @brief Returns the real name of the multiDimArray.
...@@ -149,7 +149,7 @@ namespace gum { ...@@ -149,7 +149,7 @@ namespace gum {
* determine which is the best functions to use, say, when we wish to use * determine which is the best functions to use, say, when we wish to use
* operators such as operator+ on two MultiDimImplementations. * operators such as operator+ on two MultiDimImplementations.
*/ */
const std::string& name() const override; const std::string& name() const override;
/** /**
* @brief Copy of a multiDimICIModel. * @brief Copy of a multiDimICIModel.
...@@ -160,8 +160,7 @@ namespace gum { ...@@ -160,8 +160,7 @@ namespace gum {
* @throw OperationNotAllowed Raised if src does not have the same domain * @throw OperationNotAllowed Raised if src does not have the same domain
* size than this MultiDimContainer. * size than this MultiDimContainer.
**/ **/
void void copyFrom(const MultiDimContainer< GUM_SCALAR >& src) const override;
copyFrom(const MultiDimContainer< GUM_SCALAR >& src) const override;
/// @} /// @}
protected: protected:
......
...@@ -123,7 +123,7 @@ namespace gum { ...@@ -123,7 +123,7 @@ namespace gum {
* @param oldval The old value. * @param oldval The old value.
* @param newval The changed value. * @param newval The changed value.
*/ */
virtual void changeNotification(Instantiation& i, virtual void changeNotification(const Instantiation& i,
const DiscreteVariable* const var, const DiscreteVariable* const var,
Idx oldval, Idx oldval,
Idx newval) = 0; Idx newval) = 0;
...@@ -132,31 +132,31 @@ namespace gum { ...@@ -132,31 +132,31 @@ namespace gum {
* @brief Listen to setFirst in a given Instantiation. * @brief Listen to setFirst in a given Instantiation.
* @param i The Instantiation to listen. * @param i The Instantiation to listen.
*/ */
virtual void setFirstNotification(Instantiation& i) = 0; virtual void setFirstNotification(const Instantiation& i) = 0;
/** /**
* @brief Listen to setLast in a given Instantiation. * @brief Listen to setLast in a given Instantiation.
* @param i The Instantiation to listen. * @param i The Instantiation to listen.
*/ */
virtual void setLastNotification(Instantiation& i) = 0; virtual void setLastNotification(const Instantiation& i) = 0;
/** /**
* @brief Listen to increment in a given Instantiation. * @brief Listen to increment in a given Instantiation.
* @param i The Instantiation to listen. * @param i The Instantiation to listen.
*/ */
virtual void setIncNotification(Instantiation& i) = 0; virtual void setIncNotification(const Instantiation& i) = 0;
/** /**
* @brief Listen to increment in each recorded Instantiation. * @brief Listen to increment in each recorded Instantiation.
* @param i The Instantiation to listen. * @param i The Instantiation to listen.
*/ */
virtual void setDecNotification(Instantiation& i) = 0; virtual void setDecNotification(const Instantiation& i) = 0;
/** /**
* @brief Listen to an assignment of a value in a Instantiation. * @brief Listen to an assignment of a value in a Instantiation.
* @param i The Instantiation to listen. * @param i The Instantiation to listen.
*/ */
virtual void setChangeNotification(Instantiation& i) = 0; virtual void setChangeNotification(const Instantiation& i) = 0;
/** /**
* @brief Return a string representation of internal data about i in this. * @brief Return a string representation of internal data about i in this.
......
...@@ -245,7 +245,7 @@ namespace gum { ...@@ -245,7 +245,7 @@ namespace gum {
virtual GUM_SCALAR& _get(const Instantiation& i) const; virtual GUM_SCALAR& _get(const Instantiation& i) const;
virtual void _swap(const DiscreteVariable* x, const DiscreteVariable* y); virtual void _replace(const DiscreteVariable* x, const DiscreteVariable* y);
}; };
......
...@@ -219,8 +219,8 @@ namespace gum { ...@@ -219,8 +219,8 @@ namespace gum {
} }
template < typename GUM_SCALAR > template < typename GUM_SCALAR >
INLINE void MultiDimArray< GUM_SCALAR >::_swap(const DiscreteVariable* x, INLINE void MultiDimArray< GUM_SCALAR >::_replace(const DiscreteVariable* x,
const DiscreteVariable* y) { const DiscreteVariable* y) {
MultiDimImplementation< GUM_SCALAR >::_swap(x, y); MultiDimImplementation< GUM_SCALAR >::_replace(x, y);
} }
} /* namespace gum */ } /* namespace gum */
...@@ -173,7 +173,7 @@ namespace gum { ...@@ -173,7 +173,7 @@ namespace gum {
virtual void _commitMultipleChanges(); virtual void _commitMultipleChanges();
virtual void _swap(const DiscreteVariable* x, const DiscreteVariable* y); virtual void _replace(const DiscreteVariable *x, const DiscreteVariable *y);
private: private:
/// The true data. /// The true data.
......
...@@ -150,9 +150,9 @@ namespace gum { ...@@ -150,9 +150,9 @@ namespace gum {
} }
template < typename GUM_SCALAR > template < typename GUM_SCALAR >
INLINE void MultiDimBijArray< GUM_SCALAR >::_swap(const DiscreteVariable* x, INLINE void MultiDimBijArray< GUM_SCALAR >::_replace(const DiscreteVariable* x,
const DiscreteVariable* y) { const DiscreteVariable* y) {
MultiDimImplementation< GUM_SCALAR >::_swap(x, y); MultiDimImplementation< GUM_SCALAR >::_replace(x, y);
} }
} // namespace gum } // namespace gum
...@@ -229,20 +229,20 @@ namespace gum { ...@@ -229,20 +229,20 @@ namespace gum {
virtual GUM_SCALAR get(const Instantiation& i) const override; virtual GUM_SCALAR get(const Instantiation& i) const override;
virtual void changeNotification(Instantiation& i, virtual void changeNotification(const Instantiation& i,
const DiscreteVariable* const var, const DiscreteVariable* const var,
Idx oldval, Idx oldval,
Idx newval) override; Idx newval) override;
virtual void setFirstNotification(Instantiation& i) override; virtual void setFirstNotification(const Instantiation& i) override;
virtual void setLastNotification(Instantiation& i) override; virtual void setLastNotification(const Instantiation& i) override;
virtual void setIncNotification(Instantiation& i) override; virtual void setIncNotification(const Instantiation& i) override;
virtual void setDecNotification(Instantiation& i) override; virtual void setDecNotification(const Instantiation& i) override;
virtual void setChangeNotification(Instantiation& i) override; virtual void setChangeNotification(const Instantiation& i) override;
virtual bool registerSlave(Instantiation& i) override; virtual bool registerSlave(Instantiation& i) override;
...@@ -272,8 +272,8 @@ namespace gum { ...@@ -272,8 +272,8 @@ namespace gum {
*/ */
virtual GUM_SCALAR& _get(const Instantiation& i) const override; virtual GUM_SCALAR& _get(const Instantiation& i) const override;
virtual void _swap(const DiscreteVariable* x, virtual void _replace(const DiscreteVariable* x,
const DiscreteVariable* y) override; const DiscreteVariable* y) override;
private: private:
/// The number of element allowed in __bucket. /// The number of element allowed in __bucket.
......
...@@ -251,11 +251,17 @@ namespace gum { ...@@ -251,11 +251,17 @@ namespace gum {
template < typename GUM_SCALAR > template < typename GUM_SCALAR >
INLINE void MultiDimBucket< GUM_SCALAR >::changeNotification( INLINE void MultiDimBucket< GUM_SCALAR >::changeNotification(
Instantiation& i, const DiscreteVariable* const var, Idx oldval, Idx newval) { const Instantiation& i,
const DiscreteVariable* const var,
Idx oldval,
Idx newval) {
if (__bucket) { if (__bucket) {
try { try {
__bucket->changeNotification( __bucket->changeNotification(
*(__instantiations).second(&i), var, oldval, newval); *(__instantiations).second(const_cast< Instantiation* >(&i)),
var,
oldval,
newval);
} catch (NotFound&) { } catch (NotFound&) {
// Then i is not a slave of this // Then i is not a slave of this