Nebula
Loading...
Searching...
No Matches
MemDb::AttributeRegistry Class Reference

#include <attributeregistry.h>

Static Public Member Functions

template<typename TYPE >
static AttributeId Register (Util::StringAtom name, TYPE defaultValue, uint32_t flags=0)
 register a type (templated)
 
template<typename TYPE >
static AttributeId Register (Attribute *attribute)
 
template<typename TYPE >
static bool IsRegistered ()
 Check if a type is registered.
 
static AttributeId Register (Util::StringAtom name, SizeT typeSize, void const *defaultValue, uint32_t flags=0)
 register a POD, mem-copyable type
 
static AttributeId GetAttributeId (Util::StringAtom name)
 get attribute id from name
 
static AttributeGetAttribute (AttributeId descriptor)
 get attribute description by id
 
static SizeT TypeSize (AttributeId descriptor)
 get type size by attribute id
 
static uint32_t Flags (AttributeId descriptor)
 get flags by attribute id
 
static void const *const DefaultValue (AttributeId descriptor)
 get attribute default value pointer
 
static Util::FixedArray< Attribute * > const & GetAllAttributes ()
 get an array of all attributes
 

Private Member Functions

 AttributeRegistry ()
 
 ~AttributeRegistry ()
 

Static Private Member Functions

static AttributeRegistryInstance ()
 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.
 

Private Attributes

Util::FixedArray< Attribute * > componentDescriptions
 
Util::Dictionary< Util::StringAtom, AttributeIdregistry
 

Static Private Attributes

static AttributeRegistrySingleton = 0
 

Constructor & Destructor Documentation

◆ AttributeRegistry()

MemDb::AttributeRegistry::AttributeRegistry ( )
private

◆ ~AttributeRegistry()

MemDb::AttributeRegistry::~AttributeRegistry ( )
private

Member Function Documentation

◆ DefaultValue()

void const *const MemDb::AttributeRegistry::DefaultValue ( AttributeId descriptor)
inlinestatic

get attribute default value pointer

◆ Destroy()

void MemDb::AttributeRegistry::Destroy ( )
staticprivate

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.

◆ Flags()

uint32_t MemDb::AttributeRegistry::Flags ( AttributeId descriptor)
inlinestatic

get flags by attribute id

◆ GetAllAttributes()

Util::FixedArray< Attribute * > const & MemDb::AttributeRegistry::GetAllAttributes ( )
inlinestatic

get an array of all attributes

◆ GetAttribute()

Attribute * MemDb::AttributeRegistry::GetAttribute ( AttributeId descriptor)
inlinestatic

get attribute description by id

◆ GetAttributeId()

AttributeId MemDb::AttributeRegistry::GetAttributeId ( Util::StringAtom name)
inlinestatic

get attribute id from name

◆ Instance()

AttributeRegistry * MemDb::AttributeRegistry::Instance ( )
staticprivate

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

◆ IsRegistered()

template<typename TYPE >
bool MemDb::AttributeRegistry::IsRegistered ( )
inlinestatic

Check if a type is registered.

◆ Register() [1/3]

template<typename TYPE >
AttributeId MemDb::AttributeRegistry::Register ( Attribute * attribute)
inlinestatic

◆ Register() [2/3]

AttributeId MemDb::AttributeRegistry::Register ( Util::StringAtom name,
SizeT typeSize,
void const * defaultValue,
uint32_t flags = 0 )
inlinestatic

register a POD, mem-copyable type

◆ Register() [3/3]

template<typename TYPE >
AttributeId MemDb::AttributeRegistry::Register ( Util::StringAtom name,
TYPE defaultValue,
uint32_t flags = 0 )
inlinestatic

register a type (templated)

TYPE must be trivially copyable and destructible, and also standard layout.

Essentially a POD type, but we do allow non-trivially-constructible types since components are created by copying the default value, not with constructors. The reason for this is because it allows us to do value initialization in declarations.

◆ TypeSize()

SizeT MemDb::AttributeRegistry::TypeSize ( AttributeId descriptor)
inlinestatic

get type size by attribute id

Member Data Documentation

◆ componentDescriptions

Util::FixedArray<Attribute*> MemDb::AttributeRegistry::componentDescriptions
private

◆ registry

Util::Dictionary<Util::StringAtom, AttributeId> MemDb::AttributeRegistry::registry
private

◆ Singleton

AttributeRegistry * MemDb::AttributeRegistry::Singleton = 0
staticprivate

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