F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
CustomVersionDbSerializableAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title CustomVersionDbSerializableAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for CustomVersionDb struct
5 // ======================================================================
6 
8 #include "Fw/Types/Assert.hpp"
9 
10 namespace Svc {
11 
12  // ----------------------------------------------------------------------
13  // Constructors
14  // ----------------------------------------------------------------------
15 
18  Serializable(),
19  m_version_enum(Svc::VersionCfg::VersionEnum::PROJECT_VERSION_00),
20  m_version_value(m___fprime_ac_version_value_buffer, sizeof m___fprime_ac_version_value_buffer, Fw::String("")),
21  m_version_status(Svc::VersionStatus::OK)
22  {
23 
24  }
25 
29  const Fw::StringBase& version_value,
30  Svc::VersionStatus::T version_status
31  ) :
32  Serializable(),
33  m_version_enum(version_enum),
34  m_version_value(m___fprime_ac_version_value_buffer, sizeof m___fprime_ac_version_value_buffer, version_value),
35  m_version_status(version_status)
36  {
37 
38  }
39 
42  Serializable(),
43  m_version_enum(obj.m_version_enum),
44  m_version_value(m___fprime_ac_version_value_buffer, sizeof m___fprime_ac_version_value_buffer, obj.m_version_value),
45  m_version_status(obj.m_version_status)
46  {
47 
48  }
49 
50  // ----------------------------------------------------------------------
51  // Operators
52  // ----------------------------------------------------------------------
53 
55  operator=(const CustomVersionDb& obj)
56  {
57  if (this == &obj) {
58  return *this;
59  }
60 
62  return *this;
63  }
64 
66  operator==(const CustomVersionDb& obj) const
67  {
68  return (
69  (this->m_version_enum == obj.m_version_enum) &&
70  (this->m_version_value == obj.m_version_value) &&
71  (this->m_version_status == obj.m_version_status)
72  );
73  }
74 
76  operator!=(const CustomVersionDb& obj) const
77  {
78  return !(*this == obj);
79  }
80 
81 #ifdef BUILD_UT
82 
83  std::ostream& operator<<(std::ostream& os, const CustomVersionDb& obj) {
84  Fw::String s;
85  obj.toString(s);
86  os << s.toChar();
87  return os;
88  }
89 
90 #endif
91 
92  // ----------------------------------------------------------------------
93  // Member functions
94  // ----------------------------------------------------------------------
95 
98  {
99  Fw::SerializeStatus status;
100 
101  status = buffer.serialize(this->m_version_enum);
102  if (status != Fw::FW_SERIALIZE_OK) {
103  return status;
104  }
105  status = buffer.serialize(this->m_version_value);
106  if (status != Fw::FW_SERIALIZE_OK) {
107  return status;
108  }
109  status = buffer.serialize(this->m_version_status);
110  if (status != Fw::FW_SERIALIZE_OK) {
111  return status;
112  }
113 
114  return status;
115  }
116 
119  {
120  Fw::SerializeStatus status;
121 
122  status = buffer.deserialize(this->m_version_enum);
123  if (status != Fw::FW_SERIALIZE_OK) {
124  return status;
125  }
126  status = buffer.deserialize(this->m_version_value);
127  if (status != Fw::FW_SERIALIZE_OK) {
128  return status;
129  }
130  status = buffer.deserialize(this->m_version_status);
131  if (status != Fw::FW_SERIALIZE_OK) {
132  return status;
133  }
134 
135  return status;
136  }
137 
138 #if FW_SERIALIZABLE_TO_STRING
139 
140  void CustomVersionDb ::
141  toString(Fw::StringBase& sb) const
142  {
143  static const char* formatString =
144  "( "
145  "version_enum = %s, "
146  "version_value = %s, "
147  "version_status = %s"
148  " )";
149 
150  // Declare strings to hold any serializable toString() arguments
151  Fw::String version_enumStr;
152  Fw::String version_statusStr;
153 
154  // Call toString for arrays and serializable types
155  this->m_version_enum.toString(version_enumStr);
156  this->m_version_status.toString(version_statusStr);
157 
158  sb.format(
159  formatString,
160  version_enumStr.toChar(),
161  this->m_version_value.toChar(),
162  version_statusStr.toChar()
163  );
164  }
165 
166 #endif
167 
168  // ----------------------------------------------------------------------
169  // Setter functions
170  // ----------------------------------------------------------------------
171 
173  set(
174  Svc::VersionCfg::VersionEnum::T version_enum,
175  const Fw::StringBase& version_value,
176  Svc::VersionStatus::T version_status
177  )
178  {
179  this->m_version_enum = version_enum;
180  this->m_version_value = version_value;
181  this->m_version_status = version_status;
182  }
183 
186  {
187  this->m_version_enum = version_enum;
188  }
189 
191  setversion_value(const Fw::StringBase& version_value)
192  {
193  this->m_version_value = version_value;
194  }
195 
198  {
199  this->m_version_status = version_status;
200  }
201 
202 }
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
void format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:56
const char * toChar() const
Definition: String.hpp:50
Data Structure for custom version Tlm.
CustomVersionDb & operator=(const CustomVersionDb &obj)
Copy assignment operator.
void setversion_status(Svc::VersionStatus::T version_status)
Set member version_status.
CustomVersionDb()
Constructor (default value)
void set(Svc::VersionCfg::VersionEnum::T version_enum, const Fw::StringBase &version_value, Svc::VersionStatus::T version_status)
Set all members.
void setversion_value(const Fw::StringBase &version_value)
Set member version_value.
Svc::VersionCfg::VersionEnum m_version_enum
void setversion_enum(Svc::VersionCfg::VersionEnum::T version_enum)
Set member version_enum.
Fw::SerializeStatus serialize(Fw::SerializeBufferBase &buffer) const
Serialization.
bool operator==(const CustomVersionDb &obj) const
Equality operator.
bool operator!=(const CustomVersionDb &obj) const
Inequality operator.
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase &buffer)
Deserialization.
An enumeration for version status.
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.