bpp-core3  3.0.0
BppBoolean.h
Go to the documentation of this file.
1 //
2 // File: BppBoolean.h
3 // Authors:
4 // Julien Dutheil
5 // Francois Gindraud (2017)
6 // Last modified: 2017-06-27 00:00:00
7 //
8 
9 /*
10  Copyright or © or Copr. Bio++ Development Team, (November 17, 2004)
11 
12  This software is a computer program whose purpose is to provide utilitary
13  classes. This file belongs to the Bio++ Project.
14 
15  This software is governed by the CeCILL license under French law and
16  abiding by the rules of distribution of free software. You can use,
17  modify and/ or redistribute the software under the terms of the CeCILL
18  license as circulated by CEA, CNRS and INRIA at the following URL
19  "http://www.cecill.info".
20 
21  As a counterpart to the access to the source code and rights to copy,
22  modify and redistribute granted by the license, users are provided only
23  with a limited warranty and the software's author, the holder of the
24  economic rights, and the successive licensors have only limited
25  liability.
26 
27  In this respect, the user's attention is drawn to the risks associated
28  with loading, using, modifying and/or developing or reproducing the
29  software by the user in light of its specific status of free software,
30  that may mean that it is complicated to manipulate, and that also
31  therefore means that it is reserved for developers and experienced
32  professionals having in-depth computer knowledge. Users are therefore
33  encouraged to load and test the software's suitability as regards their
34  requirements in conditions enabling the security of their systems and/or
35  data to be ensured and, more generally, to use and operate it in the
36  same conditions as regards security.
37 
38  The fact that you are presently reading this means that you have had
39  knowledge of the CeCILL license and that you accept its terms.
40 */
41 
42 #ifndef BPP_BPPBOOLEAN_H
43 #define BPP_BPPBOOLEAN_H
44 
45 #include <ostream>
46 
47 #include "Clonable.h"
48 
49 namespace bpp
50 {
54 class BppBoolean : public virtual Clonable
55 {
56 private:
57  bool value_;
58 
59 public:
60  BppBoolean(bool value = false)
61  : value_(value)
62  {}
63 
64  BppBoolean* clone() const { return new BppBoolean(*this); }
65 
66  const bool getValue() const { return value_; }
67 };
68 
69 inline std::ostream& operator<<(std::ostream& out, const BppBoolean& s) { return out << s.getValue(); }
70 } // namespace bpp
71 #endif // BPP_BPPBOOLEAN_H
The BppBoolean object class. This class extends the bool type to support the Clonable interface.
Definition: BppBoolean.h:55
const bool getValue() const
Definition: BppBoolean.h:66
BppBoolean(bool value=false)
Definition: BppBoolean.h:60
BppBoolean * clone() const
Create a copy of this object and send a pointer to it.
Definition: BppBoolean.h:64
The Clonable interface (allow an object to be cloned).
Definition: Clonable.h:103
std::ostream & operator<<(std::ostream &out, const BppBoolean &s)
Definition: BppBoolean.h:69