Nebula
Loading...
Searching...
No Matches
Game::ComponentSerialization Class Reference

#include <componentserialization.h>

Detailed Description

Component serialization functions.

Implements various serialization functions for different types of components

Classes

struct  Serializer
 

Public Types

using DeserializeJsonFunc = Util::Delegate<void(Ptr<IO::JsonReader> const&, const char* name, void*)>
 
using SerializeJsonFunc = Util::Delegate<void(Ptr<IO::JsonWriter> const&, const char* name, void*)>
 

Static Public Member Functions

static ComponentSerializationInstance ()
 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
 

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< Serializerserializers
 

Static Private Attributes

static ComponentSerializationSingleton = nullptr
 

Member Typedef Documentation

◆ DeserializeJsonFunc

◆ SerializeJsonFunc

using Game::ComponentSerialization::SerializeJsonFunc = Util::Delegate<void(Ptr<IO::JsonWriter> const&, const char* name, void*)>

Constructor & Destructor Documentation

◆ ComponentSerialization()

Game::ComponentSerialization::ComponentSerialization ( )
private

◆ ~ComponentSerialization()

Game::ComponentSerialization::~ComponentSerialization ( )
private

Member Function Documentation

◆ Deserialize()

void Game::ComponentSerialization::Deserialize ( Ptr< IO::JsonReader > const & reader,
ComponentId component,
void * ptr )
static

ptr points to the location where the value should be stored. Make sure you have room for it!

◆ Destroy()

void Game::ComponentSerialization::Destroy ( )
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.

◆ Instance()

ComponentSerialization * Game::ComponentSerialization::Instance ( )
static

The registry's constructor is called by the Instance() method, and nobody else.

◆ Register()

template<typename TYPE >
void Game::ComponentSerialization::Register ( ComponentId component)
inlinestatic

◆ Serialize()

void Game::ComponentSerialization::Serialize ( Ptr< IO::JsonWriter > const & writer,
ComponentId component,
void * ptr )
static

ptr points to the value that should be stored

◆ ValidateTypeSize()

bool Game::ComponentSerialization::ValidateTypeSize ( ComponentId component,
uint32_t size )
private

validate that the size of MemDb::AttributeRegistry's component named 'name' has typesize of 'size'

Member Data Documentation

◆ serializers

Util::Array<Serializer> Game::ComponentSerialization::serializers
private

◆ Singleton

ComponentSerialization * Game::ComponentSerialization::Singleton = nullptr
staticprivate

The documentation for this class was generated from the following files: