fprime/Fw/Prm/PrmBuffer.cpp
Vince Woo 48e4720419
Created new SerialBufferBase as a parent of SerializeBufferBase (now renamed LinearBufferBase). (#4288)
* 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>
2025-11-06 16:23:20 -08:00

47 lines
1.2 KiB
C++

#include <Fw/Prm/PrmBuffer.hpp>
#include <Fw/Types/Assert.hpp>
namespace Fw {
ParamBuffer::ParamBuffer(const U8* args, FwSizeType size) {
SerializeStatus stat = SerializeBufferBase::setBuff(args, size);
FW_ASSERT(FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
}
ParamBuffer::ParamBuffer() {}
ParamBuffer::~ParamBuffer() {}
ParamBuffer::ParamBuffer(const ParamBuffer& other) : Fw::SerializeBufferBase() {
SerializeStatus stat = SerializeBufferBase::setBuff(other.m_bufferData, other.getSize());
FW_ASSERT(FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
}
ParamBuffer& ParamBuffer::operator=(const ParamBuffer& other) {
if (this == &other) {
return *this;
}
SerializeStatus stat = SerializeBufferBase::setBuff(other.m_bufferData, other.getSize());
FW_ASSERT(FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
return *this;
}
FwSizeType ParamBuffer::getCapacity() const {
return sizeof(this->m_bufferData);
}
FwSizeType ParamBuffer::getBuffCapacity() const {
return this->getCapacity();
}
const U8* ParamBuffer::getBuffAddr() const {
return this->m_bufferData;
}
U8* ParamBuffer::getBuffAddr() {
return this->m_bufferData;
}
} // namespace Fw