F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ComQueueDepthArrayAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title ComQueueDepthArrayAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for ComQueueDepth array
5 // ======================================================================
6 
8 #include "Fw/Types/Assert.hpp"
9 
10 namespace Svc {
11 
12  // ----------------------------------------------------------------------
13  // Constructors
14  // ----------------------------------------------------------------------
15 
18  Serializable()
19  {
20  // Construct using element-wise constructor
21  *this = ComQueueDepth(
22  0,
23  0
24  );
25  }
26 
28  ComQueueDepth(const ElementType (&a)[SIZE]) :
29  Serializable()
30  {
31  for (U32 index = 0; index < SIZE; index++) {
32  this->elements[index] = a[index];
33  }
34  }
35 
37  ComQueueDepth(const ElementType& e) :
38  Serializable()
39  {
40  for (U32 index = 0; index < SIZE; index++) {
41  this->elements[index] = e;
42  }
43  }
44 
47  const ElementType& e1,
48  const ElementType& e2
49  ) :
50  Serializable()
51  {
52  this->elements[0] = e1;
53  this->elements[1] = e2;
54  }
55 
57  ComQueueDepth(const ComQueueDepth& obj) :
58  Serializable()
59  {
60  for (U32 index = 0; index < SIZE; index++) {
61  this->elements[index] = obj.elements[index];
62  }
63  }
64 
65  // ----------------------------------------------------------------------
66  // Operators
67  // ----------------------------------------------------------------------
68 
70  operator[](const U32 i)
71  {
72  FW_ASSERT(i < SIZE, static_cast<FwAssertArgType>(i), static_cast<FwAssertArgType>(SIZE));
73  return this->elements[i];
74  }
75 
77  operator[](const U32 i) const
78  {
79  FW_ASSERT(i < SIZE, static_cast<FwAssertArgType>(i), static_cast<FwAssertArgType>(SIZE));
80  return this->elements[i];
81  }
82 
84  operator=(const ComQueueDepth& obj)
85  {
86  if (this == &obj) {
87  return *this;
88  }
89 
90  for (U32 index = 0; index < SIZE; index++) {
91  this->elements[index] = obj.elements[index];
92  }
93  return *this;
94  }
95 
97  operator=(const ElementType (&a)[SIZE])
98  {
99  for (U32 index = 0; index < SIZE; index++) {
100  this->elements[index] = a[index];
101  }
102  return *this;
103  }
104 
106  operator=(const ElementType& e)
107  {
108  for (U32 index = 0; index < SIZE; index++) {
109  this->elements[index] = e;
110  }
111  return *this;
112  }
113 
115  operator==(const ComQueueDepth& obj) const
116  {
117  for (U32 index = 0; index < SIZE; index++) {
118  if (!((*this)[index] == obj[index])) {
119  return false;
120  }
121  }
122  return true;
123  }
124 
126  operator!=(const ComQueueDepth& obj) const
127  {
128  return !(*this == obj);
129  }
130 
131 #ifdef BUILD_UT
132 
133  std::ostream& operator<<(std::ostream& os, const ComQueueDepth& obj) {
134  Fw::String s;
135  obj.toString(s);
136  os << s;
137  return os;
138  }
139 
140 #endif
141 
142  // ----------------------------------------------------------------------
143  // Public member functions
144  // ----------------------------------------------------------------------
145 
147  serialize(Fw::SerializeBufferBase& buffer) const
148  {
150  for (U32 index = 0; index < SIZE; index++) {
151  status = buffer.serialize((*this)[index]);
152  if (status != Fw::FW_SERIALIZE_OK) {
153  return status;
154  }
155  }
156  return status;
157  }
158 
161  {
163  for (U32 index = 0; index < SIZE; index++) {
164  status = buffer.deserialize((*this)[index]);
165  if (status != Fw::FW_SERIALIZE_OK) {
166  return status;
167  }
168  }
169  return status;
170  }
171 
172 #if FW_SERIALIZABLE_TO_STRING
173 
174  void ComQueueDepth ::
175  toString(Fw::StringBase& sb) const
176  {
177  static const char *formatString = "[ "
178  "%" PRIu32 " "
179  "%" PRIu32 " ]";
180 
181  sb.format(
182  formatString,
183  this->elements[0],
184  this->elements[1]
185  );
186  }
187 
188 #endif
189 
190 }
#define FW_ASSERT(...)
Definition: Assert.hpp:14
PlatformAssertArgType FwAssertArgType
Definition: FpConfig.h:39
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
Array of queue depths for Fw::Com types.
ElementType & operator[](const U32 i)
Subscript operator.
bool operator==(const ComQueueDepth &obj) const
Equality operator.
@ SIZE
The size of the array.
Fw::SerializeStatus serialize(Fw::SerializeBufferBase &buffer) const
Serialization.
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase &buffer)
Deserialization.
ComQueueDepth & operator=(const ComQueueDepth &obj)
Copy assignment operator (object)
ComQueueDepth()
Constructor (default value)
bool operator!=(const ComQueueDepth &obj) const
Inequality operator.
U32 ElementType
The element type.
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
@ SIZE
Header size for F Prime frame header.