20 m_allocator(allocator),
22 m_actualSize(maxSerializedSize),
23 m_buffer(static_cast<
U8*>(this->m_allocator->allocate(0, m_actualSize, m_recoverable)), m_actualSize)
44 status = file.
read(this->m_buffer.
getBuffAddr(), length, Os::File::WaitType::NO_WAIT);
55 serStatus = serializable.
deserialize(this->m_buffer);
88 void SerializableFile::reset() {
uint8_t U8
8-bit unsigned integer
PlatformUIntType NATIVE_UINT_TYPE
PlatformAssertArgType FwAssertArgType
PlatformSignedSizeType FwSignedSizeType
virtual void deallocate(const NATIVE_UINT_TYPE identifier, void *ptr)=0
Deallocate memory.
NATIVE_UINT_TYPE getBuffCapacity() const
returns capacity, not current size, of buffer
U8 * getBuffAddr()
gets buffer address for data filling
SerializableFile(MemAllocator *allocator, NATIVE_UINT_TYPE maxSerializedSize)
Status save(const char *fileName, Serializable &serializable)
Status load(const char *fileName, Serializable &serializable)
virtual SerializeStatus deserialize(SerializeBufferBase &buffer)=0
deserialize to contents
virtual SerializeStatus serialize(SerializeBufferBase &buffer) const =0
serialize contents
SerializeStatus setBuffLen(Serializable::SizeType length)
sets buffer length manually after filling with data
void resetDeser()
reset deserialization to beginning
void resetSer()
reset to beginning of buffer to reuse for serialization
Serializable::SizeType getBuffLength() const
returns current buffer size
Status read(U8 *buffer, FwSignedSizeType &size)
read data from this file into supplied buffer bounded by size
void close() override
close the file, if not opened then do nothing
Os::FileInterface::Status open(const char *path, Mode mode)
open file with supplied path and mode
Status write(const U8 *buffer, FwSignedSizeType &size)
write data to this file from the supplied buffer bounded by size
@ OP_OK
Operation was successful.
@ OPEN_WRITE
Open file for writing.
@ OPEN_READ
Open file for reading.
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.