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
51 lines
1.3 KiB
C++
51 lines
1.3 KiB
C++
// ======================================================================
|
|
// \title SerializableFile.hpp
|
|
// \author dinkel
|
|
// \brief hpp file for SerializableFile
|
|
//
|
|
// \copyright
|
|
// Copyright 2009-2016, by the California Institute of Technology.
|
|
// ALL RIGHTS RESERVED. United States Government Sponsorship
|
|
// acknowledged.
|
|
//
|
|
// ======================================================================
|
|
|
|
#ifndef Fw_SerializableFile_HPP
|
|
#define Fw_SerializableFile_HPP
|
|
|
|
#include <Fw/Types/Serializable.hpp>
|
|
#include <Fw/Types/MemAllocator.hpp>
|
|
#include <Fw/Types/SerialBuffer.hpp>
|
|
|
|
namespace Fw {
|
|
|
|
//! The type of a packet header
|
|
class SerializableFile {
|
|
|
|
public:
|
|
enum Status {
|
|
OP_OK,
|
|
FILE_OPEN_ERROR,
|
|
FILE_WRITE_ERROR,
|
|
FILE_READ_ERROR,
|
|
DESERIALIZATION_ERROR
|
|
};
|
|
|
|
// NOTE!: This should not be used with an allocator that can return a smaller buffer than requested
|
|
SerializableFile(MemAllocator* allocator, FwSizeType maxSerializedSize);
|
|
~SerializableFile();
|
|
|
|
Status load(const char* fileName, Serializable& serializable);
|
|
Status save(const char* fileName, Serializable& serializable);
|
|
|
|
PRIVATE:
|
|
void reset();
|
|
MemAllocator* m_allocator;
|
|
bool m_recoverable; // don't care; for allocator
|
|
FwSizeType m_actualSize; // for checking
|
|
SerialBuffer m_buffer;
|
|
};
|
|
}
|
|
|
|
#endif
|