aGrUM  0.14.2
discreteVariable.cpp
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  ***************************************************************************/
21 #include <sstream>
22 
23 #ifdef GUM_NO_INLINE
25 #endif /* GUM_NO_INLINE */
26 
27 #ifndef DOXYGEN_SHOULD_SKIP_THIS
28 
29 namespace gum {
30 
31  const std::string DiscreteVariable::toStringWithDescription() const {
32  std::stringstream s;
33  s << description();
34  s << domain();
35 
36  return s.str();
37  }
38 
39  const std::string DiscreteVariable::toString() const {
40  std::stringstream s;
41  s << name();
42  s << domain();
43 
44  return s.str();
45  }
46 
48 
49  std::ostream& operator<<(std::ostream& s, const DiscreteVariable& DRV) {
50  s << DRV.toString();
51  return s;
52  }
53 
54 } /* namespace gum */
55 
56 #endif // DOXYGEN_SHOULD_SKIP_THIS
Base class for discrete random variable.
virtual const std::string domain() const =0
string represent the domain of the variable
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
const std::string toStringWithDescription() const
string version of *this using description attribute instead of name.
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:583
const std::string & description() const
returns the description of the variable
DiscreteVariable()
(protected) Default constructor
const std::string toString() const
string version of *this
const std::string & name() const
returns the name of the variable