F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
BuffQueueDepthArrayAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title BuffQueueDepthArrayAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for BuffQueueDepth array
5 // ======================================================================
6 
7 #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 = BuffQueueDepth(
22  0
23  );
24  }
25 
28  Serializable()
29  {
30  for (U32 index = 0; index < SIZE; index++) {
31  this->elements[index] = a[index];
32  }
33  }
34 
37  Serializable()
38  {
39  this->elements[0] = e1;
40  }
41 
44  Serializable()
45  {
46  for (U32 index = 0; index < SIZE; index++) {
47  this->elements[index] = obj.elements[index];
48  }
49  }
50 
51  // ----------------------------------------------------------------------
52  // Operators
53  // ----------------------------------------------------------------------
54 
56  operator[](const U32 i)
57  {
58  FW_ASSERT(i < SIZE, static_cast<FwAssertArgType>(i), static_cast<FwAssertArgType>(SIZE));
59  return this->elements[i];
60  }
61 
63  operator[](const U32 i) const
64  {
65  FW_ASSERT(i < SIZE, static_cast<FwAssertArgType>(i), static_cast<FwAssertArgType>(SIZE));
66  return this->elements[i];
67  }
68 
71  {
72  if (this == &obj) {
73  return *this;
74  }
75 
76  for (U32 index = 0; index < SIZE; index++) {
77  this->elements[index] = obj.elements[index];
78  }
79  return *this;
80  }
81 
84  {
85  for (U32 index = 0; index < SIZE; index++) {
86  this->elements[index] = a[index];
87  }
88  return *this;
89  }
90 
93  {
94  for (U32 index = 0; index < SIZE; index++) {
95  this->elements[index] = e;
96  }
97  return *this;
98  }
99 
100  bool BuffQueueDepth ::
101  operator==(const BuffQueueDepth& obj) const
102  {
103  for (U32 index = 0; index < SIZE; index++) {
104  if (!((*this)[index] == obj[index])) {
105  return false;
106  }
107  }
108  return true;
109  }
110 
111  bool BuffQueueDepth ::
112  operator!=(const BuffQueueDepth& obj) const
113  {
114  return !(*this == obj);
115  }
116 
117 #ifdef BUILD_UT
118 
119  std::ostream& operator<<(std::ostream& os, const BuffQueueDepth& obj) {
120  Fw::String s;
121  obj.toString(s);
122  os << s;
123  return os;
124  }
125 
126 #endif
127 
128  // ----------------------------------------------------------------------
129  // Public member functions
130  // ----------------------------------------------------------------------
131 
134  {
136  for (U32 index = 0; index < SIZE; index++) {
137  status = buffer.serializeFrom((*this)[index]);
138  if (status != Fw::FW_SERIALIZE_OK) {
139  return status;
140  }
141  }
142  return status;
143  }
144 
147  {
149  for (U32 index = 0; index < SIZE; index++) {
150  status = buffer.deserializeTo((*this)[index]);
151  if (status != Fw::FW_SERIALIZE_OK) {
152  return status;
153  }
154  }
155  return status;
156  }
157 
160  {
161  return SERIALIZED_SIZE;
162  }
163 
164 #if FW_SERIALIZABLE_TO_STRING
165 
166  void BuffQueueDepth ::
167  toString(Fw::StringBase& sb) const
168  {
169  // Clear the output string
170  sb = "";
171 
172  // Array prefix
173  if (sb.length() + 2 <= sb.maxLength()) {
174  sb += "[ ";
175  } else {
176  return;
177  }
178 
179  for (U32 index = 0; index < SIZE; index++) {
180  Fw::String tmp;
181  tmp.format("%" PRIu32 "", this->elements[index]);
182 
183  FwSizeType size = tmp.length() + (index > 0 ? 2 : 0);
184  if ((size + sb.length()) <= sb.maxLength()) {
185  if (index > 0) {
186  sb += ", ";
187  }
188  sb += tmp;
189  } else {
190  break;
191  }
192  }
193 
194  // Array suffix
195  if (sb.length() + 2 <= sb.maxLength()) {
196  sb += " ]";
197  }
198  }
199 
200 #endif
201 
202 }
Serialization/Deserialization operation was successful.
Fw::SerializeStatus serializeTo(Fw::SerializeBufferBase &buffer) const
Serialization.
PlatformSizeType FwSizeType
bool operator==(const BuffQueueDepth &obj) const
Equality operator.
FwSizeType serializedSize() const
Get the dynamic serialized size of the array.
U32 ElementType
The element type.
SerializeStatus
forward declaration for string
SizeType maxLength() const
Get the maximum length of a string that the buffer can hold (which is capacity - 1) ...
Definition: StringBase.cpp:128
Header size for F Prime frame header.
Array of queue depths for Fw::Buffer types.
Fw::SerializeStatus deserializeFrom(Fw::SerializeBufferBase &buffer)
Deserialization.
SizeType length() const
Get length of string.
Definition: StringBase.cpp:121
BuffQueueDepth & operator=(const BuffQueueDepth &obj)
Copy assignment operator (object)
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
BuffQueueDepth()
Constructor (default value)
The size of the serial representation.
RateGroupDivider component implementation.
SerializeStatus serializeFrom(U8 val)
serialize 8-bit unsigned int
ElementType & operator[](const U32 i)
Subscript operator.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
bool operator!=(const BuffQueueDepth &obj) const
Inequality operator.
SerializeStatus deserializeTo(U8 &val)
deserialize 8-bit unsigned int