aGrUM  0.16.0
rangeVariable.cpp
Go to the documentation of this file.
1 
31 
32 #ifdef GUM_NO_INLINE
34 #endif /* GUM_NO_INLINE */
35 
36 namespace gum {
37 
38  // ==========================================================================
39  // constructors
40  // ==========================================================================
41  RangeVariable::RangeVariable(const std::string& aName,
42  const std::string& aDesc,
43  long minVal,
44  long maxVal) :
45  DiscreteVariable(aName, aDesc),
46  __minBound(minVal), __maxBound(maxVal) {
47  GUM_CONSTRUCTOR(RangeVariable);
48  }
49 
50  RangeVariable::RangeVariable(const std::string& aName,
51  const std::string& aDesc) :
52  DiscreteVariable(aName, aDesc),
53  __minBound(0), __maxBound(1) {
54  GUM_CONSTRUCTOR(RangeVariable);
55  }
56 
57  // ==========================================================================
58  // Copy Constructor.
59  // If aDRV haves any listener, it will not be copied.
60  // @param aDRV the variable we copy
61  // ==========================================================================
64  __maxBound(aDRV.__maxBound) {
65  GUM_CONS_CPY(RangeVariable);
66  }
67 
68  // ==========================================================================
69  // destructor
70  // ==========================================================================
72 
73  const std::string RangeVariable::domain() const {
74  std::stringstream s;
75  s << "[" << minVal() << "-" << maxVal() << "]";
76  return s.str();
77  }
78 } /* namespace gum */
long __maxBound
The upper bound.
long minVal() const
Returns the lower bound.
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 ~RangeVariable()
destructor
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.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
long __minBound
The lower bound.
virtual const std::string domain() const
string represent the domain of the variable