F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
SmSignalBuffer.cpp
Go to the documentation of this file.
2 #include <Fw/Types/Assert.hpp>
3 
4 namespace Fw {
5 
6  SmSignalBuffer::SmSignalBuffer(const U8 *args, Serializable::SizeType size) : m_bufferData{} {
7  FW_ASSERT(args != nullptr);
8  FW_ASSERT(size <= sizeof(this->m_bufferData));
9  SerializeStatus stat = SerializeBufferBase::setBuff(args,static_cast<NATIVE_UINT_TYPE>(size));
10  FW_ASSERT(FW_SERIALIZE_OK == stat,static_cast<NATIVE_INT_TYPE>(stat));
11  }
12 
13  SmSignalBuffer::SmSignalBuffer() : m_bufferData{} {
14  }
15 
17  }
18 
20  m_bufferData{}
21  {
22  FW_ASSERT(other.getBuffAddr() != nullptr);
23  FW_ASSERT(other.getBuffLength() <= sizeof(this->m_bufferData));
24 
25  SerializeStatus stat = SerializeBufferBase::setBuff(other.m_bufferData,other.getBuffLength());
26  FW_ASSERT(FW_SERIALIZE_OK == stat,static_cast<NATIVE_INT_TYPE>(stat));
27  }
28 
30  if(this == &other) {
31  return *this;
32  }
33 
34  FW_ASSERT(other.getBuffAddr() != nullptr);
35  FW_ASSERT(other.getBuffLength() <= sizeof(this->m_bufferData));
36 
37  SerializeStatus stat = SerializeBufferBase::setBuff(other.m_bufferData,other.getBuffLength());
38  FW_ASSERT(FW_SERIALIZE_OK == stat,static_cast<NATIVE_INT_TYPE>(stat));
39  return *this;
40  }
41 
43  return sizeof(this->m_bufferData);
44  }
45 
47  return this->m_bufferData;
48  }
49 
51  return this->m_bufferData;
52  }
53 
54 }
55 
#define FW_ASSERT(...)
Definition: Assert.hpp:14
PlatformIntType NATIVE_INT_TYPE
Definition: BasicTypes.h:55
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:30
PlatformUIntType NATIVE_UINT_TYPE
Definition: BasicTypes.h:56
NATIVE_UINT_TYPE SizeType
Serializable::SizeType getBuffLength() const
returns current buffer size
SerializeStatus setBuff(const U8 *src, Serializable::SizeType length)
sets buffer contents and size
Serializable::SizeType getBuffCapacity() const
returns capacity, not current size, of buffer
U8 * getBuffAddr()
gets buffer address for data filling
SmSignalBuffer & operator=(const SmSignalBuffer &other)
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.