mirror of
https://github.com/nasa/fprime.git
synced 2025-12-11 23:38:06 -06:00
* Fixed shadow warnings from Fprime * Fix unit tests * Fix missing shadow warnings * Fix condition in cmake * Fix cmake * Fixes from review * Fixed mistake in PathName * Fixing comment --------- Co-authored-by: M Starch <LeStarch@googlemail.com>
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, NATIVE_UINT_TYPE 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
|
|
NATIVE_UINT_TYPE m_actualSize; // for checking
|
|
SerialBuffer m_buffer;
|
|
};
|
|
}
|
|
|
|
#endif
|