aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
PRMParameter.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright 2005-2020 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
84  elt_type() const;
85 
86  GUM_SCALAR value() const;
87 
88  void value(GUM_SCALAR value);
89 
90  ParameterType valueType() const;
91 
92  /// See gum::PRMClassElement::type().
93  virtual PRMType& type();
94 
95  /// See gum::PRMClassElement::type().
96  virtual const PRMType& type() const;
97 
98  /// See gum::PRMClassElement::cpf().
99  virtual Potential< GUM_SCALAR >& cpf();
100 
101  /// See gum::PRMClassElement::cpf().
102  virtual const Potential< GUM_SCALAR >& cpf() const;
103 
104  /// See gum::PRMClassElement::addParent().
105  void addParent(const gum::prm::PRMClassElement< GUM_SCALAR >&);
106 
107  /// See gum::PRMClassElement::addChild().
108  void addChild(const gum::prm::PRMClassElement< GUM_SCALAR >&);
109 
110  /// @brief Raise a gum::OperationNotAllowed
111  /// See gum::PRMClassElement::getCastDescendant()
112  virtual PRMAttribute< GUM_SCALAR >* getCastDescendant() const;
113 
114  /// @}
115  protected:
116  /// Copy constructor. Don't use it.
117  PRMParameter(const PRMParameter< GUM_SCALAR >& source);
118 
119  /// Copy operator. Don't use it.
120  PRMParameter< GUM_SCALAR >&
121  operator=(const PRMParameter< GUM_SCALAR >& from);
122 
123  private:
124  // ========================================================================
125  /// @name Private members
126  // ========================================================================
127  /// @{
128 
130 
131  GUM_SCALAR value__;
132 
133  /// @}
134  };
135 
136 
137 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
138  extern template class PRMParameter< double >;
139 #endif
140 
141 
142  } /* namespace prm */
143 } // namespace gum
144 
145 #include <agrum/PRM/elements/PRMParameter_tpl.h>
146 
147 #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:669
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().
ParameterType type__
Definition: PRMParameter.h:129
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)
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().