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.getBuffLength());
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.getBuffLength());
27  FW_ASSERT(FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
28  return *this;
29 }
30 
32  return sizeof(this->m_bufferData);
33 }
34 
36  return this->m_bufferData;
37 }
38 
40  return this->m_bufferData;
41 }
42 
44  if (this->getBuffLength() != other.getBuffLength()) {
45  return false;
46  }
47 
48  const U8* us = this->getBuffAddr();
49  const U8* them = other.getBuffAddr();
50 
51  FW_ASSERT(us);
52  FW_ASSERT(them);
53 
54  for (Serializable::SizeType byte = 0; byte < this->getBuffLength(); byte++) {
55  if (us[byte] != them[byte]) {
56  return false;
57  }
58  }
59 
60  return true;
61 }
62 
63 #if FW_SERIALIZABLE_TO_STRING
64 void StatementArgBuffer::toString(Fw::StringBase& text) const {
65  static const char* formatString = "(data = %p, size = %" PRI_FwSizeType ")";
66  text.format(formatString, &this->m_bufferData, this->getBuffLength());
67 }
68 #endif
69 } // namespace Fw
Serialization/Deserialization operation was successful.
PlatformSizeType FwSizeType
StatementArgBuffer & operator=(const StatementArgBuffer &other)
U8 * getBuffAddr()
gets buffer address for data filling
#define PRI_FwSizeType
SerializeStatus
forward declaration for string
Serializable::SizeType getBuffLength() const
returns current buffer size
Serializable::SizeType getBuffCapacity() const
returns capacity, not current size, of buffer
FwSizeType SizeType
bool operator==(const StatementArgBuffer &other) const
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
SerializeStatus setBuff(const U8 *src, Serializable::SizeType length)
sets buffer contents and size
Declares F Prime string base class.
#define FW_ASSERT(...)
Definition: Assert.hpp:14