aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
multiDimAdressable.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2025 by *
5 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
6 * - Christophe GONZALES(_at_AMU) *
7 * *
8 * The aGrUM/pyAgrum library is free software; you can redistribute it *
9 * and/or modify it under the terms of either : *
10 * *
11 * - the GNU Lesser General Public License as published by *
12 * the Free Software Foundation, either version 3 of the License, *
13 * or (at your option) any later version, *
14 * - the MIT license (MIT), *
15 * - or both in dual license, as here. *
16 * *
17 * (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18 * *
19 * This aGrUM/pyAgrum library is distributed in the hope that it will be *
20 * useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26 * OTHER DEALINGS IN THE SOFTWARE. *
27 * *
28 * See LICENCES for more details. *
29 * *
30 * SPDX-FileCopyrightText: Copyright 2005-2025 *
31 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
32 * - Christophe GONZALES(_at_AMU) *
33 * SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34 * *
35 * Contact : info_at_agrum_dot_org *
36 * homepage : http://agrum.gitlab.io *
37 * gitlab : https://gitlab.com/agrumery/agrum *
38 * *
39 ****************************************************************************/
40
41
52
53#ifndef GUM_MULTIDIM_ADRESSABLE_H
54#define GUM_MULTIDIM_ADRESSABLE_H
55
56#include <iostream>
57#include <vector>
58
59#include <agrum/agrum.h>
60
62
63namespace gum {
64 // =========================================================================
65 // === GUM_MULTI_DIM_ADRESSABLE ===
66 // =========================================================================
79 public:
80 // =======================================================================
82 // =======================================================================
84
89
95
101
102
106 ~MultiDimAdressable() override;
107
109 // =======================================================================
111 // =======================================================================
113
119
125 virtual const MultiDimAdressable& getMasterRef() const = 0;
126
132 virtual bool registerSlave(Instantiation& i) = 0;
133
139 virtual bool unregisterSlave(Instantiation& i) = 0;
140
148 virtual void changeNotification(const Instantiation& i,
149 const DiscreteVariable* const var,
150 Idx oldval,
151 Idx newval)
152 = 0;
153
158 virtual void setFirstNotification(const Instantiation& i) = 0;
159
164 virtual void setLastNotification(const Instantiation& i) = 0;
165
170 virtual void setIncNotification(const Instantiation& i) = 0;
171
176 virtual void setDecNotification(const Instantiation& i) = 0;
177
182 virtual void setChangeNotification(const Instantiation& i) = 0;
183
189 virtual std::string toString(const Instantiation* i) const = 0;
190
192 };
193
194} /* namespace gum */
195
196#ifndef GUM_NO_INLINE
198#endif /* GUM_NO_INLINE */
199
200#endif /* GUM_MULTIDIM_ADRESSABLE_H */
Base class for discrete random variable.
Class for assigning/browsing values to tuples of discrete variables.
virtual std::string toString(const Instantiation *i) const =0
Return a string representation of internal data about i in this.
~MultiDimAdressable() override
Destructor.
MultiDimAdressable()
Default constructor.
virtual void setChangeNotification(const Instantiation &i)=0
Listen to an assignment of a value in a Instantiation.
virtual void setLastNotification(const Instantiation &i)=0
Listen to setLast in a given Instantiation.
virtual void setFirstNotification(const Instantiation &i)=0
Listen to setFirst in a given Instantiation.
virtual void setDecNotification(const Instantiation &i)=0
Listen to increment in each recorded Instantiation.
virtual bool registerSlave(Instantiation &i)=0
Register i as a slave of this MultiDimAdressable.
virtual const MultiDimAdressable & getMasterRef() const =0
In order to insure the dereference for decorators, we need to virtualize the access to master pointer...
virtual MultiDimAdressable & getMasterRef()=0
In order to insure the dereference for decorators, we need to virtualize the access to master pointer...
virtual void changeNotification(const Instantiation &i, const DiscreteVariable *const var, Idx oldval, Idx newval)=0
Listen to changes in a given Instantiation.
virtual void setIncNotification(const Instantiation &i)=0
Listen to increment in a given Instantiation.
virtual bool unregisterSlave(Instantiation &i)=0
Unregister i as a slave of this MultiDimAdressable.
MultiDimAdressable & operator=(const MultiDimAdressable &from)
Default constructor.
Interface for all classes addressing in a multiDim fashion.
Size Idx
Type for indexes.
Definition types.h:79
Header files of gum::Instantiation.
Inline implementation for the abstract base class for all multi dimensionnal containers.
gum is the global namespace for all aGrUM entities
Definition agrum.h:46