mirror of
https://github.com/nasa/fprime.git
synced 2025-12-10 00:44:37 -06:00
* Created new SerialBufferBase as a parent of SerializeBufferBase. Renaming interface functions to be less confusing. * Deprecating copyRawOffset. No direct use-cases in F' core. * Make SerialBufferBase a true pure virtual interface. * Changing Serializable to work with SerialBufferBase parent interface. * Changing copyRaw and copyRawOffset to work with SerialBufferBase * Updating documentation for SerialBufferBase usage * Adding some documentation. Adding missing ASSERT in copyRaw. Fixing some bugs that new ASSERT uncovered. * Renaming SerializeBufferBase to LinearBufferBase. Add a using declaration to maintain backwards compatability. Properly mark LinearBufferBase functions as override. * Filling in the rest of the docstrings for the classes in Serializable * Removing redundant virtual keyword on override function * Applying clang formatting * Incorporating PR comments * Fix compile issues * Bump version to alpha * Format * v --------- Co-authored-by: M Starch <LeStarch@googlemail.com>
55 lines
1.7 KiB
C++
55 lines
1.7 KiB
C++
#include <Fw/Sm/SmSignalBuffer.hpp>
|
|
#include <Fw/Types/Assert.hpp>
|
|
|
|
namespace Fw {
|
|
|
|
SmSignalBuffer::SmSignalBuffer(const U8* args, Serializable::SizeType size) : m_bufferData{} {
|
|
FW_ASSERT(args != nullptr);
|
|
FW_ASSERT(size <= sizeof(this->m_bufferData));
|
|
SerializeStatus stat = SerializeBufferBase::setBuff(args, size);
|
|
FW_ASSERT(FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
|
|
}
|
|
|
|
SmSignalBuffer::SmSignalBuffer() : m_bufferData{} {}
|
|
|
|
SmSignalBuffer::~SmSignalBuffer() {}
|
|
|
|
SmSignalBuffer::SmSignalBuffer(const SmSignalBuffer& other) : Fw::SerializeBufferBase(), m_bufferData{} {
|
|
FW_ASSERT(other.getBuffAddr() != nullptr);
|
|
FW_ASSERT(other.getSize() <= sizeof(this->m_bufferData));
|
|
|
|
SerializeStatus stat = SerializeBufferBase::setBuff(other.m_bufferData, other.getSize());
|
|
FW_ASSERT(FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
|
|
}
|
|
|
|
SmSignalBuffer& SmSignalBuffer::operator=(const SmSignalBuffer& other) {
|
|
if (this == &other) {
|
|
return *this;
|
|
}
|
|
|
|
FW_ASSERT(other.getBuffAddr() != nullptr);
|
|
FW_ASSERT(other.getSize() <= sizeof(this->m_bufferData));
|
|
|
|
SerializeStatus stat = SerializeBufferBase::setBuff(other.m_bufferData, other.getSize());
|
|
FW_ASSERT(FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
|
|
return *this;
|
|
}
|
|
|
|
Serializable::SizeType SmSignalBuffer::getCapacity() const {
|
|
return sizeof(this->m_bufferData);
|
|
}
|
|
|
|
Serializable::SizeType SmSignalBuffer::getBuffCapacity() const {
|
|
return this->getCapacity();
|
|
}
|
|
|
|
const U8* SmSignalBuffer::getBuffAddr() const {
|
|
return this->m_bufferData;
|
|
}
|
|
|
|
U8* SmSignalBuffer::getBuffAddr() {
|
|
return this->m_bufferData;
|
|
}
|
|
|
|
} // namespace Fw
|