aGrUM  0.14.2
variable_inl.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  ***************************************************************************/
20 #ifndef DOXYGEN_SHOULD_SKIP_THIS
21 
22 namespace gum {
23 
25 
26  INLINE void Variable::_copy(const Variable& aRV) {
27  __name = aRV.__name;
28  __description = aRV.__description;
29  }
30 
32 
33  INLINE Variable::Variable(const std::string& aName, const std::string& aDesc) :
34  __name(aName), __description(aDesc) {
35  // for debugging purposes
36  GUM_CONSTRUCTOR(Variable);
37  }
38 
40 
41  INLINE Variable::Variable(const Variable& aRV) :
43  // for debugging purposes
44  GUM_CONS_CPY(Variable);
45  }
46 
48 
49  INLINE Variable::~Variable() {
50  // for debugging purposes
51  GUM_DESTRUCTOR(Variable);
52  }
53 
55 
56  INLINE Variable& Variable::operator=(const Variable& aRV) {
57  // avoid self assignment
58  if (this != &aRV) _copy(aRV);
59 
60  return *this;
61  }
62 
64 
65  INLINE void Variable::setName(const std::string& theValue) { __name = theValue; }
66 
68 
69  INLINE const std::string& Variable::name() const { return __name; }
70 
72 
73  INLINE void Variable::setDescription(const std::string& theValue) const {
74  __description = theValue;
75  }
76 
78 
79  INLINE const std::string& Variable::description() const { return __description; }
80 
82 
83  INLINE bool Variable::operator==(const Variable& aRV) const {
84  return (__name == aRV.__name);
85  }
86 
88 
89  INLINE bool Variable::operator!=(const Variable& aRV) const {
90  return (!operator==(aRV));
91  }
92 
93 } /* namespace gum */
94 
95 #endif // DOXYGEN_SHOULD_SKIP_THIS
void setName(const std::string &theValue)
sets the name of the variable
void _copy(const Variable &aRV)
protected copy
gum is the global namespace for all aGrUM entities
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:157
Variable & operator=(const Variable &aRV)
Copy operator.
Variable()
(protected) Default constructor
Definition: variable.h:137
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:162