aGrUM  0.16.0
variable.h
Go to the documentation of this file.
1 
31 #ifndef GUM_VARIABLE_H
32 #define GUM_VARIABLE_H
33 
34 #include <iostream>
35 #include <string>
36 
37 #include <agrum/agrum.h>
38 
39 namespace gum {
40 
41  enum class VarType : char { Discretized, Labelized, Range, Continuous };
42 
43  class Variable;
44 
46 
47  std::ostream& operator<<(std::ostream& s, const Variable& LDRV);
48 
49  /* ===========================================================================
50  */
51  /* ===========================================================================
52  */
53  /* === GUM_VARIABLE ===
54  */
55  /* ===========================================================================
56  */
57  /* ===========================================================================
58  */
63  /* ===========================================================================
64  */
65 
66  class Variable {
67  public:
68  // ############################################################################
70  // ############################################################################
72 
74 
75  virtual ~Variable();
76 
79 
80  virtual Variable* clone() const = 0;
81 
83 
84  // ############################################################################
86  // ############################################################################
88 
90 
93  Variable& operator=(const Variable& aRV);
94 
96 
97  virtual bool operator==(const Variable& aRV) const;
98 
100 
101  virtual bool operator!=(const Variable& aRV) const;
102 
104 
105  // ############################################################################
107  // ############################################################################
109 
111 
113  void setName(const std::string& theValue);
114 
116 
117  const std::string& name() const;
118 
121 
123  void setDescription(const std::string& theValue) const;
124 
126 
127  const std::string& description() const;
128 
130 
131  virtual VarType varType() const = 0;
132 
134  virtual const std::string domain() const = 0;
135 
137 
138  protected:
140  Variable() { GUM_CONSTRUCTOR(Variable); };
141 
143 
145  void _copy(const Variable& aRV);
146 
148 
151  Variable(const std::string& aName, const std::string& aDesc);
152 
154 
156  Variable(const Variable& aRV);
157 
158  private:
160  std::string __name;
161 
165  mutable std::string __description;
166  };
167 
168 } /* namespace gum */
169 
170 #ifndef GUM_NO_INLINE
172 #endif /* GUM_NO_INLINE */
173 
174 #endif /* GUM_VARIABLE_H */
Base class for every random variable.
Definition: variable.h:66
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
std::ostream & operator<<(std::ostream &output, const BayesNet< GUM_SCALAR > &bn)
Prints map&#39;s DAG in output using the Graphviz-dot format.
Definition: BayesNet_tpl.h:605
VarType
Definition: variable.h:41
bool operator==(const TiXmlString &a, const TiXmlString &b)
Definition: tinystr.h:243
std::string __name
the name of the variable
Definition: variable.h:160
bool operator!=(const TiXmlString &a, const TiXmlString &b)
Definition: tinystr.h:251
Variable()
(protected) Default constructor
Definition: variable.h:140
std::string __description
the description of the variable since description is not a characteristic of a variable, we allow the description to be changed even in a const reference.
Definition: variable.h:165