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>
50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
// ======================================================================
|
|
// \title SerialBuffer.cpp
|
|
// \author bocchino
|
|
// \brief cpp file for SerialBuffer type
|
|
//
|
|
// \copyright
|
|
// Copyright (C) 2016 California Institute of Technology.
|
|
// ALL RIGHTS RESERVED. United States Government Sponsorship
|
|
// acknowledged.
|
|
//
|
|
// ======================================================================
|
|
|
|
#include "Fw/Types/SerialBuffer.hpp"
|
|
#include "Fw/Types/Assert.hpp"
|
|
|
|
namespace Fw {
|
|
|
|
SerialBuffer ::SerialBuffer(U8* const data, const FwSizeType capacity) : m_data(data), m_capacity(capacity) {}
|
|
|
|
FwSizeType SerialBuffer ::getCapacity() const {
|
|
return m_capacity;
|
|
}
|
|
|
|
FwSizeType SerialBuffer ::getBuffCapacity() const {
|
|
return this->getCapacity();
|
|
}
|
|
|
|
U8* SerialBuffer ::getBuffAddr() {
|
|
return m_data;
|
|
}
|
|
|
|
const U8* SerialBuffer ::getBuffAddr() const {
|
|
return m_data;
|
|
}
|
|
|
|
void SerialBuffer ::fill() {
|
|
const SerializeStatus status = this->setBuffLen(this->m_capacity);
|
|
FW_ASSERT(status == FW_SERIALIZE_OK);
|
|
}
|
|
|
|
SerializeStatus SerialBuffer ::pushBytes(const U8* const addr, const FwSizeType n) {
|
|
return this->serializeFrom(const_cast<U8*>(addr), n, Fw::Serialization::OMIT_LENGTH);
|
|
}
|
|
|
|
SerializeStatus SerialBuffer ::popBytes(U8* const addr, FwSizeType n) {
|
|
return this->deserializeTo(addr, n, Fw::Serialization::OMIT_LENGTH);
|
|
}
|
|
|
|
} // namespace Fw
|