mirror of
https://github.com/nasa/fprime.git
synced 2025-12-10 16:29:04 -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>
81 lines
2.4 KiB
C++
81 lines
2.4 KiB
C++
// ======================================================================
|
|
// \title SerialBuffer.hpp
|
|
// \author bocchino
|
|
// \brief hpp file for SerialBuffer type
|
|
//
|
|
// \copyright
|
|
// Copyright (C) 2016 California Institute of Technology.
|
|
// ALL RIGHTS RESERVED. United States Government Sponsorship
|
|
// acknowledged.
|
|
//
|
|
// ======================================================================
|
|
|
|
#ifndef Fw_SerialBuffer_HPP
|
|
#define Fw_SerialBuffer_HPP
|
|
|
|
#include <Fw/FPrimeBasicTypes.hpp>
|
|
#include "Fw/Types/Serializable.hpp"
|
|
|
|
namespace Fw {
|
|
|
|
//! \class SerialBuffer
|
|
//! \brief A variable-length serializable buffer
|
|
//!
|
|
class SerialBuffer final : public SerializeBufferBase {
|
|
public:
|
|
// ----------------------------------------------------------------------
|
|
// Construction
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Construct a SerialBuffer
|
|
//!
|
|
SerialBuffer(U8* const data, //!< Pointer to the data
|
|
const FwSizeType capacity //!< The buffer capacity
|
|
);
|
|
|
|
public:
|
|
// ----------------------------------------------------------------------
|
|
// Pure virtual methods from SerializeBufferBase
|
|
// ----------------------------------------------------------------------
|
|
|
|
DEPRECATED(FwSizeType getBuffCapacity() const, "Use getCapacity() instead");
|
|
FwSizeType getCapacity() const;
|
|
|
|
U8* getBuffAddr();
|
|
|
|
const U8* getBuffAddr() const;
|
|
|
|
public:
|
|
// ----------------------------------------------------------------------
|
|
// Public instance methods
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Fill the buffer to capacity with preexisting data
|
|
void fill();
|
|
|
|
//! Push n bytes onto the buffer
|
|
SerializeStatus pushBytes(const U8* const addr, //!< Address of bytes to push
|
|
const FwSizeType n //!< Number of bytes
|
|
);
|
|
|
|
//! Pop n bytes off the buffer
|
|
SerializeStatus popBytes(U8* const addr, //!< Address of bytes to pop
|
|
FwSizeType n //!< Number of bytes to pop
|
|
);
|
|
|
|
private:
|
|
// ----------------------------------------------------------------------
|
|
// Data
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! The data
|
|
U8* const m_data;
|
|
|
|
//! The capacity
|
|
const FwSizeType m_capacity;
|
|
};
|
|
|
|
} // namespace Fw
|
|
|
|
#endif
|