fprime/Fw/Com/ComPacket.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

30 lines
701 B
C++

/*
* ComPacket.cpp
*
* Created on: May 24, 2014
* Author: Timothy Canham
*/
#include <Fw/Com/ComPacket.hpp>
namespace Fw {
ComPacket::ComPacket() : m_type(ComPacketType::FW_PACKET_UNKNOWN) {}
ComPacket::~ComPacket() {}
SerializeStatus ComPacket::serializeBase(SerialBufferBase& buffer) const {
return buffer.serializeFrom(static_cast<FwPacketDescriptorType>(this->m_type));
}
SerializeStatus ComPacket::deserializeBase(SerialBufferBase& buffer) {
FwPacketDescriptorType serVal;
SerializeStatus stat = buffer.deserializeTo(serVal);
if (FW_SERIALIZE_OK == stat) {
this->m_type = static_cast<ComPacketType>(serVal);
}
return stat;
}
} /* namespace Fw */