aGrUM  0.16.0
rangeVariable.h
Go to the documentation of this file.
1 
30 #ifndef GUM_RANGE_VARIABLE_H
31 #define GUM_RANGE_VARIABLE_H
32 
33 #include <ostream>
34 #include <sstream>
35 #include <string>
36 
37 #include <agrum/agrum.h>
38 
39 #include <agrum/core/hashFunc.h>
41 
42 namespace gum {
43 
55  public:
57 
60  RangeVariable(const std::string& aName,
61  const std::string& aDesc,
62  long minVal,
63  long maxVal);
64 
66  RangeVariable(const std::string& aName, const std::string& aDesc);
67 
74  RangeVariable(const RangeVariable& aDRV);
75 
77  virtual ~RangeVariable();
78 
81  virtual DiscreteVariable* clone() const;
82 
84 
86 
94  virtual Size domainSize() const;
95 
97 
98  virtual VarType varType() const;
99 
101 
106  virtual std::string label(Idx indice) const;
107 
109  virtual double numerical(Idx indice) const;
110 
114  long minVal() const;
115 
119  void setMinVal(long minVal);
120 
124  long maxVal() const;
125 
129  void setMaxVal(long maxVal);
130 
134  bool belongs(long val) const;
135 
140  virtual Idx index(const std::string&) const;
141 
143 
146 
151 
153 
154  virtual const std::string domain() const;
155 
156  private:
158 
162 
165 
167  };
168 
169 } /* namespace gum */
170 
171 #ifndef GUM_NO_INLINE
173 #endif /* GUM_NO_INLINE */
174 
175 #endif /* GUM_RANGE_VARIABLE_H */
bool belongs(long val) const
Returns true if the param belongs to the variable&#39;s interval.
long __maxBound
The upper bound.
virtual Idx index(const std::string &) const
virtual std::string label(Idx indice) const
Get the indice-th label.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
RangeVariable & operator=(const RangeVariable &aRV)
Copy operator.
virtual Size domainSize() const
returns the size of the random discrete variable domain
virtual double numerical(Idx indice) const
get a numerical representation of he indice-the value.
long minVal() const
Returns the lower bound.
void setMinVal(long minVal)
Set a new value for the lower bound.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Base class for discrete random variable.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
virtual VarType varType() const
returns the type of variable
virtual ~RangeVariable()
destructor
virtual DiscreteVariable * clone() const
Copy Factory.
VarType
Definition: variable.h:41
void setMaxVal(long maxVal)
Set a new value of the upper bound.
long maxVal() const
Returns the upper bound.
Defines a discrete random variable over an integer interval.
Definition: rangeVariable.h:54
RangeVariable(const std::string &aName, const std::string &aDesc, long minVal, long maxVal)
constructors
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Size Idx
Type for indexes.
Definition: types.h:53
long __minBound
The lower bound.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:48
virtual const std::string domain() const
string represent the domain of the variable