fprime/Fw/FilePacket/CancelPacket.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

42 lines
1.2 KiB
C++

// ======================================================================
// \title CancelPacket.cpp
// \author bocchino
// \brief cpp file for FilePacket::CancelPacket
//
// \copyright
// Copyright 2009-2016, by the California Institute of Technology.
// ALL RIGHTS RESERVED. United States Government Sponsorship
// acknowledged.
//
// ======================================================================
#include <Fw/FilePacket/FilePacket.hpp>
#include <Fw/Types/Assert.hpp>
namespace Fw {
void FilePacket::CancelPacket ::initialize(const U32 sequenceIndex) {
this->m_header.initialize(FilePacket::T_CANCEL, sequenceIndex);
}
U32 FilePacket::CancelPacket ::bufferSize() const {
return this->m_header.bufferSize();
}
SerializeStatus FilePacket::CancelPacket ::toBuffer(Buffer& buffer) const {
SerialBuffer serialBuffer(buffer.getData(), buffer.getSize());
return this->m_header.toSerialBuffer(serialBuffer);
}
SerializeStatus FilePacket::CancelPacket ::fromSerialBuffer(SerialBuffer& serialBuffer) {
FW_ASSERT(this->m_header.m_type == T_CANCEL);
if (serialBuffer.getDeserializeSizeLeft() != 0) {
return FW_DESERIALIZE_SIZE_MISMATCH;
}
return FW_SERIALIZE_OK;
}
} // namespace Fw