mirror of
https://github.com/nasa/fprime.git
synced 2025-12-10 00:44:37 -06:00
(De)Serialization clean up of temporary workarounds (#3971)
* Staging DEPRECATE changes in preparation for new FPP alpha. Removed backwards compat hacks. Updated some uses of the legacy functions that were missed originally. * Remove declaration of serialize and deserialize from RawTime as those should be inherited now * Removing FW_SERIALIZE_UNIMPLEMENTED and FW_DESERIALIZE_UNIMPLEMENTED from SerializeStatus * Removing superfluous comma * Missed AmpcsEvrLogPacket. Fixing a minor whitespace issue in Serializable. * Un-deprecating serialize/deserialize for this release * Restoring DEPRECATED for the noLength functions * Pulling in fpp 3.0.0a17. Fixing some lingering issues with refactoring. * Format files * Update fprime-fpp package * Fixing some lingering issues with serialization modernization. * Fixing weird merge issue with AmpcsEvrLogPacket * More clang issue fixes * Still pesky clang formatting issues. Superfluous whitespace. * Removing redundant virtuals for overriden methods * Incorporating PR comments * clang formatted Serializable.hpp * Removing redundant serialize and deserialize methods in TestAbsType. Inherit from parent. --------- Co-authored-by: thomas-bc <thomas.boyerchammard@gmail.com>
This commit is contained in:
parent
89bccfa438
commit
f38010abca
@ -56,24 +56,10 @@ struct TestAbsType final : public Fw::Serializable {
|
||||
//! Deserialize method
|
||||
//! \return status
|
||||
Fw::SerializeStatus deserializeFrom(Fw::SerializeBufferBase& sbb //!< The serialize buffer base
|
||||
) final {
|
||||
) final {
|
||||
return sbb.deserializeTo(this->m_data);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Methods
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Fw::SerializeStatus serialize(Fw::SerializeBufferBase& sbb) const final
|
||||
{
|
||||
return this->serializeTo(sbb);
|
||||
}
|
||||
|
||||
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase& sbb) final
|
||||
{
|
||||
return this->deserializeFrom(sbb);
|
||||
}
|
||||
|
||||
#if FW_SERIALIZABLE_TO_STRING
|
||||
//! Convert TestAbsType to string
|
||||
void toString(Fw::StringBase& sb //!< The StringBase object to hold the result
|
||||
|
||||
@ -189,12 +189,4 @@ std::ostream& operator<<(std::ostream& os, const Buffer& obj) {
|
||||
}
|
||||
#endif
|
||||
|
||||
Fw::SerializeStatus Buffer::serialize(Fw::SerializeBufferBase& serialBuffer) const {
|
||||
return this->serializeTo(serialBuffer);
|
||||
}
|
||||
|
||||
Fw::SerializeStatus Buffer::deserialize(Fw::SerializeBufferBase& buffer) {
|
||||
return this->deserializeFrom(buffer);
|
||||
}
|
||||
|
||||
} // end namespace Fw
|
||||
|
||||
@ -137,14 +137,6 @@ class Buffer : public Fw::Serializable {
|
||||
//! \return: status of serialization
|
||||
Fw::SerializeStatus deserializeFrom(Fw::SerializeBufferBase& buffer);
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Deprecated methods
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Fw::SerializeStatus serialize(Fw::SerializeBufferBase& serialBuffer) const;
|
||||
|
||||
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase& buffer);
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Accessor functions
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@ -35,7 +35,7 @@ SerializeStatus CmdPacket::deserializeFrom(SerializeBufferBase& buffer) {
|
||||
return FW_DESERIALIZE_TYPE_MISMATCH;
|
||||
}
|
||||
|
||||
stat = buffer.deserialize(this->m_opcode);
|
||||
stat = buffer.deserializeTo(this->m_opcode);
|
||||
if (stat != FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
@ -49,15 +49,6 @@ SerializeStatus CmdPacket::deserializeFrom(SerializeBufferBase& buffer) {
|
||||
return stat;
|
||||
}
|
||||
|
||||
// Deprecated methods for backward compatibility - these call the new interface
|
||||
SerializeStatus CmdPacket::serialize(SerializeBufferBase& buffer) const {
|
||||
return this->serializeTo(buffer);
|
||||
}
|
||||
|
||||
SerializeStatus CmdPacket::deserialize(SerializeBufferBase& buffer) {
|
||||
return this->deserializeFrom(buffer);
|
||||
}
|
||||
|
||||
FwOpcodeType CmdPacket::getOpCode() const {
|
||||
return this->m_opcode;
|
||||
}
|
||||
|
||||
@ -22,9 +22,6 @@ class CmdPacket : public ComPacket {
|
||||
SerializeStatus serializeTo(SerializeBufferBase& buffer) const;
|
||||
SerializeStatus deserializeFrom(SerializeBufferBase& buffer);
|
||||
|
||||
// Legacy serialization methods (backward compatibility)
|
||||
SerializeStatus serialize(SerializeBufferBase& buffer) const; //!< serialize contents
|
||||
SerializeStatus deserialize(SerializeBufferBase& buffer);
|
||||
FwOpcodeType getOpCode() const;
|
||||
CmdArgBuffer& getArgBuffer();
|
||||
|
||||
|
||||
@ -14,35 +14,16 @@ ComPacket::ComPacket() : m_type(ComPacketType::FW_PACKET_UNKNOWN) {}
|
||||
ComPacket::~ComPacket() {}
|
||||
|
||||
SerializeStatus ComPacket::serializeBase(SerializeBufferBase& buffer) const {
|
||||
return buffer.serialize(static_cast<FwPacketDescriptorType>(this->m_type));
|
||||
return buffer.serializeFrom(static_cast<FwPacketDescriptorType>(this->m_type));
|
||||
}
|
||||
|
||||
SerializeStatus ComPacket::deserializeBase(SerializeBufferBase& buffer) {
|
||||
FwPacketDescriptorType serVal;
|
||||
SerializeStatus stat = buffer.deserialize(serVal);
|
||||
SerializeStatus stat = buffer.deserializeTo(serVal);
|
||||
if (FW_SERIALIZE_OK == stat) {
|
||||
this->m_type = static_cast<ComPacketType>(serVal);
|
||||
}
|
||||
return stat;
|
||||
}
|
||||
|
||||
SerializeStatus ComPacket::serializeTo(SerializeBufferBase& buffer) const {
|
||||
// Default implementation for base class - derived classes should override this method
|
||||
return FW_SERIALIZE_UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
SerializeStatus ComPacket::deserializeFrom(SerializeBufferBase& buffer) {
|
||||
// Default implementation for base class - derived classes should override this method
|
||||
return FW_DESERIALIZE_UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
// Deprecated methods for backward compatibility
|
||||
SerializeStatus ComPacket::serialize(SerializeBufferBase& buffer) const {
|
||||
return this->serializeTo(buffer);
|
||||
}
|
||||
|
||||
SerializeStatus ComPacket::deserialize(SerializeBufferBase& buffer) {
|
||||
return this->deserializeFrom(buffer);
|
||||
}
|
||||
|
||||
} /* namespace Fw */
|
||||
|
||||
@ -24,14 +24,6 @@ class ComPacket : public Serializable {
|
||||
ComPacket();
|
||||
virtual ~ComPacket();
|
||||
|
||||
// New serialization interface
|
||||
SerializeStatus serializeTo(SerializeBufferBase& buffer) const override;
|
||||
SerializeStatus deserializeFrom(SerializeBufferBase& buffer) override;
|
||||
|
||||
// Deprecated methods for backward compatibility
|
||||
SerializeStatus serialize(SerializeBufferBase& buffer) const override;
|
||||
SerializeStatus deserialize(SerializeBufferBase& buffer) override;
|
||||
|
||||
protected:
|
||||
ComPacketType m_type;
|
||||
SerializeStatus serializeBase(
|
||||
|
||||
@ -14,74 +14,64 @@ namespace Fw {
|
||||
AmpcsEvrLogPacket::AmpcsEvrLogPacket() : m_eventID(0), m_overSeqNum(0), m_catSeqNum(0) {
|
||||
this->m_type = FW_PACKET_LOG;
|
||||
}
|
||||
|
||||
AmpcsEvrLogPacket::~AmpcsEvrLogPacket() {}
|
||||
|
||||
SerializeStatus AmpcsEvrLogPacket::serialize(SerializeBufferBase& buffer) const {
|
||||
// Deprecated method - calls new interface for backward compatibility
|
||||
return this->serializeTo(buffer);
|
||||
}
|
||||
|
||||
SerializeStatus AmpcsEvrLogPacket::deserialize(SerializeBufferBase& buffer) {
|
||||
// Deprecated method - calls new interface for backward compatibility
|
||||
return this->deserializeFrom(buffer);
|
||||
}
|
||||
|
||||
SerializeStatus AmpcsEvrLogPacket::serializeTo(SerializeBufferBase& buffer) const {
|
||||
SerializeStatus stat;
|
||||
|
||||
stat = buffer.serialize(this->m_taskName, AMPCS_EVR_TASK_NAME_LEN, Fw::Serialization::OMIT_LENGTH);
|
||||
stat = buffer.serializeFrom(this->m_taskName, AMPCS_EVR_TASK_NAME_LEN, Fw::Serialization::OMIT_LENGTH);
|
||||
if (stat != FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
|
||||
stat = buffer.serialize(this->m_eventID);
|
||||
stat = buffer.serializeFrom(this->m_eventID);
|
||||
if (stat != FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
|
||||
stat = buffer.serialize(this->m_overSeqNum);
|
||||
stat = buffer.serializeFrom(this->m_overSeqNum);
|
||||
if (stat != FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
|
||||
stat = buffer.serialize(this->m_catSeqNum);
|
||||
stat = buffer.serializeFrom(this->m_catSeqNum);
|
||||
if (stat != FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
|
||||
return buffer.serialize(this->m_logBuffer.getBuffAddr(), m_logBuffer.getBuffLength(),
|
||||
Fw::Serialization::OMIT_LENGTH);
|
||||
return buffer.serializeFrom(this->m_logBuffer.getBuffAddr(), m_logBuffer.getBuffLength(),
|
||||
Fw::Serialization::OMIT_LENGTH);
|
||||
}
|
||||
|
||||
SerializeStatus AmpcsEvrLogPacket::deserializeFrom(SerializeBufferBase& buffer) {
|
||||
FwSizeType len;
|
||||
|
||||
SerializeStatus stat;
|
||||
SerializeStatus stat;
|
||||
|
||||
len = AMPCS_EVR_TASK_NAME_LEN;
|
||||
stat = buffer.deserialize(this->m_taskName, len, true);
|
||||
stat = buffer.deserializeTo(this->m_taskName, len, true);
|
||||
if (stat != FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
|
||||
stat = buffer.deserialize(this->m_eventID);
|
||||
stat = buffer.deserializeTo(this->m_eventID);
|
||||
if (stat != FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
|
||||
stat = buffer.deserialize(this->m_overSeqNum);
|
||||
stat = buffer.deserializeTo(this->m_overSeqNum);
|
||||
if (stat != FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
|
||||
stat = buffer.deserialize(this->m_catSeqNum);
|
||||
stat = buffer.deserializeTo(this->m_catSeqNum);
|
||||
if (stat != FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
|
||||
FwSizeType size = buffer.getBuffLeft();
|
||||
stat = buffer.deserialize(this->m_logBuffer.getBuffAddr(), size, true);
|
||||
stat = buffer.deserializeTo(this->m_logBuffer.getBuffAddr(), size, true);
|
||||
if (stat == FW_SERIALIZE_OK) {
|
||||
// Shouldn't fail
|
||||
stat = this->m_logBuffer.setBuffLen(size);
|
||||
|
||||
@ -23,11 +23,8 @@ class AmpcsEvrLogPacket : public ComPacket {
|
||||
AmpcsEvrLogPacket();
|
||||
virtual ~AmpcsEvrLogPacket();
|
||||
|
||||
SerializeStatus serialize(SerializeBufferBase& buffer) const override; //!< serialize contents
|
||||
SerializeStatus deserialize(SerializeBufferBase& buffer) override;
|
||||
|
||||
SerializeStatus serializeTo(SerializeBufferBase& buffer) const override; //!< serialize contents
|
||||
SerializeStatus deserializeFrom(SerializeBufferBase& buffer) override;
|
||||
SerializeStatus serializeTo(SerializeBufferBase& buffer) const; //!< serialize contents
|
||||
SerializeStatus deserializeFrom(SerializeBufferBase& buffer);
|
||||
|
||||
void setTaskName(U8* taskName, U8 len);
|
||||
void setId(U32 eventID);
|
||||
|
||||
@ -16,35 +16,25 @@ LogPacket::LogPacket() : m_id(0) {
|
||||
|
||||
LogPacket::~LogPacket() {}
|
||||
|
||||
SerializeStatus LogPacket::serialize(SerializeBufferBase& buffer) const {
|
||||
// Deprecated method - calls new interface for backward compatibility
|
||||
return this->serializeTo(buffer);
|
||||
}
|
||||
|
||||
SerializeStatus LogPacket::deserialize(SerializeBufferBase& buffer) {
|
||||
// Deprecated method - calls new interface for backward compatibility
|
||||
return this->deserializeFrom(buffer);
|
||||
}
|
||||
|
||||
SerializeStatus LogPacket::serializeTo(SerializeBufferBase& buffer) const {
|
||||
SerializeStatus stat = ComPacket::serializeBase(buffer);
|
||||
if (stat != FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
|
||||
stat = buffer.serialize(this->m_id);
|
||||
stat = buffer.serializeFrom(this->m_id);
|
||||
if (stat != FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
|
||||
stat = buffer.serialize(this->m_timeTag);
|
||||
stat = buffer.serializeFrom(this->m_timeTag);
|
||||
if (stat != FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
|
||||
// We want to add data but not size for the ground software
|
||||
return buffer.serialize(this->m_logBuffer.getBuffAddr(), m_logBuffer.getBuffLength(),
|
||||
Fw::Serialization::OMIT_LENGTH);
|
||||
return buffer.serializeFrom(this->m_logBuffer.getBuffAddr(), m_logBuffer.getBuffLength(),
|
||||
Fw::Serialization::OMIT_LENGTH);
|
||||
}
|
||||
|
||||
SerializeStatus LogPacket::deserializeFrom(SerializeBufferBase& buffer) {
|
||||
@ -53,19 +43,19 @@ SerializeStatus LogPacket::deserializeFrom(SerializeBufferBase& buffer) {
|
||||
return stat;
|
||||
}
|
||||
|
||||
stat = buffer.deserialize(this->m_id);
|
||||
stat = buffer.deserializeTo(this->m_id);
|
||||
if (stat != FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
|
||||
stat = buffer.deserialize(this->m_timeTag);
|
||||
stat = buffer.deserializeTo(this->m_timeTag);
|
||||
if (stat != FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
|
||||
// remainder of buffer must be telemetry value
|
||||
FwSizeType size = buffer.getBuffLeft();
|
||||
stat = buffer.deserialize(this->m_logBuffer.getBuffAddr(), size, Fw::Serialization::OMIT_LENGTH);
|
||||
stat = buffer.deserializeTo(this->m_logBuffer.getBuffAddr(), size, Fw::Serialization::OMIT_LENGTH);
|
||||
if (stat == FW_SERIALIZE_OK) {
|
||||
// Shouldn't fail
|
||||
stat = this->m_logBuffer.setBuffLen(size);
|
||||
|
||||
@ -19,9 +19,6 @@ class LogPacket : public ComPacket {
|
||||
LogPacket();
|
||||
virtual ~LogPacket();
|
||||
|
||||
SerializeStatus serialize(SerializeBufferBase& buffer) const override; //!< serialize contents
|
||||
SerializeStatus deserialize(SerializeBufferBase& buffer) override;
|
||||
|
||||
SerializeStatus serializeTo(SerializeBufferBase& buffer) const override; //!< serialize contents
|
||||
SerializeStatus deserializeFrom(SerializeBufferBase& buffer) override;
|
||||
|
||||
|
||||
@ -76,37 +76,11 @@ bool Time::operator<=(const Time& other) const {
|
||||
}
|
||||
|
||||
SerializeStatus Time::serializeTo(SerializeBufferBase& buffer) const {
|
||||
// Fallback approach for backward compatibility:
|
||||
// Try new interface first, but if it returns UNIMPLEMENTED (indicating default implementation),
|
||||
// fall back to old interface. This bridges auto-generated enums/structs (old interface only)
|
||||
// with new serialization infrastructure.
|
||||
SerializeStatus status = this->m_val.serializeTo(buffer);
|
||||
if (status == FW_SERIALIZE_UNIMPLEMENTED) {
|
||||
// Fallback to old interface for backward compatibility
|
||||
status = this->m_val.serialize(buffer);
|
||||
}
|
||||
return status;
|
||||
return this->m_val.serializeTo(buffer);
|
||||
}
|
||||
|
||||
SerializeStatus Time::deserializeFrom(SerializeBufferBase& buffer) {
|
||||
// Fallback approach for backward compatibility:
|
||||
// Try new interface first, but if it returns UNIMPLEMENTED (indicating default implementation),
|
||||
// fall back to old interface.
|
||||
SerializeStatus status = this->m_val.deserializeFrom(buffer);
|
||||
if (status == FW_DESERIALIZE_UNIMPLEMENTED) {
|
||||
// Fallback to old interface for backward compatibility
|
||||
status = this->m_val.deserialize(buffer);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
// Deprecated methods for backward compatibility - these call the new interface
|
||||
SerializeStatus Time::serialize(SerializeBufferBase& buffer) const {
|
||||
return this->serializeTo(buffer);
|
||||
}
|
||||
|
||||
SerializeStatus Time::deserialize(SerializeBufferBase& buffer) {
|
||||
return this->deserializeFrom(buffer);
|
||||
return this->m_val.deserializeFrom(buffer);
|
||||
}
|
||||
|
||||
U32 Time::getSeconds() const {
|
||||
|
||||
@ -38,8 +38,6 @@ class Time : public Serializable {
|
||||
FwTimeContextStoreType getContext() const; // !< get the context value
|
||||
SerializeStatus serializeTo(SerializeBufferBase& buffer) const override; // !< Serialize method
|
||||
SerializeStatus deserializeFrom(SerializeBufferBase& buffer) override; // !< Deserialize method
|
||||
SerializeStatus serialize(SerializeBufferBase& buffer) const override; // !< Serialize method (deprecated)
|
||||
SerializeStatus deserialize(SerializeBufferBase& buffer) override; // !< Deserialize method (deprecated)
|
||||
bool operator==(const Time& other) const;
|
||||
bool operator!=(const Time& other) const;
|
||||
bool operator>(const Time& other) const;
|
||||
|
||||
@ -47,16 +47,6 @@ bool TimeInterval::operator<=(const TimeInterval& other) const {
|
||||
return ((LT == c) or (EQ == c));
|
||||
}
|
||||
|
||||
SerializeStatus TimeInterval::serialize(SerializeBufferBase& buffer) const {
|
||||
// Deprecated method - calls new interface for backward compatibility
|
||||
return this->serializeTo(buffer);
|
||||
}
|
||||
|
||||
SerializeStatus TimeInterval::deserialize(SerializeBufferBase& buffer) {
|
||||
// Deprecated method - calls new interface for backward compatibility
|
||||
return this->deserializeFrom(buffer);
|
||||
}
|
||||
|
||||
SerializeStatus TimeInterval::serializeTo(SerializeBufferBase& buffer) const {
|
||||
// Use TimeIntervalValue's built-in serialization
|
||||
return this->m_val.serializeTo(buffer);
|
||||
|
||||
@ -27,8 +27,6 @@ class TimeInterval : public Serializable {
|
||||
void set(U32 seconds, U32 useconds); // !< Sets value of time stored
|
||||
U32 getSeconds() const; // !< Gets seconds part of time
|
||||
U32 getUSeconds() const; // !< Gets microseconds part of time
|
||||
SerializeStatus serialize(SerializeBufferBase& buffer) const override; // !< Serialize method
|
||||
SerializeStatus deserialize(SerializeBufferBase& buffer) override; // !< Deserialize method
|
||||
|
||||
SerializeStatus serializeTo(SerializeBufferBase& buffer) const override; // !< Serialize method
|
||||
SerializeStatus deserializeFrom(SerializeBufferBase& buffer) override; // !< Deserialize method
|
||||
|
||||
@ -70,19 +70,20 @@ SerializeStatus TlmPacket::addValue(FwChanIdType id, Time& timeTag, TlmBuffer& b
|
||||
// serialize items into buffer
|
||||
|
||||
// id
|
||||
SerializeStatus stat = this->m_tlmBuffer.serialize(id);
|
||||
SerializeStatus stat = this->m_tlmBuffer.serializeFrom(id);
|
||||
if (stat != Fw::FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
|
||||
// time tag
|
||||
stat = this->m_tlmBuffer.serialize(timeTag);
|
||||
stat = this->m_tlmBuffer.serializeFrom(timeTag);
|
||||
if (stat != Fw::FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
|
||||
// telemetry buffer
|
||||
stat = this->m_tlmBuffer.serialize(buffer.getBuffAddr(), buffer.getBuffLength(), Fw::Serialization::OMIT_LENGTH);
|
||||
stat =
|
||||
this->m_tlmBuffer.serializeFrom(buffer.getBuffAddr(), buffer.getBuffLength(), Fw::Serialization::OMIT_LENGTH);
|
||||
if (stat != Fw::FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
@ -98,19 +99,19 @@ SerializeStatus TlmPacket::extractValue(FwChanIdType& id, Time& timeTag, TlmBuff
|
||||
// deserialize items out of buffer
|
||||
|
||||
// id
|
||||
SerializeStatus stat = this->m_tlmBuffer.deserialize(id);
|
||||
SerializeStatus stat = this->m_tlmBuffer.deserializeTo(id);
|
||||
if (stat != Fw::FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
|
||||
// time tag
|
||||
stat = this->m_tlmBuffer.deserialize(timeTag);
|
||||
stat = this->m_tlmBuffer.deserializeTo(timeTag);
|
||||
if (stat != Fw::FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
|
||||
// telemetry buffer
|
||||
stat = this->m_tlmBuffer.deserialize(buffer.getBuffAddr(), bufferSize, Fw::Serialization::OMIT_LENGTH);
|
||||
stat = this->m_tlmBuffer.deserializeTo(buffer.getBuffAddr(), bufferSize, Fw::Serialization::OMIT_LENGTH);
|
||||
if (stat != Fw::FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
@ -124,36 +125,26 @@ SerializeStatus TlmPacket::extractValue(FwChanIdType& id, Time& timeTag, TlmBuff
|
||||
return Fw::FW_SERIALIZE_OK;
|
||||
}
|
||||
|
||||
SerializeStatus TlmPacket::serialize(SerializeBufferBase& buffer) const {
|
||||
// Deprecated method - calls new interface for backward compatibility
|
||||
return this->serializeTo(buffer);
|
||||
}
|
||||
|
||||
SerializeStatus TlmPacket::deserialize(SerializeBufferBase& buffer) {
|
||||
// Deprecated method - calls new interface for backward compatibility
|
||||
return this->deserializeFrom(buffer);
|
||||
}
|
||||
|
||||
SerializeStatus TlmPacket::serializeTo(SerializeBufferBase& buffer) const {
|
||||
// serialize the number of packets
|
||||
SerializeStatus stat = buffer.serialize(this->m_numEntries);
|
||||
SerializeStatus stat = buffer.serializeFrom(this->m_numEntries);
|
||||
if (stat != Fw::FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
// Serialize the ComBuffer
|
||||
return buffer.serialize(this->m_tlmBuffer.getBuffAddr(), m_tlmBuffer.getBuffLength(),
|
||||
Fw::Serialization::OMIT_LENGTH);
|
||||
return buffer.serializeFrom(this->m_tlmBuffer.getBuffAddr(), m_tlmBuffer.getBuffLength(),
|
||||
Fw::Serialization::OMIT_LENGTH);
|
||||
}
|
||||
|
||||
SerializeStatus TlmPacket::deserializeFrom(SerializeBufferBase& buffer) {
|
||||
// deserialize the number of packets
|
||||
SerializeStatus stat = buffer.deserialize(this->m_numEntries);
|
||||
SerializeStatus stat = buffer.deserializeTo(this->m_numEntries);
|
||||
if (stat != Fw::FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
// deserialize the channel value entry buffers
|
||||
FwSizeType size = buffer.getBuffLeft();
|
||||
stat = buffer.deserialize(this->m_tlmBuffer.getBuffAddr(), size, Fw::Serialization::OMIT_LENGTH);
|
||||
stat = buffer.deserializeTo(this->m_tlmBuffer.getBuffAddr(), size, Fw::Serialization::OMIT_LENGTH);
|
||||
if (stat == FW_SERIALIZE_OK) {
|
||||
// Shouldn't fail
|
||||
stat = this->m_tlmBuffer.setBuffLen(size);
|
||||
|
||||
@ -22,13 +22,6 @@ class TlmPacket : public ComPacket {
|
||||
//! Destructor
|
||||
virtual ~TlmPacket();
|
||||
|
||||
//! Serialize the packet before sending. For use internally in software. To send to the ground, use getBuffer()
|
||||
//! below.
|
||||
SerializeStatus serialize(SerializeBufferBase& buffer) const override; //!< serialize contents
|
||||
//! Deserialize the packet. For use internally in software. To extract channels, use setBuffer() and extractValue()
|
||||
//! below. This is NOT typically used.
|
||||
SerializeStatus deserialize(SerializeBufferBase& buffer) override;
|
||||
|
||||
SerializeStatus serializeTo(SerializeBufferBase& buffer) const override; //!< serialize contents
|
||||
SerializeStatus deserializeFrom(SerializeBufferBase& buffer) override;
|
||||
//! Add telemetry value to buffer.
|
||||
|
||||
@ -482,7 +482,7 @@ bool PolyType::operator<=(const PolyType& other) const {
|
||||
|
||||
SerializeStatus PolyType::serializeTo(SerializeBufferBase& buffer) const {
|
||||
// store type
|
||||
SerializeStatus stat = buffer.serialize(static_cast<FwEnumStoreType>(this->m_dataType));
|
||||
SerializeStatus stat = buffer.serializeFrom(static_cast<FwEnumStoreType>(this->m_dataType));
|
||||
if (stat != FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
@ -490,46 +490,46 @@ SerializeStatus PolyType::serializeTo(SerializeBufferBase& buffer) const {
|
||||
// switch on type
|
||||
switch (this->m_dataType) {
|
||||
case TYPE_U8:
|
||||
stat = buffer.serialize(this->m_val.u8Val);
|
||||
stat = buffer.serializeFrom(this->m_val.u8Val);
|
||||
break;
|
||||
case TYPE_I8:
|
||||
stat = buffer.serialize(this->m_val.i8Val);
|
||||
stat = buffer.serializeFrom(this->m_val.i8Val);
|
||||
break;
|
||||
#if FW_HAS_16_BIT
|
||||
case TYPE_U16:
|
||||
stat = buffer.serialize(this->m_val.u16Val);
|
||||
stat = buffer.serializeFrom(this->m_val.u16Val);
|
||||
break;
|
||||
case TYPE_I16:
|
||||
stat = buffer.serialize(this->m_val.i16Val);
|
||||
stat = buffer.serializeFrom(this->m_val.i16Val);
|
||||
break;
|
||||
#endif
|
||||
#if FW_HAS_32_BIT
|
||||
case TYPE_U32:
|
||||
stat = buffer.serialize(this->m_val.u32Val);
|
||||
stat = buffer.serializeFrom(this->m_val.u32Val);
|
||||
break;
|
||||
case TYPE_I32:
|
||||
stat = buffer.serialize(this->m_val.i32Val);
|
||||
stat = buffer.serializeFrom(this->m_val.i32Val);
|
||||
break;
|
||||
#endif
|
||||
#if FW_HAS_64_BIT
|
||||
case TYPE_U64:
|
||||
stat = buffer.serialize(this->m_val.u64Val);
|
||||
stat = buffer.serializeFrom(this->m_val.u64Val);
|
||||
break;
|
||||
case TYPE_I64:
|
||||
stat = buffer.serialize(this->m_val.i64Val);
|
||||
stat = buffer.serializeFrom(this->m_val.i64Val);
|
||||
break;
|
||||
#endif
|
||||
case TYPE_F64:
|
||||
stat = buffer.serialize(this->m_val.f64Val);
|
||||
stat = buffer.serializeFrom(this->m_val.f64Val);
|
||||
break;
|
||||
case TYPE_F32:
|
||||
stat = buffer.serialize(this->m_val.f32Val);
|
||||
stat = buffer.serializeFrom(this->m_val.f32Val);
|
||||
break;
|
||||
case TYPE_BOOL:
|
||||
stat = buffer.serialize(this->m_val.boolVal);
|
||||
stat = buffer.serializeFrom(this->m_val.boolVal);
|
||||
break;
|
||||
case TYPE_PTR:
|
||||
stat = buffer.serialize(this->m_val.ptrVal);
|
||||
stat = buffer.serializeFrom(this->m_val.ptrVal);
|
||||
break;
|
||||
default:
|
||||
stat = FW_SERIALIZE_FORMAT_ERROR;
|
||||
@ -539,15 +539,10 @@ SerializeStatus PolyType::serializeTo(SerializeBufferBase& buffer) const {
|
||||
return stat;
|
||||
}
|
||||
|
||||
SerializeStatus PolyType::serialize(SerializeBufferBase& buffer) const {
|
||||
// Deprecated method - calls new interface for backward compatibility
|
||||
return this->serializeTo(buffer);
|
||||
}
|
||||
|
||||
SerializeStatus PolyType::deserializeFrom(SerializeBufferBase& buffer) {
|
||||
// get type
|
||||
FwEnumStoreType des;
|
||||
SerializeStatus stat = buffer.deserialize(des);
|
||||
SerializeStatus stat = buffer.deserializeTo(des);
|
||||
|
||||
if (stat != FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
@ -556,46 +551,41 @@ SerializeStatus PolyType::deserializeFrom(SerializeBufferBase& buffer) {
|
||||
// switch on type
|
||||
switch (this->m_dataType) {
|
||||
case TYPE_U8:
|
||||
return buffer.deserialize(this->m_val.u8Val);
|
||||
return buffer.deserializeTo(this->m_val.u8Val);
|
||||
case TYPE_I8:
|
||||
return buffer.deserialize(this->m_val.i8Val);
|
||||
return buffer.deserializeTo(this->m_val.i8Val);
|
||||
#if FW_HAS_16_BIT
|
||||
case TYPE_U16:
|
||||
return buffer.deserialize(this->m_val.u16Val);
|
||||
return buffer.deserializeTo(this->m_val.u16Val);
|
||||
case TYPE_I16:
|
||||
return buffer.deserialize(this->m_val.i16Val);
|
||||
return buffer.deserializeTo(this->m_val.i16Val);
|
||||
#endif
|
||||
#if FW_HAS_32_BIT
|
||||
case TYPE_U32:
|
||||
return buffer.deserialize(this->m_val.u32Val);
|
||||
return buffer.deserializeTo(this->m_val.u32Val);
|
||||
case TYPE_I32:
|
||||
return buffer.deserialize(this->m_val.i32Val);
|
||||
return buffer.deserializeTo(this->m_val.i32Val);
|
||||
#endif
|
||||
#if FW_HAS_64_BIT
|
||||
case TYPE_U64:
|
||||
return buffer.deserialize(this->m_val.u64Val);
|
||||
return buffer.deserializeTo(this->m_val.u64Val);
|
||||
case TYPE_I64:
|
||||
return buffer.deserialize(this->m_val.i64Val);
|
||||
return buffer.deserializeTo(this->m_val.i64Val);
|
||||
#endif
|
||||
case TYPE_F64:
|
||||
return buffer.deserialize(this->m_val.f64Val);
|
||||
return buffer.deserializeTo(this->m_val.f64Val);
|
||||
case TYPE_F32:
|
||||
return buffer.deserialize(this->m_val.f32Val);
|
||||
return buffer.deserializeTo(this->m_val.f32Val);
|
||||
case TYPE_BOOL:
|
||||
return buffer.deserialize(this->m_val.boolVal);
|
||||
return buffer.deserializeTo(this->m_val.boolVal);
|
||||
case TYPE_PTR:
|
||||
return buffer.deserialize(this->m_val.ptrVal);
|
||||
return buffer.deserializeTo(this->m_val.ptrVal);
|
||||
default:
|
||||
return FW_DESERIALIZE_FORMAT_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SerializeStatus PolyType::deserialize(SerializeBufferBase& buffer) {
|
||||
// Deprecated method - calls new interface for backward compatibility
|
||||
return this->deserializeFrom(buffer);
|
||||
}
|
||||
|
||||
#if FW_SERIALIZABLE_TO_STRING || BUILD_UT
|
||||
|
||||
void PolyType::toString(StringBase& dest) const {
|
||||
|
||||
@ -103,14 +103,9 @@ class PolyType : public Serializable {
|
||||
bool operator==(const PolyType& other) const; //!< PolyType operator==
|
||||
bool operator!=(const PolyType& other) const; //!< PolyType operator!=
|
||||
|
||||
// New serialization interface
|
||||
SerializeStatus serializeTo(SerializeBufferBase& buffer) const override; //!< Serialize function
|
||||
SerializeStatus deserializeFrom(SerializeBufferBase& buffer) override; //!< Deserialize function
|
||||
|
||||
// Deprecated methods for backward compatibility - these call the new interface
|
||||
SerializeStatus serialize(SerializeBufferBase& buffer) const override; //!< Serialize function (deprecated)
|
||||
SerializeStatus deserialize(SerializeBufferBase& buffer) override; //!< Deserialize function (deprecated)
|
||||
|
||||
private:
|
||||
typedef enum {
|
||||
TYPE_NOTYPE, // !< No type stored yet
|
||||
|
||||
@ -17,23 +17,6 @@ Serializable::Serializable() {}
|
||||
|
||||
Serializable::~Serializable() {}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Default implementations for new serialization methods
|
||||
//
|
||||
// These are provided for backward compatibility specifically for autocoding that
|
||||
// does not yet support the new serialization methods.
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
SerializeStatus Serializable::serializeTo(SerializeBufferBase& buffer) const {
|
||||
// Default implementation for base class - derived classes should override this method
|
||||
return FW_SERIALIZE_UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
SerializeStatus Serializable::deserializeFrom(SerializeBufferBase& buffer) {
|
||||
// Default implementation for base class - derived classes should override this method
|
||||
return FW_DESERIALIZE_UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
#if FW_SERIALIZABLE_TO_STRING || FW_ENABLE_TEXT_LOGGING || BUILD_UT
|
||||
|
||||
@ -267,16 +250,7 @@ SerializeStatus SerializeBufferBase::serializeFrom(const U8* buff, FwSizeType le
|
||||
}
|
||||
|
||||
SerializeStatus SerializeBufferBase::serializeFrom(const Serializable& val) {
|
||||
// Smart fallback approach for backward compatibility:
|
||||
// Try new interface first, but if it returns UNIMPLEMENTED (indicating default implementation),
|
||||
// fall back to old interface. This bridges auto-generated enums (old interface only)
|
||||
// with new serialization infrastructure.
|
||||
SerializeStatus status = val.serializeTo(*this);
|
||||
if (status == FW_SERIALIZE_UNIMPLEMENTED) {
|
||||
// Fallback to old interface for backward compatibility
|
||||
status = val.serialize(*this);
|
||||
}
|
||||
return status;
|
||||
return val.serializeTo(*this);
|
||||
}
|
||||
|
||||
SerializeStatus SerializeBufferBase::serializeFrom(const SerializeBufferBase& val) {
|
||||
@ -560,15 +534,7 @@ SerializeStatus SerializeBufferBase::deserializeTo(U8* buff, Serializable::SizeT
|
||||
}
|
||||
|
||||
SerializeStatus SerializeBufferBase::deserializeTo(Serializable& val) {
|
||||
// Try new interface first, but if it returns UNIMPLEMENTED (indicating default implementation),
|
||||
// fall back to old interface. This bridges auto-generated enums (old interface only)
|
||||
// with new serialization infrastructure.
|
||||
SerializeStatus status = val.deserializeFrom(*this);
|
||||
if (status == FW_DESERIALIZE_UNIMPLEMENTED) {
|
||||
// Fallback to old interface for backward compatibility
|
||||
status = val.deserialize(*this);
|
||||
}
|
||||
return status;
|
||||
return val.deserializeFrom(*this);
|
||||
}
|
||||
|
||||
SerializeStatus SerializeBufferBase::deserializeTo(SerializeBufferBase& val) {
|
||||
@ -717,7 +683,8 @@ SerializeStatus SerializeBufferBase::copyRawOffset(SerializeBufferBase& dest, Se
|
||||
}
|
||||
|
||||
// otherwise, serialize bytes to destination without writing length
|
||||
SerializeStatus stat = dest.serialize(&this->getBuffAddr()[this->m_deserLoc], size, Fw::Serialization::OMIT_LENGTH);
|
||||
SerializeStatus stat =
|
||||
dest.serializeFrom(&this->getBuffAddr()[this->m_deserLoc], size, Fw::Serialization::OMIT_LENGTH);
|
||||
if (stat == FW_SERIALIZE_OK) {
|
||||
this->m_deserLoc += size;
|
||||
}
|
||||
@ -807,14 +774,6 @@ const U8* ExternalSerializeBuffer::getBuffAddr() const {
|
||||
// Deprecated method implementations for backward compatibility
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
SerializeStatus Serializable::serialize(SerializeBufferBase& buffer) const {
|
||||
return this->serializeTo(buffer);
|
||||
}
|
||||
|
||||
SerializeStatus Serializable::deserialize(SerializeBufferBase& buffer) {
|
||||
return this->deserializeFrom(buffer);
|
||||
}
|
||||
|
||||
SerializeStatus SerializeBufferBase::serialize(U8 val) {
|
||||
return this->serializeFrom(val);
|
||||
}
|
||||
|
||||
@ -18,9 +18,7 @@ typedef enum {
|
||||
FW_DESERIALIZE_BUFFER_EMPTY, //!< Deserialization buffer was empty when trying to read more data
|
||||
FW_DESERIALIZE_FORMAT_ERROR, //!< Deserialization data had incorrect values (unexpected data types)
|
||||
FW_DESERIALIZE_SIZE_MISMATCH, //!< Data was left in the buffer, but not enough to deserialize
|
||||
FW_DESERIALIZE_TYPE_MISMATCH, //!< Deserialized type ID didn't match
|
||||
FW_SERIALIZE_UNIMPLEMENTED, //!< Serialization function called is not implemented
|
||||
FW_DESERIALIZE_UNIMPLEMENTED, //!< Deserialization function called is not implemented
|
||||
FW_DESERIALIZE_TYPE_MISMATCH //!< Deserialized type ID didn't match
|
||||
} SerializeStatus;
|
||||
class SerializeBufferBase; //!< forward declaration
|
||||
|
||||
@ -30,17 +28,18 @@ class Serializable {
|
||||
using SizeType = FwSizeType;
|
||||
|
||||
public:
|
||||
virtual SerializeStatus serializeTo(SerializeBufferBase& buffer) const; //!< serialize contents to buffer
|
||||
virtual SerializeStatus serializeTo(SerializeBufferBase& buffer) const = 0; //!< serialize contents to buffer
|
||||
|
||||
virtual SerializeStatus deserializeFrom(SerializeBufferBase& buffer); //!< deserialize contents from buffer
|
||||
virtual SerializeStatus deserializeFrom(SerializeBufferBase& buffer) = 0; //!< deserialize contents from buffer
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Methods
|
||||
// Legacy methods for backward compatibility
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
virtual SerializeStatus serialize(SerializeBufferBase& buffer) const;
|
||||
SerializeStatus serialize(SerializeBufferBase& buffer) const { return this->serializeTo(buffer); }
|
||||
|
||||
SerializeStatus deserialize(SerializeBufferBase& buffer) { return this->deserializeFrom(buffer); }
|
||||
|
||||
virtual SerializeStatus deserialize(SerializeBufferBase& buffer);
|
||||
#if FW_SERIALIZABLE_TO_STRING || FW_ENABLE_TEXT_LOGGING || BUILD_UT
|
||||
virtual void toString(StringBase& text) const; //!< generate text from serializable
|
||||
#endif
|
||||
|
||||
@ -139,10 +139,6 @@ StringBase::SizeType StringBase::serializedTruncatedSize(FwSizeType maxLength) c
|
||||
return static_cast<SizeType>(sizeof(FwSizeStoreType)) + static_cast<SizeType>(FW_MIN(this->length(), maxLength));
|
||||
}
|
||||
|
||||
SerializeStatus StringBase::serialize(SerializeBufferBase& buffer) const {
|
||||
return buffer.serializeFrom(reinterpret_cast<const U8*>(this->toChar()), this->length());
|
||||
}
|
||||
|
||||
SerializeStatus StringBase::serializeTo(SerializeBufferBase& buffer) const {
|
||||
return buffer.serializeFrom(reinterpret_cast<const U8*>(this->toChar()), this->length());
|
||||
}
|
||||
@ -153,12 +149,14 @@ SerializeStatus StringBase::serializeTo(SerializeBufferBase& buffer, SizeType ma
|
||||
return buffer.serializeFrom(reinterpret_cast<const U8*>(this->toChar()), len, Serialization::INCLUDE_LENGTH);
|
||||
}
|
||||
|
||||
SerializeStatus StringBase::serialize(SerializeBufferBase& buffer, SizeType maxLength) const {
|
||||
return this->serializeTo(buffer, maxLength);
|
||||
// Deprecated method for backward compatibility
|
||||
SerializeStatus StringBase::serialize(SerializeBufferBase& buffer) const {
|
||||
return this->serializeTo(buffer);
|
||||
}
|
||||
|
||||
SerializeStatus StringBase::deserialize(SerializeBufferBase& buffer) {
|
||||
return this->deserializeFrom(buffer);
|
||||
// Deprecated method for backward compatibility
|
||||
SerializeStatus StringBase::serialize(SerializeBufferBase& buffer, SizeType maxLength) const {
|
||||
return this->serializeTo(buffer, maxLength);
|
||||
}
|
||||
|
||||
SerializeStatus StringBase::deserializeFrom(SerializeBufferBase& buffer) {
|
||||
|
||||
@ -67,12 +67,11 @@ class StringBase : public Serializable {
|
||||
FormatStatus vformat(const CHAR* formatString, va_list args); //!< write formatted string to buffer using va_list
|
||||
|
||||
SerializeStatus serializeTo(SerializeBufferBase& buffer) const override;
|
||||
SerializeStatus serializeTo(SerializeBufferBase& buffer, SizeType maxLen) const;
|
||||
virtual SerializeStatus serializeTo(SerializeBufferBase& buffer, SizeType maxLen) const;
|
||||
SerializeStatus deserializeFrom(SerializeBufferBase& buffer) override;
|
||||
|
||||
SerializeStatus serialize(SerializeBufferBase& buffer) const override;
|
||||
SerializeStatus serialize(SerializeBufferBase& buffer, SizeType maxLen) const;
|
||||
SerializeStatus deserialize(SerializeBufferBase& buffer) override;
|
||||
SerializeStatus serialize(SerializeBufferBase& buffer) const;
|
||||
virtual SerializeStatus serialize(SerializeBufferBase& buffer, SizeType maxLen) const;
|
||||
|
||||
#ifdef BUILD_UT
|
||||
// to support GoogleTest framework in unit tests
|
||||
|
||||
@ -625,7 +625,7 @@ struct TestStruct {
|
||||
|
||||
class MySerializable : public Fw::Serializable {
|
||||
public:
|
||||
Fw::SerializeStatus serialize(Fw::SerializeBufferBase& buffer) const {
|
||||
Fw::SerializeStatus serializeTo(Fw::SerializeBufferBase& buffer) const override {
|
||||
buffer.serialize(m_testStruct.m_u32);
|
||||
buffer.serialize(m_testStruct.m_u16);
|
||||
buffer.serialize(m_testStruct.m_u8);
|
||||
@ -634,7 +634,7 @@ class MySerializable : public Fw::Serializable {
|
||||
return Fw::FW_SERIALIZE_OK;
|
||||
}
|
||||
|
||||
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase& buffer) {
|
||||
Fw::SerializeStatus deserializeFrom(Fw::SerializeBufferBase& buffer) override {
|
||||
buffer.serialize(m_testStruct.m_buff, sizeof(m_testStruct.m_buff));
|
||||
buffer.serialize(m_testStruct.m_f32);
|
||||
buffer.serialize(m_testStruct.m_u8);
|
||||
@ -658,8 +658,8 @@ TEST(PerformanceTest, SerPerfTest) {
|
||||
|
||||
I32 iterations = 1000000;
|
||||
for (I32 iter = 0; iter < iterations; iter++) {
|
||||
in.serialize(buff);
|
||||
out.deserialize(buff);
|
||||
in.serializeTo(buff);
|
||||
out.deserializeFrom(buff);
|
||||
}
|
||||
|
||||
timer.stop();
|
||||
|
||||
@ -75,14 +75,6 @@ RawTimeHandle* PosixRawTime::getHandle() {
|
||||
return &this->m_handle;
|
||||
}
|
||||
|
||||
Fw::SerializeStatus PosixRawTime::serialize(Fw::SerializeBufferBase& buffer) const {
|
||||
return this->serializeTo(buffer);
|
||||
}
|
||||
|
||||
Fw::SerializeStatus PosixRawTime::deserialize(Fw::SerializeBufferBase& buffer) {
|
||||
return this->deserializeFrom(buffer);
|
||||
}
|
||||
|
||||
} // namespace RawTime
|
||||
} // namespace Posix
|
||||
} // namespace Os
|
||||
|
||||
@ -81,14 +81,6 @@ class PosixRawTime : public RawTimeInterface {
|
||||
//! \return Fw::SerializeStatus indicating the result of the deserialization.
|
||||
Fw::SerializeStatus deserializeFrom(Fw::SerializeBufferBase& buffer) override;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Methods
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Fw::SerializeStatus serialize(Fw::SerializeBufferBase& buffer) const override;
|
||||
|
||||
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase& buffer) override;
|
||||
|
||||
private:
|
||||
//! Handle for PosixRawTime
|
||||
PosixRawTimeHandle m_handle;
|
||||
|
||||
@ -77,14 +77,6 @@ RawTime::Status RawTime::getDiffUsec(const RawTime& other, U32& result) const {
|
||||
return status;
|
||||
}
|
||||
|
||||
Fw::SerializeStatus RawTime::serialize(Fw::SerializeBufferBase& buffer) const {
|
||||
return this->serializeTo(buffer);
|
||||
}
|
||||
|
||||
Fw::SerializeStatus RawTime::deserialize(Fw::SerializeBufferBase& buffer) {
|
||||
return this->deserializeFrom(buffer);
|
||||
}
|
||||
|
||||
bool RawTime::operator==(const RawTime& other) const {
|
||||
Fw::TimeInterval interval;
|
||||
Status status = this->getTimeInterval(other, interval);
|
||||
|
||||
@ -77,7 +77,7 @@ class RawTimeInterface : public Fw::Serializable {
|
||||
//!
|
||||
//! \param buffer The buffer to serialize the contents into.
|
||||
//! \return Fw::SerializeStatus indicating the result of the serialization.
|
||||
virtual Fw::SerializeStatus serializeTo(Fw::SerializeBufferBase& buffer) const { return this->serialize(buffer); }
|
||||
virtual Fw::SerializeStatus serializeTo(Fw::SerializeBufferBase& buffer) const = 0;
|
||||
|
||||
//! \brief Deserialize the contents of the RawTimeInterface object from a buffer.
|
||||
//!
|
||||
@ -91,7 +91,7 @@ class RawTimeInterface : public Fw::Serializable {
|
||||
//!
|
||||
//! \param buffer The buffer to deserialize the contents from.
|
||||
//! \return Fw::SerializeStatus indicating the result of the deserialization.
|
||||
virtual Fw::SerializeStatus deserializeFrom(Fw::SerializeBufferBase& buffer) { return this->deserialize(buffer); }
|
||||
virtual Fw::SerializeStatus deserializeFrom(Fw::SerializeBufferBase& buffer) = 0;
|
||||
};
|
||||
|
||||
class RawTime final : public RawTimeInterface {
|
||||
@ -159,14 +159,6 @@ class RawTime final : public RawTimeInterface {
|
||||
//! \return Fw::SerializeStatus indicating the result of the deserialization.
|
||||
Fw::SerializeStatus deserializeFrom(Fw::SerializeBufferBase& buffer) override;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Methods
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Fw::SerializeStatus serialize(Fw::SerializeBufferBase& buffer) const override;
|
||||
|
||||
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase& buffer) override;
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// Common functions built on top of OS-specific functions
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@ -29,14 +29,6 @@ Fw::SerializeStatus StubRawTime::deserializeFrom(Fw::SerializeBufferBase& buffer
|
||||
return Fw::FW_SERIALIZE_OK;
|
||||
}
|
||||
|
||||
Fw::SerializeStatus StubRawTime::serialize(Fw::SerializeBufferBase& buffer) const {
|
||||
return this->serializeTo(buffer);
|
||||
}
|
||||
|
||||
Fw::SerializeStatus StubRawTime::deserialize(Fw::SerializeBufferBase& buffer) {
|
||||
return this->deserializeFrom(buffer);
|
||||
}
|
||||
|
||||
} // namespace RawTime
|
||||
} // namespace Stub
|
||||
} // namespace Os
|
||||
|
||||
@ -80,14 +80,6 @@ class StubRawTime : public RawTimeInterface {
|
||||
//! \return Fw::SerializeStatus indicating the result of the deserialization.
|
||||
Fw::SerializeStatus deserializeFrom(Fw::SerializeBufferBase& buffer) override;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Methods
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Fw::SerializeStatus serialize(Fw::SerializeBufferBase& buffer) const override;
|
||||
|
||||
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase& buffer) override;
|
||||
|
||||
private:
|
||||
//! Handle for StubRawTime
|
||||
StubRawTimeHandle m_handle;
|
||||
|
||||
@ -70,10 +70,6 @@ class TestRawTime : public RawTimeInterface {
|
||||
Fw::SerializeStatus serializeTo(Fw::SerializeBufferBase& buffer) const override;
|
||||
Fw::SerializeStatus deserializeFrom(Fw::SerializeBufferBase& buffer) override;
|
||||
|
||||
// Backward-compatibility wrappers
|
||||
Fw::SerializeStatus serialize(Fw::SerializeBufferBase& buffer) const override { return this->serializeTo(buffer); }
|
||||
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase& buffer) override { return this->deserializeFrom(buffer); }
|
||||
|
||||
private:
|
||||
//! Handle for TestRawTime
|
||||
TestRawTimeHandle m_handle;
|
||||
|
||||
@ -57,7 +57,7 @@ TEST_F(Interface, GetTimeInterval) {
|
||||
}
|
||||
|
||||
// Ensure that Os::RawTime properly calls the following delegate function
|
||||
TEST_F(Interface, SerializeTo) {
|
||||
TEST_F(Interface, Serialize) {
|
||||
Os::RawTime rawtime;
|
||||
Fw::Buffer buffer;
|
||||
auto esb = buffer.getSerializer();
|
||||
@ -66,7 +66,7 @@ TEST_F(Interface, SerializeTo) {
|
||||
}
|
||||
|
||||
// Ensure that Os::RawTime properly calls the following delegate function
|
||||
TEST_F(Interface, DeserializeFrom) {
|
||||
TEST_F(Interface, Deserialize) {
|
||||
Os::RawTime rawtime;
|
||||
Fw::Buffer buffer;
|
||||
auto esb = buffer.getDeserializer();
|
||||
|
||||
@ -56,10 +56,6 @@ class RawTimeTester : public Os::RawTimeInterface {
|
||||
return buffer.deserializeTo(m_handle.t);
|
||||
}
|
||||
|
||||
Fw::SerializeStatus serialize(Fw::SerializeBufferBase& buffer) const override { return this->serializeTo(buffer); }
|
||||
|
||||
Fw::SerializeStatus deserialize(Fw::SerializeBufferBase& buffer) override { return this->deserializeFrom(buffer); }
|
||||
|
||||
static void setNowTime(const Fw::Time&& t) { s_now_time = t; }
|
||||
|
||||
private:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user