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
void resetSer()
reset to beginning of buffer to reuse for serialization
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 deserializeFrom(SerializeBufferBase &buffer, Endianness mode=Endianness::BIG)=0
deserialize contents from buffer
Status save(const char *fileName, Serializable &serializable)
void resetDeser()
reset deserialization to beginning
virtual SerializeStatus serializeTo(SerializeBufferBase &buffer, Endianness mode=Endianness::BIG) const =0
serialize contents to 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
Status read(U8 *buffer, FwSizeType &size)
read data from this file into supplied buffer bounded by size
Operation was successful.
U8 * getBuffAddr()
gets buffer address for data filling
virtual void deallocate(const FwEnumStoreType identifier, void *ptr)=0
Deallocate memory.
SerializeStatus setBuffLen(Serializable::SizeType length)
sets buffer length manually after filling with data