aGrUM  0.16.0
variable_inl.h
Go to the documentation of this file.
1 
23 #ifndef DOXYGEN_SHOULD_SKIP_THIS
24 
25 namespace gum {
26 
28 
29  INLINE void Variable::_copy(const Variable& aRV) {
30  __name = aRV.__name;
31  __description = aRV.__description;
32  }
33 
35 
36  INLINE Variable::Variable(const std::string& aName, const std::string& aDesc) :
37  __name(aName), __description(aDesc) {
38  // for debugging purposes
39  GUM_CONSTRUCTOR(Variable);
40  }
41 
43 
44  INLINE Variable::Variable(const Variable& aRV) :
46  // for debugging purposes
47  GUM_CONS_CPY(Variable);
48  }
49 
51 
52  INLINE Variable::~Variable() {
53  // for debugging purposes
54  GUM_DESTRUCTOR(Variable);
55  }
56 
58 
59  INLINE Variable& Variable::operator=(const Variable& aRV) {
60  // avoid self assignment
61  if (this != &aRV) _copy(aRV);
62 
63  return *this;
64  }
65 
67 
68  INLINE void Variable::setName(const std::string& theValue) { __name = theValue; }
69 
71 
72  INLINE const std::string& Variable::name() const { return __name; }
73 
75 
76  INLINE void Variable::setDescription(const std::string& theValue) const {
77  __description = theValue;
78  }
79 
81 
82  INLINE const std::string& Variable::description() const { return __description; }
83 
85 
86  INLINE bool Variable::operator==(const Variable& aRV) const {
87  return (__name == aRV.__name);
88  }
89 
91 
92  INLINE bool Variable::operator!=(const Variable& aRV) const {
93  return (!operator==(aRV));
94  }
95 
96 } /* namespace gum */
97 
98 #endif // DOXYGEN_SHOULD_SKIP_THIS
void setName(const std::string &theValue)
sets the name of the variable
void _copy(const Variable &aRV)
protected copy
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
void setDescription(const std::string &theValue) const
sets the description of the variable
virtual bool operator!=(const Variable &aRV) const
inequality operator
virtual ~Variable()
destructor
const std::string & description() const
returns the description of the variable
std::string __name
the name of the variable
Definition: variable.h:160
Variable & operator=(const Variable &aRV)
Copy operator.
Variable()
(protected) Default constructor
Definition: variable.h:140
virtual bool operator==(const Variable &aRV) const
equality operator
const std::string & name() const
returns the name of the variable
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