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) {
25 FW_ASSERT(maxSerializedSize == m_actualSize, static_cast<FwAssertArgType>(maxSerializedSize),
26 static_cast<FwAssertArgType>(m_actualSize));
43 status = file.
read(this->m_buffer.
getBuffAddr(), length, Os::File::WaitType::NO_WAIT);
86 void SerializableFile::reset() {
Serialization/Deserialization operation was successful.
Status load(const char *fileName, Serializable &serializable)
PlatformSizeType FwSizeType
virtual SerializeStatus serializeTo(SerialBufferBase &buffer, Endianness mode=Endianness::BIG) const =0
Serialize the contents of this object to a buffer.
Serializable::SizeType getSize() const override
Get current buffer size.
virtual SerializeStatus deserializeFrom(SerialBufferBase &buffer, Endianness mode=Endianness::BIG)=0
Deserialize the contents of this object from a buffer.
Serializable::SizeType getCapacity() const override
Get buffer capacity.
SerializeStatus
forward declaration for string
Os::FileInterface::Status open(const char *path, Mode mode)
open file with supplied path and mode
U8 * getBuffAddr()
Get buffer address for data filling (non-const version)
Status save(const char *fileName, Serializable &serializable)
void resetDeser() override
Reset deserialization pointer to beginning of buffer.
void resetSer() override
Reset serialization pointer to beginning of buffer.
void close() override
close the file, if not opened then do nothing
Status write(const U8 *buffer, FwSizeType &size)
write data to this file from the supplied buffer bounded by size
SerializableFile(MemAllocator *allocator, FwSizeType maxSerializedSize)
uint8_t U8
8-bit unsigned integer
SerializeStatus setBuffLen(Serializable::SizeType length) override
Set buffer length manually.
Status read(U8 *buffer, FwSizeType &size)
read data from this file into supplied buffer bounded by size
Memory Allocation base class.
Operation was successful.
virtual void deallocate(const FwEnumStoreType identifier, void *ptr)=0
Implementation of malloc based allocator.