aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
PRMParameter_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
48
49namespace gum {
50 namespace prm {
51
52 template < typename GUM_SCALAR >
55 GUM_SCALAR value) :
56 PRMClassElement< GUM_SCALAR >(name), _type_(type), _value_(value) {
57 GUM_CONSTRUCTOR(PRMParameter);
58 this->safeName_ = name;
59 }
60
61 template < typename GUM_SCALAR >
63 PRMClassElement< GUM_SCALAR >(source.name()), _type_(source.valueType()),
64 _value_(source.value()) {
65 GUM_ERROR(OperationNotAllowed, "cannot copy Paramter<GUM_SCALAR")
66 }
67
68 template < typename GUM_SCALAR >
71 GUM_ERROR(OperationNotAllowed, "cannot copy Paramter<GUM_SCALAR")
72 }
73
74 template < typename GUM_SCALAR >
78
79 template < typename GUM_SCALAR >
85 template < typename GUM_SCALAR >
87 return _value_;
88 }
89
90 template < typename GUM_SCALAR >
94
95 template < typename GUM_SCALAR >
98 return _type_;
99 }
100
101 template < typename GUM_SCALAR >
103 GUM_ERROR(OperationNotAllowed, "Parameters do not have a type")
104 }
106 template < typename GUM_SCALAR >
108 GUM_ERROR(OperationNotAllowed, "Parameters do not have a type")
109 }
110
111 template < typename GUM_SCALAR >
112 Tensor< GUM_SCALAR >& PRMParameter< GUM_SCALAR >::cpf() {
113 GUM_ERROR(OperationNotAllowed, "Parameters do not have a cpf")
114 }
115
116 template < typename GUM_SCALAR >
117 const Tensor< GUM_SCALAR >& PRMParameter< GUM_SCALAR >::cpf() const {
118 GUM_ERROR(OperationNotAllowed, "Parameters do not have a cpf")
119 }
121 template < typename GUM_SCALAR >
125
126 template < typename GUM_SCALAR >
130
131 template < typename GUM_SCALAR >
133 GUM_ERROR(OperationNotAllowed, "Parameters can have cast descendants")
134 }
135
136 } /* namespace prm */
137} // namespace gum
Exception : operation not allowed.
PRMAttribute is a member of a Class in a PRM.
Abstract class representing an element of PRM class.
PRMClassElement(const std::string &name)
Default constructor of a PRMClassElement.
ClassElementType
Returns true if obj_ptr is of type PRMReferenceSlot.
std::string safeName_
The safe name of this PRMClassElement.
const std::string & name() const
Returns the name of this object.
PRMParameter is a member of a Class in a PRM.
void addChild(const gum::prm::PRMClassElement< GUM_SCALAR > &)
See gum::PRMClassElement::addChild().
PRMParameter< GUM_SCALAR > & operator=(const PRMParameter< GUM_SCALAR > &from)
Copy operator. Don't use it.
virtual PRMClassElement< GUM_SCALAR >::ClassElementType elt_type() const
See gum::PRMClassElement::elt_type().
ParameterType valueType() const
See gum::PRMClassElement::elt_type().
PRMParameter(const std::string &name, ParameterType type, GUM_SCALAR value)
Constructor used by gum::Class.
virtual ~PRMParameter()
Destructor.
virtual Tensor< GUM_SCALAR > & cpf()
See gum::PRMClassElement::cpf().
virtual PRMType & type()
See gum::PRMClassElement::type().
GUM_SCALAR value() const
See gum::PRMClassElement::elt_type().
virtual PRMAttribute< GUM_SCALAR > * getCastDescendant() const
Raise a gum::OperationNotAllowed See gum::PRMClassElement::getCastDescendant().
void addParent(const gum::prm::PRMClassElement< GUM_SCALAR > &)
See gum::PRMClassElement::addParent().
This is a decoration of the DiscreteVariable class.
Definition PRMType.h:78
#define GUM_ERROR(type, msg)
Definition exceptions.h:72
namespace for all probabilistic relational models entities
Definition agrum.h:68
gum is the global namespace for all aGrUM entities
Definition agrum.h:46