F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
RateConfigSerializableAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title RateConfigSerializableAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for RateConfig struct
5 // ======================================================================
6 
7 #include "Fw/Types/Assert.hpp"
9 
10 namespace Svc {
11 
12  // ----------------------------------------------------------------------
13  // Constructors
14  // ----------------------------------------------------------------------
15 
18  Serializable(),
19  m_rateLogic(),
20  m_min(),
21  m_max()
22  {
23 
24  }
25 
28  Svc::RateLogic::T rateLogic,
29  U32 min,
30  U32 max
31  ) :
32  Serializable(),
33  m_rateLogic(rateLogic),
34  m_min(min),
35  m_max(max)
36  {
37 
38  }
39 
41  RateConfig(const RateConfig& obj) :
42  Serializable(),
43  m_rateLogic(obj.m_rateLogic),
44  m_min(obj.m_min),
45  m_max(obj.m_max)
46  {
47 
48  }
49 
50  // ----------------------------------------------------------------------
51  // Operators
52  // ----------------------------------------------------------------------
53 
56  {
57  if (this == &obj) {
58  return *this;
59  }
60 
61  set(obj.m_rateLogic, obj.m_min, obj.m_max);
62  return *this;
63  }
64 
65  bool RateConfig ::
66  operator==(const RateConfig& obj) const
67  {
68  if (this == &obj) { return true; }
69  return (
70  (this->m_rateLogic == obj.m_rateLogic) &&
71  (this->m_min == obj.m_min) &&
72  (this->m_max == obj.m_max)
73  );
74  }
75 
76  bool RateConfig ::
77  operator!=(const RateConfig& obj) const
78  {
79  return !(*this == obj);
80  }
81 
82 #ifdef BUILD_UT
83 
84  std::ostream& operator<<(std::ostream& os, const RateConfig& obj) {
85  Fw::String s;
86  obj.toString(s);
87  os << s.toChar();
88  return os;
89  }
90 
91 #endif
92 
93  // ----------------------------------------------------------------------
94  // Member functions
95  // ----------------------------------------------------------------------
96 
99  Fw::SerialBufferBase& buffer,
100  Fw::Endianness mode
101  ) const
102  {
103  Fw::SerializeStatus status;
104 
105  status = buffer.serializeFrom(this->m_rateLogic, mode);
106  if (status != Fw::FW_SERIALIZE_OK) {
107  return status;
108  }
109  status = buffer.serializeFrom(this->m_min, mode);
110  if (status != Fw::FW_SERIALIZE_OK) {
111  return status;
112  }
113  status = buffer.serializeFrom(this->m_max, mode);
114  if (status != Fw::FW_SERIALIZE_OK) {
115  return status;
116  }
117 
118  return status;
119  }
120 
123  Fw::SerialBufferBase& buffer,
124  Fw::Endianness mode
125  )
126  {
127  Fw::SerializeStatus status;
128 
129  status = buffer.deserializeTo(this->m_rateLogic, mode);
130  if (status != Fw::FW_SERIALIZE_OK) {
131  return status;
132  }
133  status = buffer.deserializeTo(this->m_min, mode);
134  if (status != Fw::FW_SERIALIZE_OK) {
135  return status;
136  }
137  status = buffer.deserializeTo(this->m_max, mode);
138  if (status != Fw::FW_SERIALIZE_OK) {
139  return status;
140  }
141 
142  return status;
143  }
144 
147  {
148  FwSizeType size = 0;
150  size += sizeof(U32);
151  size += sizeof(U32);
152  return size;
153  }
154 
155 #if FW_SERIALIZABLE_TO_STRING
156 
157  void RateConfig ::
158  toString(Fw::StringBase& sb) const
159  {
160  Fw::String tmp;
161  sb = "( ";
162 
163  // Format rateLogic
164  sb += "rateLogic = ";
165  this->m_rateLogic.toString(tmp);
166  sb += tmp;
167  sb += ", ";
168 
169  // Format min
170  sb += "min = ";
171  tmp.format("%" PRIu32 "", this->m_min);
172  sb += tmp;
173  sb += ", ";
174 
175  // Format max
176  sb += "max = ";
177  tmp.format("%" PRIu32 "", this->m_max);
178  sb += tmp;
179  sb += " )";
180  }
181 
182 #endif
183 
184  // ----------------------------------------------------------------------
185  // Setter functions
186  // ----------------------------------------------------------------------
187 
188  void RateConfig ::
190  Svc::RateLogic::T rateLogic,
191  U32 min,
192  U32 max
193  )
194  {
195  this->m_rateLogic = rateLogic;
196  this->m_min = min;
197  this->m_max = max;
198  }
199 
200  void RateConfig ::
202  {
203  this->m_rateLogic = rateLogic;
204  }
205 
206  void RateConfig ::
208  {
209  this->m_min = min;
210  }
211 
212  void RateConfig ::
213  set_max(U32 max)
214  {
215  this->m_max = max;
216  }
217 
218 }
The size of the serial representation.
Serialization/Deserialization operation was successful.
FwSizeType serializedSize() const
Get the dynamic serialized size of the struct.
void set_rateLogic(Svc::RateLogic::T rateLogic)
Set member rateLogic.
PlatformSizeType FwSizeType
void set_max(U32 max)
Set member max.
virtual SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG)=0
Serialize an 8-bit unsigned integer value.
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.
SerializeStatus
forward declaration for string
virtual SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG)=0
Deserialize an 8-bit unsigned integer value.
RateConfig & operator=(const RateConfig &obj)
Copy assignment operator.
bool operator!=(const RateConfig &obj) const
Inequality operator.
const char * toChar() const
Convert to a C-style char*.
bool operator==(const RateConfig &obj) const
Equality operator.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:58
static U32 min(const U32 a, const U32 b)
Definition: Checksum.cpp:16
void set(Svc::RateLogic::T rateLogic, U32 min, U32 max)
Set all members.
RateConfig()
Constructor (default value)
void set_min(U32 min)
Set member min.
RateGroupDivider component implementation.
Endianness
T
The raw enum type.