libuav original

Dependents:   UAVCAN UAVCAN_Subscriber

Embed: (wiki syntax)

« Back to documentation index

StorageMarshaller Class Reference

StorageMarshaller Class Reference

This class extends the storage backend interface with serialization/deserialization functionality. More...

#include <storage_marshaller.hpp>

Public Member Functions

int setAndGetBack (const IStorageBackend::String &key, uint32_t &inout_value)
 These methods set the value and then immediately read it back.
int get (const IStorageBackend::String &key, uint32_t &out_value) const
 Getters simply read and deserialize the value.

Static Public Member Functions

static IStorageBackend::String convertUniqueIDToHex (const UniqueID &key)
 Turns a unique ID into a hex string that can be used as a key or as a value.

Detailed Description

This class extends the storage backend interface with serialization/deserialization functionality.

Definition at line 25 of file storage_marshaller.hpp.


Member Function Documentation

static IStorageBackend::String convertUniqueIDToHex ( const UniqueID &  key ) [static]

Turns a unique ID into a hex string that can be used as a key or as a value.

Definition at line 44 of file storage_marshaller.hpp.

int get ( const IStorageBackend::String key,
uint32_t &  out_value 
) const

Getters simply read and deserialize the value.

1. Read the value back from the backend; return false if read fails. 2. Deserealize the newly read value; return false if deserialization fails. 3. Update the argument with deserialized value. 4. Return true.

Definition at line 90 of file storage_marshaller.hpp.

int setAndGetBack ( const IStorageBackend::String key,
uint32_t &  inout_value 
)

These methods set the value and then immediately read it back.

1. Serialize the value. 2. Update the value on the backend. 3. Call get() with the same value argument. The caller then is supposed to check whether the argument has the desired value.

Definition at line 62 of file storage_marshaller.hpp.