Nebula
|
#include <componentserialization.h>
Component serialization functions.
Implements various serialization functions for different types of components
Classes | |
struct | Serializer |
Public Types | |
enum | OverridableType { ENTITY , RESOURCE , NUM_OVERRIDABLE_TYPES } |
using | DeserializeJsonFunc = std::function<void(Ptr<IO::JsonReader> const&, const char* name, void*)> |
using | SerializeJsonFunc = std::function<void(Ptr<IO::JsonWriter> const&, const char* name, void*)> |
Static Public Member Functions | |
static ComponentSerialization * | Instance () |
The registry's constructor is called by the Instance() method, and nobody else. | |
static void | Destroy () |
This static method is used to destroy the registry object and should be called right before the main function exits. | |
template<typename TYPE> | |
static void | Register (ComponentId component) |
static void | Deserialize (Ptr< IO::JsonReader > const &reader, ComponentId component, void *ptr) |
ptr points to the location where the value should be stored. Make sure you have room for it! | |
static void | Serialize (Ptr< IO::JsonWriter > const &writer, ComponentId component, void *ptr) |
ptr points to the value that should be stored | |
static void | Override (ComponentId component, DeserializeJsonFunc deserialize, SerializeJsonFunc serialize) |
override a specific components serialization and deserialization funcs | |
static void | OverrideType (OverridableType type, DeserializeJsonFunc deserialize, SerializeJsonFunc serialize) |
override a specific type serializer. This will be called instead of a standard variant. | |
static DeserializeJsonFunc & | GetTypeDeserializeFunc (OverridableType type) |
Get the deserialize override for a specific type. | |
static SerializeJsonFunc & | GetTypeSerializeFunc (OverridableType type) |
Get the serialize override for a specific type. | |
Private Member Functions | |
ComponentSerialization () | |
~ComponentSerialization () | |
bool | ValidateTypeSize (ComponentId component, uint32_t size) |
validate that the size of MemDb::AttributeRegistry's component named 'name' has typesize of 'size' | |
Private Attributes | |
Util::Array< Serializer > | serializers |
Serializer | typeOverrides [NUM_OVERRIDABLE_TYPES] |
Static Private Attributes | |
static ComponentSerialization * | Singleton = nullptr |
using Game::ComponentSerialization::DeserializeJsonFunc = std::function<void(Ptr<IO::JsonReader> const&, const char* name, void*)> |
using Game::ComponentSerialization::SerializeJsonFunc = std::function<void(Ptr<IO::JsonWriter> const&, const char* name, void*)> |
|
private |
|
private |
|
static |
ptr points to the location where the value should be stored. Make sure you have room for it!
|
static |
This static method is used to destroy the registry object and should be called right before the main function exits.
It will make sure that no accidential memory leaks are reported by the debug heap.
|
static |
Get the deserialize override for a specific type.
|
static |
Get the serialize override for a specific type.
|
static |
The registry's constructor is called by the Instance() method, and nobody else.
|
static |
override a specific components serialization and deserialization funcs
|
static |
override a specific type serializer. This will be called instead of a standard variant.
|
inlinestatic |
|
static |
ptr points to the value that should be stored
|
private |
validate that the size of MemDb::AttributeRegistry's component named 'name' has typesize of 'size'
|
private |
|
staticprivate |
|
private |