mirror of
https://github.com/nasa/fprime.git
synced 2025-12-11 04:35:25 -06:00
* NATIVE_INT_TYPE use in toString * NATIVE_INT_TYPE use in SimpleObjRegistry * NATIVE_INT_TYPE use in Asserts * NATIVE_INT_TYPE use in Fw/Comp * NATIVE_INT_TYPE use in getCapacity * NATIVE_INT_TYPE use in getEntries * NATIVE_INT_TYPE use in size/length * NATIVE_INT_TYPE use in FILE_NAME_ARG * NATIVE_INT_TYPE use in Fw (misc) * NATIVE_INT_TYPE use in identifier * NATIVE_INT_TYPE use in Fw (misc II) * POINTER_CAST in Buffer * POINTER_CAST in Serializable * sp * Removing no longer used DefaultTypes.hpp * Fixes to accomidate Fw refactor * Unit-test and CI fixes * Fixing review comments - pt 1
48 lines
1.3 KiB
C++
48 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/Assert.hpp"
|
|
#include "Fw/Types/SerialBuffer.hpp"
|
|
|
|
namespace Fw {
|
|
|
|
SerialBuffer ::SerialBuffer(U8* const data, const FwSizeType capacity) : m_data(data), m_capacity(capacity) {}
|
|
|
|
FwSizeType SerialBuffer ::getBuffCapacity() const {
|
|
return m_capacity;
|
|
}
|
|
|
|
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) {
|
|
// "true" means "just push the bytes"
|
|
return this->serialize(const_cast<U8*>(addr), n, true);
|
|
}
|
|
|
|
SerializeStatus SerialBuffer ::popBytes(U8* const addr, FwSizeType n) {
|
|
// "true" means "just pop the bytes"
|
|
return this->deserialize(addr, n, true);
|
|
}
|
|
|
|
} // namespace Fw
|