aGrUM  0.14.2
rangeVariable.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
27 #ifndef GUM_RANGE_VARIABLE_H
28 #define GUM_RANGE_VARIABLE_H
29 
30 #include <ostream>
31 #include <sstream>
32 #include <string>
33 
34 #include <agrum/agrum.h>
35 
36 #include <agrum/core/hashFunc.h>
38 
39 namespace gum {
40 
52  public:
54 
57  RangeVariable(const std::string& aName,
58  const std::string& aDesc,
59  long minVal = 0,
60  long maxVal = 1);
61 
68  RangeVariable(const RangeVariable& aDRV);
69 
71  virtual ~RangeVariable();
72 
75  virtual DiscreteVariable* clone() const;
76 
78 
80 
88  virtual Size domainSize() const;
89 
91 
92  virtual VarType varType() const;
93 
95 
100  virtual std::string label(Idx indice) const;
101 
103  virtual double numerical(Idx indice) const;
104 
108  long minVal() const;
109 
113  void setMinVal(long minVal);
114 
118  long maxVal() const;
119 
123  void setMaxVal(long maxVal);
124 
128  bool belongs(long val) const;
129 
134  virtual Idx index(const std::string&) const;
135 
137 
140 
145 
147 
148  virtual const std::string domain() const;
149 
150  private:
152 
156 
159 
161  };
162 
163 } /* namespace gum */
164 
165 #ifndef GUM_NO_INLINE
167 #endif /* GUM_NO_INLINE */
168 
169 #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.
Base class for discrete random variable.
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.
Classes providing basic hash functions for hash tables.
Base class for discrete random variable.
gum is the global namespace for all aGrUM entities
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:38
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:51
Inline implementation of gumRangeVariable.
RangeVariable(const std::string &aName, const std::string &aDesc, long minVal=0, long maxVal=1)
Default constructor.
Size Idx
Type for indexes.
Definition: types.h:50
long __minBound
The lower bound.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:45
virtual const std::string domain() const
string represent the domain of the variable