F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
OnEnumAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title OnEnumAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for On enum
5 // ======================================================================
6 
7 #ifndef Fw_OnEnumAc_HPP
8 #define Fw_OnEnumAc_HPP
9 
10 #include "FpConfig.hpp"
12 #include "Fw/Types/String.hpp"
13 
14 namespace Fw {
15 
17  class On :
18  public Fw::Serializable
19  {
20 
21  public:
22 
23  // ----------------------------------------------------------------------
24  // Types
25  // ----------------------------------------------------------------------
26 
28  typedef I32 SerialType;
29 
31  enum T {
33  OFF = 0,
35  ON = 1,
36  };
37 
39  typedef T t;
40 
41  public:
42 
43  // ----------------------------------------------------------------------
44  // Constants
45  // ----------------------------------------------------------------------
46 
47  enum {
52  };
53 
54  public:
55 
56  // ----------------------------------------------------------------------
57  // Constructors
58  // ----------------------------------------------------------------------
59 
61  On()
62  {
63  this->e = OFF;
64  }
65 
67  On(
68  const T e1
69  )
70  {
71  this->e = e1;
72  }
73 
75  On(
76  const On& obj
77  )
78  {
79  this->e = obj.e;
80  }
81 
82  public:
83 
84  // ----------------------------------------------------------------------
85  // Operators
86  // ----------------------------------------------------------------------
87 
89  On& operator=(
90  const On& obj
91  );
92 
94  On& operator=(
95  T e1
96  );
97 
99  operator T() const
100  {
101  return this->e;
102  }
103 
105  bool operator==(T e1) const
106  {
107  return this->e == e1;
108  }
109 
111  bool operator!=(T e1) const
112  {
113  return !(*this == e1);
114  }
115 
116 #ifdef BUILD_UT
117 
119  friend std::ostream& operator<<(
120  std::ostream& os,
121  const On& obj
122  );
123 
124 #endif
125 
126  public:
127 
128  // ----------------------------------------------------------------------
129  // Member functions
130  // ----------------------------------------------------------------------
131 
133  bool isValid() const;
134 
137  Fw::SerializeBufferBase& buffer
138  ) const;
139 
142  Fw::SerializeBufferBase& buffer
143  );
144 
145 #if FW_SERIALIZABLE_TO_STRING
146 
148  void toString(
149  Fw::StringBase& sb
150  ) const;
151 
152 #endif
153 
154  public:
155 
156  // ----------------------------------------------------------------------
157  // Member variables
158  // ----------------------------------------------------------------------
159 
161  T e;
162 
163  };
164 
165 }
166 
167 #endif
C++-compatible configuration header for fprime configuration.
On and off states.
Definition: OnEnumAc.hpp:19
T t
For backwards compatibility.
Definition: OnEnumAc.hpp:39
Fw::SerializeStatus serialize(Fw::SerializeBufferBase &buffer) const
Serialize raw enum value to SerialType.
Definition: OnEnumAc.cpp:55
T
The raw enum type.
Definition: OnEnumAc.hpp:31
@ OFF
Off state.
Definition: OnEnumAc.hpp:33
@ ON
On state.
Definition: OnEnumAc.hpp:35
On & operator=(const On &obj)
Copy assignment operator (object)
Definition: OnEnumAc.cpp:20
On()
Constructor (default value of OFF)
Definition: OnEnumAc.hpp:61
bool operator==(T e1) const
Equality operator.
Definition: OnEnumAc.hpp:105
bool isValid() const
Check raw enum value for validity.
Definition: OnEnumAc.cpp:49
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase &buffer)
Deserialize raw enum value from SerialType.
Definition: OnEnumAc.cpp:64
@ SERIALIZED_SIZE
The size of the serial representation.
Definition: OnEnumAc.hpp:49
@ NUM_CONSTANTS
The number of enumerated constants.
Definition: OnEnumAc.hpp:51
On(const T e1)
Constructor (user-provided value)
Definition: OnEnumAc.hpp:67
T e
The raw enum value.
Definition: OnEnumAc.hpp:161
I32 SerialType
The serial representation type.
Definition: OnEnumAc.hpp:28
bool operator!=(T e1) const
Inequality operator.
Definition: OnEnumAc.hpp:111
On(const On &obj)
Copy constructor.
Definition: OnEnumAc.hpp:75
forward declaration
SerializeStatus
forward declaration for string