aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
PRMObject.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2026 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-2026 *
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
48
49#ifndef GUM_PRM_OBJECT_H
50#define GUM_PRM_OBJECT_H
51
52#include <string>
53
54#include <agrum/agrum.h>
55
56#include <string_view>
57
58namespace gum {
59
60 namespace prm {
76
77 class PRMObject {
78 public:
79 // ==========================================================================
81 // ==========================================================================
83
91
92 static std::string LEFT_CAST();
93
94 static std::string RIGHT_CAST();
95
97 static std::string enum2str(prm_type type);
98
100 static INLINE bool isClass(const PRMObject& obj);
101
103 static INLINE bool isInterface(const PRMObject& obj);
104
106 static INLINE bool isInstance(const PRMObject& obj);
107
109 // ==========================================================================
111 // ==========================================================================
113
118 explicit PRMObject(std::string_view name);
119
123 PRMObject(const PRMObject& source);
124
128 PRMObject(PRMObject&& source);
129
133 virtual ~PRMObject();
134
136 // ==========================================================================
138 // ==========================================================================
140
144 const std::string& name() const;
145
150 void name(std::string_view name);
151
155 virtual prm_type obj_type() const = 0;
156
158 // ==========================================================================
160 // ==========================================================================
162
166 bool operator==(const PRMObject& obj) const;
167
171 bool operator!=(const PRMObject& obj) const;
172
177
181 PRMObject& operator=(PRMObject&& source);
182
184
185 private:
186 // ==========================================================================
188 // ==========================================================================
190
191 // The name of this object
192 // ======================================================================
193 std::string _name_;
194
196 };
197
199 std::ostream& operator<<(std::ostream& out, PRMObject::prm_type obj_type);
200
201 // list of declarations of PRMObjects
202 class PRMType;
203 template < GUM_Numeric GUM_SCALAR >
204 class PRMClassElement;
205 template < GUM_Numeric GUM_SCALAR >
207 template < GUM_Numeric GUM_SCALAR >
208 class PRMAggregate;
209 template < GUM_Numeric GUM_SCALAR >
210 class PRMInterface;
211 template < GUM_Numeric GUM_SCALAR >
212 class PRMAttribute;
213 template < GUM_Numeric GUM_SCALAR >
214 class PRMSlotChain;
215 template < GUM_Numeric GUM_SCALAR >
216 class PRMReferenceSlot;
217 template < GUM_Numeric GUM_SCALAR >
218 class PRMClass;
219 template < GUM_Numeric GUM_SCALAR >
220 class PRMInstance;
221 template < GUM_Numeric GUM_SCALAR >
222 class PRMSystem;
223
224 } /* namespace prm */
225} /* namespace gum */
226
227#ifndef GUM_NO_INLINE
229#endif // GUM_NO_INLINE
230
231#endif /* GUM_PRM_OBJECT_H */
Inline implementation of PRMObject.
PRMAttribute is a member of a Class in a PRM.
<agrum/PRM/classElementContainer.h>
Abstract class representing an element of PRM class.
A PRMClass is an object of a PRM representing a fragment of a Bayesian network which can be instantia...
Definition PRMClass.h:77
An PRMInstance is a Bayesian network fragment defined by a Class and used in a PRMSystem.
Definition PRMInstance.h:79
An PRMInterface is implemented by a Class<GUM_SCALAR> and defines a set of PRMReferenceSlot<GUM_SCALA...
Abstract base class for any element defined in a PRM.
Definition PRMObject.h:77
PRMObject(std::string_view name)
Constructor.
Definition PRMObject.cpp:62
const std::string & name() const
Returns the name of this object.
bool operator==(const PRMObject &obj) const
To PRMObject are equal if they have the same name (which is unique).
prm_type
Enumeration of the different types of objects handled by a PRM.
Definition PRMObject.h:90
bool operator!=(const PRMObject &obj) const
To PRMObject are equal if they have the same name (which is unique).
PRMObject & operator=(const PRMObject &source)
Copy operator.
std::string _name_
Definition PRMObject.h:193
static std::string RIGHT_CAST()
Enumeration of the different types of objects handled by a PRM.
static INLINE bool isClass(const PRMObject &obj)
Returns true if obj_ptr is of type Class.
static std::string LEFT_CAST()
Enumeration of the different types of objects handled by a PRM.
virtual ~PRMObject()
Destructor.
Definition PRMObject.cpp:81
virtual prm_type obj_type() const =0
Returns the type of this object.
static INLINE bool isInstance(const PRMObject &obj)
Returns true if obj_ptr is of type PRMInstance.
static INLINE bool isInterface(const PRMObject &obj)
Returns true if obj_ptr is of type PRMInterface.
static std::string enum2str(prm_type type)
Returns the string representation of a PRMObject.
A PRMReferenceSlot represent a relation between two PRMClassElementContainer.
A PRMSlotChain represents a sequence of gum::prm::PRMClassElement<GUM_SCALAR> where the n-1 first gum...
A PRMSystem is a container of PRMInstance and describe a relational skeleton.
Definition PRMSystem.h:72
This is a decoration of the DiscreteVariable class.
Definition PRMType.h:78
namespace for all probabilistic relational models entities
Definition agrum.h:68
std::ostream & operator<<(std::ostream &out, PRMObject::prm_type obj_type)
For printing PRMType easily.
Definition PRMObject.cpp:98
gum is the global namespace for all aGrUM entities
Definition agrum.h:46