fprime/Fw/SerializableFile/SerializableFile.hpp
M Starch ec08d43dd3
Removes NATIVE_INT_TYPE, NATIVE_UINT_TYPE, and POINTER_CAST from Fw (#3286)
* 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
2025-03-04 14:42:48 -08:00

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