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