aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
PRMParameter.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4  * info_at_agrum_dot_org
5  *
6  * This library is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 /**
23  * @file
24  * @brief Headers of gum::PRMParameter.
25  *
26  * @author Lionel TORTI and Pierre-Henri WUILLEMIN(@LIP6)
27  */
28 
29 #ifndef GUM_PARAMETER_H
30 #define GUM_PARAMETER_H
31 
32 #include <agrum/tools/multidim/potential.h>
33 
34 #include <agrum/PRM/elements/PRMType.h>
35 #include <agrum/PRM/elements/PRMClassElement.h>
36 #include <agrum/PRM/elements/PRMAttribute.h>
37 
38 
39 namespace gum {
40  namespace prm {
41 
42  /**
43  * @class PRMParameter
44  * @headerfile parameter.h <agrum/PRM/parameter.h>
45  * @brief PRMParameter is a member of a Class in a PRM.
46  *
47  * @see PRM PRMFactory Class PRMClassElement
48  * @ingroup prm_group
49  */
50  template < typename GUM_SCALAR >
52  public:
54  {
55  INT,
57  };
58 
59  // ========================================================================
60  /// @name Constructor & destructor.
61  // ========================================================================
62  /// @{
63 
64  /**
65  * @brief Constructor used by gum::Class.
66  *
67  * @param name
68  * @param type
69  * @param value
70  */
71  PRMParameter(const std::string& name, ParameterType type, GUM_SCALAR value);
72 
73  /// Destructor.
74  virtual ~PRMParameter();
75 
76  /// @}
77  // ========================================================================
78  /// @name Getters & setters
79  // ========================================================================
80  /// @{
81 
82  /// See gum::PRMClassElement::elt_type().
83  virtual typename PRMClassElement< GUM_SCALAR >::ClassElementType elt_type() const;
84 
85  GUM_SCALAR value() const;
86 
87  void value(GUM_SCALAR value);
88 
89  ParameterType valueType() const;
90 
91  /// See gum::PRMClassElement::type().
92  virtual PRMType& type();
93 
94  /// See gum::PRMClassElement::type().
95  virtual const PRMType& type() const;
96 
97  /// See gum::PRMClassElement::cpf().
98  virtual Potential< GUM_SCALAR >& cpf();
99 
100  /// See gum::PRMClassElement::cpf().
101  virtual const Potential< GUM_SCALAR >& cpf() const;
102 
103  /// See gum::PRMClassElement::addParent().
104  void addParent(const gum::prm::PRMClassElement< GUM_SCALAR >&);
105 
106  /// See gum::PRMClassElement::addChild().
107  void addChild(const gum::prm::PRMClassElement< GUM_SCALAR >&);
108 
109  /// @brief Raise a gum::OperationNotAllowed
110  /// See gum::PRMClassElement::getCastDescendant()
111  virtual PRMAttribute< GUM_SCALAR >* getCastDescendant() const;
112 
113  /// @}
114  protected:
115  /// Copy constructor. Don't use it.
116  PRMParameter(const PRMParameter< GUM_SCALAR >& source);
117 
118  /// Copy operator. Don't use it.
119  PRMParameter< GUM_SCALAR >& operator=(const PRMParameter< GUM_SCALAR >& from);
120 
121  private:
122  // ========================================================================
123  /// @name Private members
124  // ========================================================================
125  /// @{
126 
128 
129  GUM_SCALAR _value_;
130 
131  /// @}
132  };
133 
134 
135 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
136  extern template class PRMParameter< double >;
137 #endif
138 
139 
140  } /* namespace prm */
141 } // namespace gum
142 
143 #include <agrum/PRM/elements/PRMParameter_tpl.h>
144 
145 #endif /* GUM_PARAMETER_H */
virtual Potential< GUM_SCALAR > & cpf()
See gum::PRMClassElement::cpf().
virtual const Potential< GUM_SCALAR > & cpf() const
See gum::PRMClassElement::cpf().
virtual ~PRMParameter()
Destructor.
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
PRMParameter< GUM_SCALAR > & operator=(const PRMParameter< GUM_SCALAR > &from)
Copy operator. Don&#39;t use it.
GUM_SCALAR value() const
See gum::PRMClassElement::elt_type().
void addParent(const gum::prm::PRMClassElement< GUM_SCALAR > &)
See gum::PRMClassElement::addParent().
PRMParameter(const std::string &name, ParameterType type, GUM_SCALAR value)
Constructor used by gum::Class.
virtual const PRMType & type() const
See gum::PRMClassElement::type().
PRMParameter(const PRMParameter< GUM_SCALAR > &source)
Copy constructor. Don&#39;t use it.
ParamScopeData(const std::string &s, const PRMReferenceSlot< GUM_SCALAR > &ref, Idx d)
ParameterType _type_
Definition: PRMParameter.h:127
void value(GUM_SCALAR value)
See gum::PRMClassElement::elt_type().
virtual PRMAttribute< GUM_SCALAR > * getCastDescendant() const
Raise a gum::OperationNotAllowed See gum::PRMClassElement::getCastDescendant()
virtual PRMType & type()
See gum::PRMClassElement::type().
ParameterType valueType() const
See gum::PRMClassElement::elt_type().
void addChild(const gum::prm::PRMClassElement< GUM_SCALAR > &)
See gum::PRMClassElement::addChild().
virtual PRMClassElement< GUM_SCALAR >::ClassElementType elt_type() const
See gum::PRMClassElement::elt_type().