F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
SaMapEntrySerializableAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SaMapEntrySerializableAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for SaMapEntry struct
5 // ======================================================================
6 
7 #include "Fw/Types/Assert.hpp"
9 
10 namespace Svc {
11 
12  namespace Ccsds {
13 
14  // ----------------------------------------------------------------------
15  // Constructors
16  // ----------------------------------------------------------------------
17 
20  Serializable(),
21  m_securityAssociationIndex(),
22  m_portIndex()
23  {
24 
25  }
26 
29  U16 securityAssociationIndex,
30  FwIndexType portIndex
31  ) :
32  Serializable(),
33  m_securityAssociationIndex(securityAssociationIndex),
34  m_portIndex(portIndex)
35  {
36 
37  }
38 
40  SaMapEntry(const SaMapEntry& obj) :
41  Serializable(),
42  m_securityAssociationIndex(obj.m_securityAssociationIndex),
43  m_portIndex(obj.m_portIndex)
44  {
45 
46  }
47 
48  // ----------------------------------------------------------------------
49  // Operators
50  // ----------------------------------------------------------------------
51 
54  {
55  if (this == &obj) {
56  return *this;
57  }
58 
60  return *this;
61  }
62 
63  bool SaMapEntry ::
64  operator==(const SaMapEntry& obj) const
65  {
66  if (this == &obj) { return true; }
67  return (
69  (this->m_portIndex == obj.m_portIndex)
70  );
71  }
72 
73  bool SaMapEntry ::
74  operator!=(const SaMapEntry& obj) const
75  {
76  return !(*this == obj);
77  }
78 
79 #ifdef BUILD_UT
80 
81  std::ostream& operator<<(std::ostream& os, const SaMapEntry& 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  Fw::SerialBufferBase& buffer,
97  Fw::Endianness mode
98  ) const
99  {
100  Fw::SerializeStatus status;
101 
102  status = buffer.serializeFrom(this->m_securityAssociationIndex, mode);
103  if (status != Fw::FW_SERIALIZE_OK) {
104  return status;
105  }
106  status = buffer.serializeFrom(this->m_portIndex, mode);
107  if (status != Fw::FW_SERIALIZE_OK) {
108  return status;
109  }
110 
111  return status;
112  }
113 
116  Fw::SerialBufferBase& buffer,
117  Fw::Endianness mode
118  )
119  {
120  Fw::SerializeStatus status;
121 
122  status = buffer.deserializeTo(this->m_securityAssociationIndex, mode);
123  if (status != Fw::FW_SERIALIZE_OK) {
124  return status;
125  }
126  status = buffer.deserializeTo(this->m_portIndex, mode);
127  if (status != Fw::FW_SERIALIZE_OK) {
128  return status;
129  }
130 
131  return status;
132  }
133 
136  {
137  FwSizeType size = 0;
138  size += sizeof(U16);
139  size += sizeof(FwIndexType);
140  return size;
141  }
142 
143 #if FW_SERIALIZABLE_TO_STRING
144 
145  void SaMapEntry ::
146  toString(Fw::StringBase& sb) const
147  {
148  Fw::String tmp;
149  sb = "( ";
150 
151  // Format securityAssociationIndex
152  sb += "securityAssociationIndex = ";
153  tmp.format("%" PRIu16 "", this->m_securityAssociationIndex);
154  sb += tmp;
155  sb += ", ";
156 
157  // Format portIndex
158  sb += "portIndex = ";
159  tmp.format("%" PRIi16 "", this->m_portIndex);
160  sb += tmp;
161  sb += " )";
162  }
163 
164 #endif
165 
166  // ----------------------------------------------------------------------
167  // Setter functions
168  // ----------------------------------------------------------------------
169 
170  void SaMapEntry ::
172  U16 securityAssociationIndex,
173  FwIndexType portIndex
174  )
175  {
176  this->m_securityAssociationIndex = securityAssociationIndex;
177  this->m_portIndex = portIndex;
178  }
179 
180  void SaMapEntry ::
181  set_securityAssociationIndex(U16 securityAssociationIndex)
182  {
183  this->m_securityAssociationIndex = securityAssociationIndex;
184  }
185 
186  void SaMapEntry ::
188  {
189  this->m_portIndex = portIndex;
190  }
191 
192  }
193 
194 }
Serialization/Deserialization operation was successful.
U16 m_securityAssociationIndex
FwSizeType serializedSize() const
Get the dynamic serialized size of the struct.
PlatformSizeType FwSizeType
bool operator==(const SaMapEntry &obj) const
Equality operator.
void set_securityAssociationIndex(U16 securityAssociationIndex)
Set member securityAssociationIndex.
virtual SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG)=0
Serialize an 8-bit unsigned integer value.
SaMapEntry & operator=(const SaMapEntry &obj)
Copy assignment operator.
A single security association index to port index mapping entry.
FwIndexType m_portIndex
SerializeStatus
forward declaration for string
virtual SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG)=0
Deserialize an 8-bit unsigned integer value.
void set_portIndex(FwIndexType portIndex)
Set member portIndex.
const char * toChar() const
Convert to a C-style char*.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:58
SaMapEntry()
Constructor (default value)
PlatformIndexType FwIndexType
RateGroupDivider component implementation.
Endianness
void set(U16 securityAssociationIndex, FwIndexType portIndex)
Set all members.
bool operator!=(const SaMapEntry &obj) const
Inequality operator.
Fw::SerializeStatus serializeTo(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG) const
Serialization.
Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase &buffer, Fw::Endianness mode=Fw::Endianness::BIG)
Deserialization.