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>
44 lines
1.2 KiB
C++
44 lines
1.2 KiB
C++
#include <Fw/Port/InputSerializePort.hpp>
|
|
#include <Fw/Types/Assert.hpp>
|
|
#include <cstdio>
|
|
|
|
#if FW_PORT_SERIALIZATION == 1
|
|
|
|
namespace Fw {
|
|
|
|
// SerializePort has no call interface. It is to pass through serialized data
|
|
InputSerializePort::InputSerializePort() : InputPortBase(), m_func(nullptr) {}
|
|
InputSerializePort::~InputSerializePort() {}
|
|
|
|
void InputSerializePort::init() {
|
|
InputPortBase::init();
|
|
}
|
|
|
|
SerializeStatus InputSerializePort::invokeSerial(LinearBufferBase& buffer) {
|
|
FW_ASSERT(this->m_comp);
|
|
FW_ASSERT(this->m_func);
|
|
|
|
this->m_func(this->m_comp, this->m_portNum, buffer);
|
|
|
|
// The normal input ports perform deserialize() on the passed buffer,
|
|
// which is what this status is based on. This is not the case for the
|
|
// InputSerializePort, so just return an okay status
|
|
return FW_SERIALIZE_OK;
|
|
}
|
|
|
|
void InputSerializePort::addCallComp(Fw::PassiveComponentBase* callComp, CompFuncPtr funcPtr) {
|
|
FW_ASSERT(callComp);
|
|
FW_ASSERT(funcPtr);
|
|
this->m_comp = callComp;
|
|
this->m_func = funcPtr;
|
|
}
|
|
|
|
#if FW_OBJECT_TO_STRING == 1
|
|
const char* InputSerializePort::getToStringFormatString() {
|
|
return "Input Serial Port: %s %s->(%s)";
|
|
}
|
|
#endif
|
|
|
|
} // namespace Fw
|
|
#endif
|