PLCnext API Documentation  21.0.0.35466
Bit.hpp
1 //
3 // Copyright PHOENIX CONTACT Electronics GmbH
4 //
6 #pragma once
7 #include "Arp/System/Core/Arp.h"
8 namespace Arp { namespace Plc { namespace Commons { namespace Gds
9 {
10 
14 class Bit
15 {
16 public: // typedefs
17 
18 public: // construction/destruction
20  Bit(bool value = false);
22  Bit(const Bit& arg) = default;
24  Bit& operator=(const Bit& arg) = default;
26  ~Bit(void) = default;
27 
28 public: // operators
29  operator bool(void)const;
30 
31 public: // setter/getter operations
32  bool IsSet(void)const;
33 
34 private: // fields
35  bool value;
36 };
37 
39 // inline methods of class Bit
40 
42 inline Bit::Bit(bool valueArg):
43  value(valueArg)
44 {
45 }
46 
48 inline Bit::operator bool(void) const
49 {
50  return this->IsSet();
51 }
52 
54 inline bool Bit::IsSet(void) const
55 {
56  return value;
57 }
58 
59 }}}} // end of namespace Arp::Plc::Commons::Gds
60 
This class represents a single bit data type.
Definition: Bit.hpp:14
Root namespace for the PLCnext API
bool IsSet(void) const
Returns the state of a Bit object.
Definition: Bit.hpp:54
~Bit(void)=default
Destructs this instance and frees all resources.
Bit & operator=(const Bit &arg)=default
Assignment operator.
Bit(bool value=false)
Constructs an Bit instance.
Definition: Bit.hpp:42