Interface for serializable objects.
More...
#include <serializable.h>
|
struct | Data |
| Pointer + size wrapper for binary serialization. More...
|
|
Interface for serializable objects.
Definition at line 38 of file serializable.h.
Callbacks for change notifications.
Definition at line 98 of file serializable.h.
bool servus::Serializable::fromBinary |
( |
const Data & |
data | ) |
|
Update this serializable from its binary representation.
- Returns
- true on success, false on error.
bool servus::Serializable::fromJSON |
( |
const std::string & |
json | ) |
|
Update this serializable from its JSON representation.
- Returns
- true on success, false on error.
virtual uint128_t servus::Serializable::getTypeIdentifier |
( |
| ) |
const |
|
virtual |
- Returns
- the universally unique identifier of this serializable.
virtual std::string servus::Serializable::getTypeName |
( |
| ) |
const |
|
pure virtual |
- Returns
- the fully qualified, demangled class name.
Register a function called after the object has been updated remotely (via a subscriber, a http server, loading from file...).
Only one callback is supported at the moment, to deregister the callback, call this function with a 'nullptr' (or 0) parameter.
- Exceptions
-
if | a DeserializedCallback is already registered and the specified callback is not 'nullptr' (or 0) |
void servus::Serializable::registerSerializeCallback |
( |
const SerializeCallback & |
callback | ) |
|
Register a function to be called when the serializable object is about to be serialized.
Only one callback is supported at the moment, to deregister the callback, call this function with a 'nullptr' (or 0) parameter.
- Exceptions
-
if | a SerializedCallback is already registered and the specified callback is not 'nullptr' (or 0) |
Data servus::Serializable::toBinary |
( |
| ) |
const |
Get a binary representation of this object.
The returned data is not thread safe, that is, it should not be modified until the caller of this method has completed its execution.
- Returns
- the binary representation of this object.
std::string servus::Serializable::toJSON |
( |
| ) |
const |
- Returns
- the JSON representation of this serializable.
The documentation for this class was generated from the following file: