F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
StatementArgBuffer.cpp
Go to the documentation of this file.
2 #include <Fw/Types/Assert.hpp>
4 
5 namespace Fw {
6 
9  FW_ASSERT(FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
10 }
11 
13 
15 
17  SerializeStatus stat = SerializeBufferBase::setBuff(other.m_bufferData, other.getSize());
18  FW_ASSERT(FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
19 }
20 
22  if (this == &other) {
23  return *this;
24  }
25 
26  SerializeStatus stat = SerializeBufferBase::setBuff(other.m_bufferData, other.getSize());
27  FW_ASSERT(FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
28  return *this;
29 }
30 
32  return sizeof(this->m_bufferData);
33 }
34 
35 Serializable::SizeType StatementArgBuffer::getBuffCapacity() const {
36  return this->getCapacity();
37 }
38 
40  return this->m_bufferData;
41 }
42 
44  return this->m_bufferData;
45 }
46 
48  if (this->getSize() != other.getSize()) {
49  return false;
50  }
51 
52  const U8* us = this->getBuffAddr();
53  const U8* them = other.getBuffAddr();
54 
55  FW_ASSERT(us);
56  FW_ASSERT(them);
57 
58  for (Serializable::SizeType byte = 0; byte < this->getSize(); byte++) {
59  if (us[byte] != them[byte]) {
60  return false;
61  }
62  }
63 
64  return true;
65 }
66 
67 #if FW_SERIALIZABLE_TO_STRING
68 void StatementArgBuffer::toString(Fw::StringBase& text) const {
69  static const char* formatString = "(data = %p, size = %" PRI_FwSizeType ")";
70  text.format(formatString, &this->m_bufferData, this->getSize());
71 }
72 #endif
73 } // namespace Fw
Serialization/Deserialization operation was successful.
PlatformSizeType FwSizeType
StatementArgBuffer & operator=(const StatementArgBuffer &other)
U8 * getBuffAddr()
Get buffer address for data filling (non-const version)
#define PRI_FwSizeType
Serializable::SizeType getSize() const override
Get current buffer size.
SerializeStatus
forward declaration for string
FwSizeType SizeType
SerializeStatus setBuff(const U8 *src, Serializable::SizeType length) override
Set buffer contents from external source.
Serializable::SizeType getCapacity() const
Get buffer capacity.
bool operator==(const StatementArgBuffer &other) const
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
Declares F Prime string base class.
Implementation of malloc based allocator.
#define FW_ASSERT(...)
Definition: Assert.hpp:14