fw4spl
fwAtoms/include/fwAtoms/Boolean.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __FWATOMS_BOOLEAN_HPP__
8 #define __FWATOMS_BOOLEAN_HPP__
9 
10 #include "fwAtoms/Base.hpp"
11 #include "fwAtoms/config.hpp"
12 #include "fwAtoms/factory/new.hpp"
13 
14 #include <string>
15 
16 namespace fwAtoms
17 {
18 
23 class FWATOMS_CLASS_API Boolean : public Base
24 {
25 public:
26  fwCoreClassDefinitionsWithFactoryMacro( (Boolean)(::fwAtoms::Base), (()), ::fwAtoms::factory::New< Boolean > );
27 
33  m_value(false)
34  {
35  }
36 
40  virtual ~Boolean()
41  {
42  }
43 
44  FWATOMS_API virtual std::string getString() const override;
45 
46  FWATOMS_API virtual void setString(const std::string& value);
47 
54  FWATOMS_API static Boolean::sptr New(std::string value);
55 
60  FWATOMS_API static Boolean::sptr New(bool value);
61 
65  FWATOMS_API virtual Base::sptr clone() const override;
66 
70  ::fwAtoms::Base::AtomType type() const override
71  {
72  return ::fwAtoms::Base::BOOLEAN;
73  }
74 
75  //------------------------------------------------------------------------------
76 
77  bool getValue() const
78  {
79  return m_value;
80  }
81 
82 protected:
83 
88  FWATOMS_API Boolean(bool value);
89 
96  FWATOMS_API Boolean(std::string& value);
97 
98  bool m_value;
99 };
100 
101 }
102 
103 #endif /* __FWATOMS_BOOLEAN_HPP__ */
104 
fwAtoms contains basic objects to represent any other kind of object
::fwAtoms::Base::AtomType type() const override
returns Atom type
Boolean(::fwAtoms::Base::Key key)
Constructor.
#define fwCoreClassDefinitionsWithFactoryMacro(_classinfo_, _parameters_, _factory_)
Generate common construction methods for classes with one factory.
Represented a Boolean value.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
Base class for all Atom classes.