22 actualSize(maxSerializedSize),
23 buffer(static_cast<
U8*>(this->allocator->allocate(0, actualSize, recoverable)), actualSize)
26 FW_ASSERT(maxSerializedSize == actualSize,maxSerializedSize,actualSize);
90 void SerializableFile::reset() {
PlatformIntType NATIVE_INT_TYPE
uint8_t U8
8-bit unsigned integer
PlatformUIntType NATIVE_UINT_TYPE
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
void resetDeser()
reset deserialization to beginning
SerializeStatus setBuffLen(NATIVE_UINT_TYPE length)
sets buffer length manually after filling with data
void resetSer()
reset to beginning of buffer to reuse for serialization
NATIVE_UINT_TYPE getBuffLength() const
returns current buffer size
@ OP_OK
Operation was successful.
Status write(const void *buffer, NATIVE_INT_TYPE &size, bool waitForDone=true)
write size; will return amount written or errno
@ OPEN_WRITE
Open file for writing.
@ OPEN_READ
Open file for reading.
Status open(const char *fileName, Mode mode)
open file. Writing creates file if it doesn't exist
Status read(void *buffer, NATIVE_INT_TYPE &size, bool waitForFull=true)
waitForFull = true to wait for all bytes to be read
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.