aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
PRM.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
48
49#ifndef GUM_PRM_H
50#define GUM_PRM_H
51
52#include <string>
53
56
57namespace gum {
58 namespace prm {
59
60 template < typename GUM_SCALAR >
61 class PRMSystem;
62 template < typename GUM_SCALAR >
63 class PRMFactory;
64
73 template < typename GUM_SCALAR >
74 class PRM {
75 public:
76 friend class PRMFactory< GUM_SCALAR >;
77
78 // ========================================================================
80 // ========================================================================
82
86 PRM();
87
91 ~PRM();
92
94 // ========================================================================
96 // ========================================================================
98
103 bool isType(const std::string& name) const;
104
109 bool isClass(const std::string& name) const;
110
117 bool isInterface(const std::string& name) const;
118
123 bool isSystem(const std::string& name) const;
124
129 PRMType& type(const std::string& name);
130
135 const PRMType& type(const std::string& name) const;
136
140 const Set< PRMType* >& types() const;
141
146 PRMClass< GUM_SCALAR >& getClass(const std::string& name);
147
152 const PRMClass< GUM_SCALAR >& getClass(const std::string& name) const;
153
157 const Set< PRMClass< GUM_SCALAR >* >& classes() const;
158
163 PRMInterface< GUM_SCALAR >& getInterface(const std::string& name);
164
169 const PRMInterface< GUM_SCALAR >& getInterface(const std::string& name) const;
170
175
181 PRMSystem< GUM_SCALAR >& getSystem(const std::string& name);
182
188 const PRMSystem< GUM_SCALAR >& getSystem(const std::string& name) const;
189
193 const Set< PRMSystem< GUM_SCALAR >* >& systems() const;
194
196
197 private:
198 // ========================================================================
200 // ========================================================================
202
206 PRM(const PRM< GUM_SCALAR >& source);
207
212
214 void _addBuiltInTypes_();
215
217 // ========================================================================
219 // ========================================================================
221
224
227
230
233
236
239
242
245
247 };
248
249
250#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
251 extern template class PRM< double >;
252#endif
253
254
255 } /* namespace prm */
256} /* namespace gum */
257
258#include <agrum/PRM/PRM_tpl.h>
259
260#endif /* GUM_PRM_H */
Headers of gum::PRMAttribute.
Headers of PRMSystem.
Inline implementation of PRM.
The class for generic Hash Tables.
Definition hashTable.h:637
Representation of a set.
Definition set.h:131
A PRMClass is an object of a PRM representing a fragment of a Bayesian network which can be instantia...
Definition PRMClass.h:75
Factory which builds a PRM<GUM_SCALAR>.
Definition PRMFactory.h:88
An PRMInterface is implemented by a Class<GUM_SCALAR> and defines a set of PRMReferenceSlot<GUM_SCALA...
A PRMSystem is a container of PRMInstance and describe a relational skeleton.
Definition PRMSystem.h:70
This is a decoration of the DiscreteVariable class.
Definition PRMType.h:78
HashTable< std::string, PRMType * > _typeMap_
Mapping of all PRMType given their name.
Definition PRM.h:235
Set< PRMType * > _types_
Set of all PRMType in this PRM.
Definition PRM.h:238
PRM()
Default constructor.
Definition PRM_tpl.h:56
HashTable< std::string, PRMClass< GUM_SCALAR > * > _classMap_
Mapping of all Class<GUM_SCALAR> given their name.
Definition PRM.h:223
PRMType & type(const std::string &name)
Returns a constant reference on a PRMType given it's name.
Definition PRM_tpl.h:114
Set< PRMSystem< GUM_SCALAR > * > _systems_
Set of all Systems in this PRM.
Definition PRM.h:244
HashTable< std::string, PRMInterface< GUM_SCALAR > * > _interfaceMap_
Mapping of all Class<GUM_SCALAR> given their name.
Definition PRM.h:229
PRMInterface< GUM_SCALAR > & getInterface(const std::string &name)
Returns a constant reference on a Class<GUM_SCALAR> given it's name.
Definition PRM_tpl.h:145
Set< PRMInterface< GUM_SCALAR > * > _interfaces_
Set of all Class<GUM_SCALAR> in this PRM.
Definition PRM.h:232
~PRM()
Destructor.
Definition PRM_tpl.h:63
void _addBuiltInTypes_()
Add the built-in types in the PRM.
Definition PRM_tpl.h:84
PRMSystem< GUM_SCALAR > & getSystem(const std::string &name)
Returns a constant reference on a PRMSystem<GUM_SCALAR> given it's name.
Definition PRM_tpl.h:161
const Set< PRMType * > & types() const
Returns the Set of all PRMType in this PRM.
Definition PRM_tpl.h:124
bool isType(const std::string &name) const
Definition PRM_tpl.h:94
PRM(const PRM< GUM_SCALAR > &source)
Copy constructor.
bool isSystem(const std::string &name) const
Definition PRM_tpl.h:109
const Set< PRMClass< GUM_SCALAR > * > & classes() const
Returns the Set of all Class<GUM_SCALAR> in this PRM.
Definition PRM_tpl.h:140
bool isClass(const std::string &name) const
Definition PRM_tpl.h:99
const Set< PRMInterface< GUM_SCALAR > * > & interfaces() const
Returns the Set of all Class<GUM_SCALAR> in this PRM.
Definition PRM_tpl.h:156
PRM< GUM_SCALAR > & operator=(const PRM< GUM_SCALAR > &source)
Copy operator.
HashTable< std::string, PRMSystem< GUM_SCALAR > * > _systemMap_
Mapping of all Systems given their name.
Definition PRM.h:241
Set< PRMClass< GUM_SCALAR > * > _classes_
Set of all Class<GUM_SCALAR> in this PRM.
Definition PRM.h:226
PRMClass< GUM_SCALAR > & getClass(const std::string &name)
Returns a constant reference on a Class<GUM_SCALAR> given it's name.
Definition PRM_tpl.h:129
const Set< PRMSystem< GUM_SCALAR > * > & systems() const
Returns the Set of all Systems in this PRM.
Definition PRM_tpl.h:172
bool isInterface(const std::string &name) const
Definition PRM_tpl.h:104
namespace for all probabilistic relational models entities
Definition agrum.h:68
gum is the global namespace for all aGrUM entities
Definition agrum.h:46