aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
PRMClassElement_tpl.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#pragma once
41
42
51
52namespace gum {
53 namespace prm {
54
55 template < typename GUM_SCALAR >
57 GUM_CONSTRUCTOR(PRMClassElement);
58 }
59
60 template < typename GUM_SCALAR >
65
66 template < typename GUM_SCALAR >
70
71 template < typename GUM_SCALAR >
73 return _id_;
74 }
75
76 template < typename GUM_SCALAR >
80
81 template < typename GUM_SCALAR >
83 _id_ = id;
84 }
85
86 template < typename GUM_SCALAR >
87 INLINE const std::string& PRMClassElement< GUM_SCALAR >::safeName() const {
88 return safeName_;
89 }
90
91 template < typename GUM_SCALAR >
92 INLINE std::string PRMClassElement< GUM_SCALAR >::cast(const PRMType& t) const {
93 if (type().isSubTypeOf(t)) {
95 } else {
96 GUM_ERROR(OperationNotAllowed, "illegal cast")
97 }
98 }
99
100 } /* namespace prm */
101} /* namespace gum */
Headers of gum::PRMClassElement.
Headers of Class.
Exception : operation not allowed.
virtual std::string cast(const PRMType &t) const
Returns the name of the cast descendant with PRMType t of this PRMClassElement.
virtual PRMObject::prm_type obj_type() const
NodeId _id_
The node's id of this element.
PRMClassElement(const std::string &name)
Default constructor of a PRMClassElement.
virtual void setId(NodeId id)
Used to assign the id of this element.
NodeId id() const
Returns the NodeId of this element in it's class DAG.
virtual PRMType & type()=0
Return a reference over the gum::PRMType of this class element.
const std::string & safeName() const
Returns the safe name of this PRMClassElement, if any.
virtual ~PRMClassElement()
Destructor of this class.
std::string safeName_
The safe name of this PRMClassElement.
const std::string & name() const
Returns the name of this object.
prm_type
Enumeration of the different types of objects handled by a PRM.
Definition PRMObject.h:88
PRMObject(const std::string &name)
Constructor.
Definition PRMObject.cpp:62
static std::string LEFT_CAST()
Enumeration of the different types of objects handled by a PRM.
Definition PRMObject.h:90
static std::string RIGHT_CAST()
Enumeration of the different types of objects handled by a PRM.
Definition PRMObject.h:92
This is a decoration of the DiscreteVariable class.
Definition PRMType.h:78
const std::string & name() const
Returns the name of this object.
Definition PRMType_inl.h:78
#define GUM_ERROR(type, msg)
Definition exceptions.h:72
Size NodeId
Type for node ids.
namespace for all probabilistic relational models entities
Definition agrum.h:68
gum is the global namespace for all aGrUM entities
Definition agrum.h:46