F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
StatementSerializableAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title StatementSerializableAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for Statement struct
5 // ======================================================================
6 
7 #include "Fw/Types/Assert.hpp"
9 
10 namespace Svc {
11 
12  namespace Fpy {
13 
14  // ----------------------------------------------------------------------
15  // Constructors
16  // ----------------------------------------------------------------------
17 
20  Serializable(),
21  m_opCode(Svc::Fpy::DirectiveId::INVALID),
22  m_argBuf()
23  {
24 
25  }
26 
30  const Fw::StatementArgBuffer& argBuf
31  ) :
32  Serializable(),
33  m_opCode(opCode),
34  m_argBuf(argBuf)
35  {
36 
37  }
38 
40  Statement(const Statement& obj) :
41  Serializable(),
42  m_opCode(obj.m_opCode),
43  m_argBuf(obj.m_argBuf)
44  {
45 
46  }
47 
48  // ----------------------------------------------------------------------
49  // Operators
50  // ----------------------------------------------------------------------
51 
53  operator=(const Statement& obj)
54  {
55  if (this == &obj) {
56  return *this;
57  }
58 
59  set(obj.m_opCode, obj.m_argBuf);
60  return *this;
61  }
62 
63  bool Statement ::
64  operator==(const Statement& obj) const
65  {
66  if (this == &obj) { return true; }
67  return (
68  (this->m_opCode == obj.m_opCode) &&
69  (this->m_argBuf == obj.m_argBuf)
70  );
71  }
72 
73  bool Statement ::
74  operator!=(const Statement& obj) const
75  {
76  return !(*this == obj);
77  }
78 
79 #ifdef BUILD_UT
80 
81  std::ostream& operator<<(std::ostream& os, const Statement& obj) {
82  Fw::String s;
83  obj.toString(s);
84  os << s.toChar();
85  return os;
86  }
87 
88 #endif
89 
90  // ----------------------------------------------------------------------
91  // Member functions
92  // ----------------------------------------------------------------------
93 
97  Fw::Endianness mode
98  ) const
99  {
100  Fw::SerializeStatus status;
101 
102  status = buffer.serializeFrom(this->m_opCode, mode);
103  if (status != Fw::FW_SERIALIZE_OK) {
104  return status;
105  }
106  status = buffer.serializeFrom(this->m_argBuf, mode);
107  if (status != Fw::FW_SERIALIZE_OK) {
108  return status;
109  }
110 
111  return status;
112  }
113 
116  Fw::SerializeBufferBase& buffer,
117  Fw::Endianness mode
118  )
119  {
120  Fw::SerializeStatus status;
121 
122  status = buffer.deserializeTo(this->m_opCode, mode);
123  if (status != Fw::FW_SERIALIZE_OK) {
124  return status;
125  }
126  status = buffer.deserializeTo(this->m_argBuf, mode);
127  if (status != Fw::FW_SERIALIZE_OK) {
128  return status;
129  }
130 
131  return status;
132  }
133 
136  {
137  FwSizeType size = 0;
140  return size;
141  }
142 
143 #if FW_SERIALIZABLE_TO_STRING
144 
145  void Statement ::
146  toString(Fw::StringBase& sb) const
147  {
148  Fw::String tmp;
149  sb = "( ";
150 
151  // Format opCode
152  sb += "opCode = ";
153  this->m_opCode.toString(tmp);
154  sb += tmp;
155  sb += ", ";
156 
157  // Format argBuf
158  sb += "argBuf = ";
159  this->m_argBuf.toString(tmp);
160  sb += tmp;
161  sb += " )";
162  }
163 
164 #endif
165 
166  // ----------------------------------------------------------------------
167  // Setter functions
168  // ----------------------------------------------------------------------
169 
170  void Statement ::
173  const Fw::StatementArgBuffer& argBuf
174  )
175  {
176  this->m_opCode = opCode;
177  this->m_argBuf = argBuf;
178  }
179 
180  void Statement ::
182  {
183  this->m_opCode = opCode;
184  }
185 
186  void Statement ::
188  {
189  this->m_argBuf = argBuf;
190  }
191 
192  }
193 
194 }
Serialization/Deserialization operation was successful.
FwSizeType serializedSize() const
Get the dynamic serialized size of the struct.
PlatformSizeType FwSizeType
const char * toChar() const
Definition: String.hpp:50
Fw::SerializeStatus deserializeFrom(Fw::SerializeBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG)
Deserialization.
SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG)
deserialize 8-bit unsigned int
bool operator!=(const Statement &obj) const
Inequality operator.
Fw::StatementArgBuffer m_argBuf
The size of the serial representation.
SerializeStatus
forward declaration for string
void set_opCode(Svc::Fpy::DirectiveId::T opCode)
Set member opCode.
Statement()
Constructor (default value)
a statement is a directive opcode paired with an argument buffer
Statement & operator=(const Statement &obj)
Copy assignment operator.
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG)
serialize 8-bit unsigned int
void set_argBuf(const Fw::StatementArgBuffer &argBuf)
Set member argBuf.
void set(Svc::Fpy::DirectiveId::T opCode, const Fw::StatementArgBuffer &argBuf)
Set all members.
T
The raw enum type.
RateGroupDivider component implementation.
Fw::SerializeStatus serializeTo(Fw::SerializeBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const
Serialization.
bool operator==(const Statement &obj) const
Equality operator.
Endianness
Svc::Fpy::DirectiveId m_opCode