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 
96  {
97  Fw::SerializeStatus status;
98 
99  status = buffer.serialize(this->m_opCode);
100  if (status != Fw::FW_SERIALIZE_OK) {
101  return status;
102  }
103  status = buffer.serialize(this->m_argBuf);
104  if (status != Fw::FW_SERIALIZE_OK) {
105  return status;
106  }
107 
108  return status;
109  }
110 
113  {
114  Fw::SerializeStatus status;
115 
116  status = buffer.deserialize(this->m_opCode);
117  if (status != Fw::FW_SERIALIZE_OK) {
118  return status;
119  }
120  status = buffer.deserialize(this->m_argBuf);
121  if (status != Fw::FW_SERIALIZE_OK) {
122  return status;
123  }
124 
125  return status;
126  }
127 
128 #if FW_SERIALIZABLE_TO_STRING
129 
130  void Statement ::
131  toString(Fw::StringBase& sb) const
132  {
133  Fw::String tmp;
134  sb = "( ";
135 
136  // Format opCode
137  sb += "opCode = ";
138  this->m_opCode.toString(tmp);
139  sb += tmp;
140  sb += ", ";
141 
142  // Format argBuf
143  sb += "argBuf = ";
144  this->m_argBuf.toString(tmp);
145  sb += tmp;
146  sb += " )";
147  }
148 
149 #endif
150 
151  // ----------------------------------------------------------------------
152  // Setter functions
153  // ----------------------------------------------------------------------
154 
155  void Statement ::
158  const Fw::StatementArgBuffer& argBuf
159  )
160  {
161  this->m_opCode = opCode;
162  this->m_argBuf = argBuf;
163  }
164 
165  void Statement ::
167  {
168  this->m_opCode = opCode;
169  }
170 
171  void Statement ::
173  {
174  this->m_argBuf = argBuf;
175  }
176 
177  }
178 
179 }
Fw::SerializeStatus serialize(Fw::SerializeBufferBase &buffer) const
Serialization.
Serialization/Deserialization operation was successful.
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase &buffer)
Deserialization.
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
const char * toChar() const
Definition: String.hpp:50
bool operator!=(const Statement &obj) const
Inequality operator.
Fw::StatementArgBuffer m_argBuf
void setargBuf(const Fw::StatementArgBuffer &argBuf)
Set member argBuf.
SerializeStatus
forward declaration for string
void setopCode(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.
void set(Svc::Fpy::DirectiveId::T opCode, const Fw::StatementArgBuffer &argBuf)
Set all members.
T
The raw enum type.
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
RateGroupDivider component implementation.
bool operator==(const Statement &obj) const
Equality operator.
Svc::Fpy::DirectiveId m_opCode