aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
IScheduleMultiDim.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
47#ifndef GUM_ISCHEDULE_MULTI_DIM_H
48#define GUM_ISCHEDULE_MULTI_DIM_H
49
50#include <atomic>
51#include <memory>
52#include <string>
53
54#include <agrum/agrum.h>
55
58
59namespace gum {
60
68 public:
69 // ############################################################################
71 // ############################################################################
73
75
79 explicit IScheduleMultiDim(const Idx id = 0);
80
82 virtual IScheduleMultiDim* clone() const = 0;
83
85 virtual IScheduleMultiDim* clone(bool force_copy) const = 0;
86
89
91
92
93 // ############################################################################
95 // ############################################################################
96
98
100
102 virtual bool operator==(const IScheduleMultiDim&) const;
103
105
107 virtual bool operator!=(const IScheduleMultiDim&) const;
108
110
111
112 // ############################################################################
114 // ############################################################################
116
118
123 virtual bool hasSameVariables(const IScheduleMultiDim& m) const = 0;
124
126
130 virtual bool hasSameContent(const IScheduleMultiDim&) const = 0;
131
133
135 virtual bool isAbstract() const = 0;
136
138
141 virtual bool containsMultiDim() const = 0;
142
144
151 virtual void makeAbstract() = 0;
152
154
159 Idx id() const;
160
163
165 virtual Size domainSize() const = 0;
166
168
171 virtual double sizeOfContent() const = 0;
172
174 virtual std::string toString() const = 0;
175
177
181 static void resetIdGenerator();
182
184
185 protected:
188
191
194
197
198
201
202
203 private:
205 static Idx _newId_();
206
207 // the id used whenever any ScheduleMultiDim of any type asks for a new id
208 static std::atomic< Idx > _multidim_id_;
209 };
210
211} /* namespace gum */
212
214#ifndef GUM_NO_INLINE
216#endif /* GUM_NO_INLINE */
217
218#endif /* GUM_ISCHEDULE_MULTI_DIM_H */
The Table-agnostic base class of scheduleMultiDim.
IScheduleMultiDim(const IScheduleMultiDim &from)
copy constructor
Idx id_
the unique Id of the ScheduleMultiDim
virtual void makeAbstract()=0
if the ScheduleMultiDim is not abstract, make it abstract again
IScheduleMultiDim(IScheduleMultiDim &&from)
move constructor
virtual ~IScheduleMultiDim()
destructor
Idx id() const
returns the id of the ScheduleMultiDim
virtual bool isAbstract() const =0
returns whether the ScheduleMultiDim contains a real table or not
virtual const Sequence< const DiscreteVariable * > & variablesSequence() const =0
returns the set of variables involved in the ScheduleMultiDim
virtual double sizeOfContent() const =0
returns the sizeof of the elements stored into the ScheduleMultiDim
virtual Size domainSize() const =0
returns the domain size the table would have after its creation
virtual IScheduleMultiDim * clone() const =0
virtual copy constructor
IScheduleMultiDim & operator=(IScheduleMultiDim &&from)
move operator
static Idx _newId_()
returns a new distinct ID for each abstract scheduleMultiDim
IScheduleMultiDim(const Idx id=0)
constructs a IScheduleMultiDim
static std::atomic< Idx > _multidim_id_
virtual IScheduleMultiDim * clone(bool force_copy) const =0
virtual copy constructor enabling to force a copy of the content
virtual bool operator!=(const IScheduleMultiDim &) const
checks whether two IScheduleMultiDim have different IDs
virtual bool operator==(const IScheduleMultiDim &) const
checks whether two IScheduleMultiDim have exactly the same ID
virtual bool containsMultiDim() const =0
indicates whether the ScheduleMultiDim contains a table and possesses it
virtual bool hasSameVariables(const IScheduleMultiDim &m) const =0
checks whether two IScheduleMultiDim have the same variables
IScheduleMultiDim & operator=(const IScheduleMultiDim &from)
copy operator
static void resetIdGenerator()
reset the id generator to 0
virtual std::string toString() const =0
displays the content of the ScheduleMultiDim
virtual bool hasSameContent(const IScheduleMultiDim &) const =0
checks whether two IScheduleMultiDim contain precisely the same table
The generic class for storing (ordered) sequences of objects.
Definition sequence.h:972
Base class for discrete random variable.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition types.h:74
Size Idx
Type for indexes.
Definition types.h:79
gum is the global namespace for all aGrUM entities
Definition agrum.h:46
Header file of gum::Sequence, a class for storing (ordered) sequences of objects.