F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
DataBuffer.cpp
Go to the documentation of this file.
2 #include <Fw/Types/Assert.hpp>
3 
4 namespace Drv {
5 
6 DataBuffer::DataBuffer(const U8* args, FwSizeType size) : Fw::LinearBufferBase(m_data, sizeof(m_data)) {
8  FW_ASSERT(Fw::FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
9 }
10 
11 DataBuffer::DataBuffer() : Fw::LinearBufferBase(m_data, sizeof(m_data)) {}
12 
14 
15 // m_data contents are copied via setBuff below
16 // cppcheck-suppress missingMemberCopy
17 DataBuffer::DataBuffer(const DataBuffer& other) : Fw::LinearBufferBase(m_data, sizeof(m_data)) {
18  Fw::SerializeStatus stat = Fw::LinearBufferBase::setBuff(other.m_data, other.getSize());
19  FW_ASSERT(Fw::FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
20 }
21 
23  if (this == &other) {
24  return *this;
25  }
26 
27  Fw::SerializeStatus stat = Fw::LinearBufferBase::setBuff(other.m_data, other.getSize());
28  FW_ASSERT(Fw::FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
29  return *this;
30 }
31 
32 FwSizeType DataBuffer::getBuffCapacity() const {
33  return this->getCapacity();
34 }
35 
36 } // namespace Drv
Serialization/Deserialization operation was successful.
SerializeStatus setBuff(const U8 *src, Serializable::SizeType length) override
Set buffer contents from external source.
PlatformSizeType FwSizeType
Serializable::SizeType getSize() const override
Get current buffer size.
Serializable::SizeType getCapacity() const override
Get buffer capacity.
DataBuffer & operator=(const DataBuffer &other)
Definition: DataBuffer.cpp:22
SerializeStatus
forward declaration for string
virtual ~DataBuffer()
Definition: DataBuffer.cpp:13
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:54
Implementation of malloc based allocator.
#define FW_ASSERT(...)
Definition: Assert.hpp:14