aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
IContinuousVariable.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 Header of IContinuousVariable.
25  *
26  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
27  */
28 #ifndef GUM_I_CONTINUOUS_VARIABLE_H
29 #define GUM_I_CONTINUOUS_VARIABLE_H
30 
31 #include <iostream>
32 #include <string>
33 
34 #include <agrum/agrum.h>
35 #include <agrum/tools/variables/variable.h>
36 
37 namespace gum {
38 
39  /** @class IContinuousVariable
40  * @headerfile IContinuousVariable.h <agrum/tools/variables/IContinuousVariable.h>
41  * @ingroup multidim_group
42  * @brief A base class for continuous variables, independent of the
43  * GUM_SCALAR type
44  */
45  class IContinuousVariable: public Variable {
46  public:
47  // ############################################################################
48  /// @name Constructors / Destructors
49  // ############################################################################
50  /// @{
51 
52  /// Default constructor
53  IContinuousVariable(const std::string& aName, const std::string& aDesc);
54 
55  /** Copy Constructor.
56  *
57  * If from has any listener, it will not be copied.
58  *
59  * @param from the variable we copy
60  */
61  IContinuousVariable(const IContinuousVariable& from);
62 
63  /// move constructor
64  IContinuousVariable(IContinuousVariable&& from);
65 
66  /// destructor
67  virtual ~IContinuousVariable();
68 
69  /// Copy Factory
70  virtual IContinuousVariable* clone() const = 0;
71 
72  /// @}
73 
74 
75  // ############################################################################
76  /// @name Accessors / Modifiers
77  // ############################################################################
78  /// @{
79 
80  /// returns the lower bound of the domain of the variable as a double
81  virtual double lowerBoundAsDouble() const = 0;
82 
83  /// returns the upper bound of the domain of the variable as a double
84  virtual double upperBoundAsDouble() const = 0;
85 
86  /// updates the lower bound of the domain of the variable
87  /** @throw OutOfBounds is raised if the new bound is higher than the
88  * current upper bound. */
89  virtual void setLowerBoundFromDouble(const double new_bound) = 0;
90 
91  /// updates the lower bound of the domain of the variable
92  /** @throw OutOfBounds is raised if the new bound is lower than the
93  * current lower bound */
94  virtual void setUpperBoundFromDouble(const double new_bound) = 0;
95 
96  /// @}
97 
98 
99  protected:
100  /// copy operator
101  IContinuousVariable& operator=(const IContinuousVariable& from);
102 
103  /// move operator
104  IContinuousVariable& operator=(IContinuousVariable&& from);
105  };
106 
107 
108 } /* namespace gum */
109 
110 
111 #ifndef GUM_NO_INLINE
112 # include <agrum/tools/variables/IContinuousVariable_inl.h>
113 #endif /* GUM_NO_INLINE */
114 
115 #endif /* GUM_I_CONTINUOUS_VARIABLE_H */