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.serialize((*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.deserialize((*this)[index]);
151  if (status != Fw::FW_SERIALIZE_OK) {
152  return status;
153  }
154  }
155  return status;
156  }
157 
158 #if FW_SERIALIZABLE_TO_STRING
159 
160  void BuffQueueDepth ::
161  toString(Fw::StringBase& sb) const
162  {
163  // Clear the output string
164  sb = "";
165 
166  // Array prefix
167  if (sb.length() + 2 <= sb.maxLength()) {
168  sb += "[ ";
169  } else {
170  return;
171  }
172 
173  for (U32 index = 0; index < SIZE; index++) {
174  Fw::String tmp;
175  tmp.format("%" PRIu32 "", this->elements[index]);
176 
177  FwSizeType size = tmp.length() + (index > 0 ? 2 : 0);
178  if ((size + sb.length()) <= sb.maxLength()) {
179  if (index > 0) {
180  sb += ", ";
181  }
182  sb += tmp;
183  } else {
184  break;
185  }
186  }
187 
188  // Array suffix
189  if (sb.length() + 2 <= sb.maxLength()) {
190  sb += " ]";
191  }
192  }
193 
194 #endif
195 
196 }
Serialization/Deserialization operation was successful.
PlatformSizeType FwSizeType
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
bool operator==(const BuffQueueDepth &obj) const
Equality operator.
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
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase &buffer)
Deserialization.
Header size for F Prime frame header.
Array of queue depths for Fw::Buffer types.
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
Fw::SerializeStatus serialize(Fw::SerializeBufferBase &buffer) const
Serialization.
BuffQueueDepth()
Constructor (default value)
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
RateGroupDivider component implementation.
ElementType & operator[](const U32 i)
Subscript operator.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
bool operator!=(const BuffQueueDepth &obj) const
Inequality operator.