F´ Flight Software - C/C++ Documentation  devel
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 
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 = BuffQueueDepth(
22  0
23  );
24  }
25 
27  BuffQueueDepth(const ElementType (&a)[SIZE]) :
28  Serializable()
29  {
30  for (U32 index = 0; index < SIZE; index++) {
31  this->elements[index] = a[index];
32  }
33  }
34 
36  BuffQueueDepth(const ElementType& e1) :
37  Serializable()
38  {
39  this->elements[0] = e1;
40  }
41 
43  BuffQueueDepth(const BuffQueueDepth& obj) :
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 
70  operator=(const BuffQueueDepth& obj)
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 
83  operator=(const ElementType (&a)[SIZE])
84  {
85  for (U32 index = 0; index < SIZE; index++) {
86  this->elements[index] = a[index];
87  }
88  return *this;
89  }
90 
92  operator=(const ElementType& e)
93  {
94  for (U32 index = 0; index < SIZE; index++) {
95  this->elements[index] = e;
96  }
97  return *this;
98  }
99 
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 
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 
133  serialize(Fw::SerializeBufferBase& buffer) const
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  static const char *formatString = "[ "
164  "%" PRIu32 " ]";
165 
166  sb.format(
167  formatString,
168  this->elements[0]
169  );
170  }
171 
172 #endif
173 
174 }
#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::Buffer types.
U32 ElementType
The element type.
bool operator==(const BuffQueueDepth &obj) const
Equality operator.
bool operator!=(const BuffQueueDepth &obj) const
Inequality operator.
@ SIZE
The size of the array.
Fw::SerializeStatus serialize(Fw::SerializeBufferBase &buffer) const
Serialization.
BuffQueueDepth()
Constructor (default value)
BuffQueueDepth & operator=(const BuffQueueDepth &obj)
Copy assignment operator (object)
ElementType & operator[](const U32 i)
Subscript operator.
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase &buffer)
Deserialization.
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
@ SIZE
Header size for F Prime frame header.