Nebula
Loading...
Searching...
No Matches
Attr::AttributeContainer Class Reference

#include <attributecontainer.h>

Detailed Description

A simple container for attributes.

Public Member Functions

 AttributeContainer ()
 constructor
 
 ~AttributeContainer ()
 destructor
 
bool HasAttr (const AttrId &attrId) const
 check if an attribute exists in the container
 
void SetAttr (const Attribute &attr)
 set a single attribute, new or existing
 
const AttributeGetAttr (const AttrId &attrId) const
 get a single attribute
 
const Util::Dictionary< AttrId, Attribute > & GetAttrs () const
 read access to the attribute array
 
void RemoveAttr (const AttrId &attrId)
 remove an attribute
 
void Clear ()
 clear the attribute container
 
void AddAttr (const Attribute &attr)
 add a new attribute, faster then SetAttr(), but attribute may not exist!
 
void SetBool (const BoolAttrId &attrId, bool val)
 set bool value
 
bool GetBool (const BoolAttrId &attrId) const
 get bool value
 
bool GetBool (const BoolAttrId &attrId, bool defaultValue) const
 get bool value with default if not exists
 
void SetFloat (const FloatAttrId &attrId, float val)
 set float value
 
float GetFloat (const FloatAttrId &attrId) const
 get float value
 
float GetFloat (const FloatAttrId &attrId, float defaultValue) const
 get float value with default if not exists
 
void SetInt (const IntAttrId &attrId, int val)
 set int value
 
int GetInt (const IntAttrId &attrId) const
 get int value
 
int GetInt (const IntAttrId &attrId, int defaultValue) const
 get int value with default if not exists
 
void SetString (const StringAttrId &attrId, const Util::String &val)
 set string value
 
const Util::StringGetString (const StringAttrId &attrId) const
 get string value
 
const Util::StringGetString (const StringAttrId &attrId, const Util::String &defaultValue) const
 get string value with default if not exists
 
void SetFloat4 (const Vec4AttrId &attrId, const Math::vec4 &val)
 set float4 value
 
Math::vec4 GetVec4 (const Vec4AttrId &attrId) const
 get float4 value
 
Math::vec4 GetVec4 (const Vec4AttrId &attrId, const Math::vec4 &defaultValue) const
 get float4 value with default if not exists
 
void SetMatrix44 (const Mat4AttrId &attrId, const Math::mat4 &val)
 set matrix44 value
 
const Math::mat4GetMat4 (const Mat4AttrId &attrId) const
 get matrix44 value
 
const Math::mat4GetMat4 (const Mat4AttrId &attrId, const Math::mat4 &defaultValue) const
 get matrix44 value with default if not exists
 
void SetGuid (const GuidAttrId &attrId, const Util::Guid &guid)
 set guid value
 
const Util::GuidGetGuid (const GuidAttrId &attrId) const
 get guid value
 
const Util::GuidGetGuid (const GuidAttrId &attrId, const Util::Guid &defaultValue) const
 get guid value with default if not exists
 
void SetBlob (const BlobAttrId &attrId, const Util::Blob &blob)
 set blob value
 
const Util::BlobGetBlob (const BlobAttrId &attrId) const
 get blob value
 
const Util::BlobGetBlob (const BlobAttrId &attrId, const Util::Blob &defaultValue) const
 get blob value with default if not exists
 

Private Member Functions

int FindAttrIndex (const Attr::AttrId &attrId) const
 find index for attribute (SLOW!)
 

Private Attributes

Util::Dictionary< Attr::AttrId, Attributeattrs
 

Constructor & Destructor Documentation

◆ AttributeContainer()

Attr::AttributeContainer::AttributeContainer ( )

constructor

◆ ~AttributeContainer()

Attr::AttributeContainer::~AttributeContainer ( )

destructor

Member Function Documentation

◆ AddAttr()

void Attr::AttributeContainer::AddAttr ( const Attribute & attr)

add a new attribute, faster then SetAttr(), but attribute may not exist!

Add a new attribute.

The attribute may not exist yet in the container, otherwise the result is undefined. This is faster then SetAttr() when many attributes are added.

◆ Clear()

void Attr::AttributeContainer::Clear ( )

clear the attribute container

This method clears the attributes in the attribute container.

◆ FindAttrIndex()

int Attr::AttributeContainer::FindAttrIndex ( const Attr::AttrId & attrId) const
private

find index for attribute (SLOW!)

◆ GetAttr()

const Attribute & Attr::AttributeContainer::GetAttr ( const AttrId & attrId) const

get a single attribute

Get generic attribute.

Throws a hard error if the attribute doesn't exist.

◆ GetAttrs()

const Util::Dictionary< Attr::AttrId, Attribute > & Attr::AttributeContainer::GetAttrs ( ) const

read access to the attribute array

This method provides direct read access to the attributes.

◆ GetBlob() [1/2]

const Util::Blob & Attr::AttributeContainer::GetBlob ( const BlobAttrId & attrId) const
inline

get blob value

◆ GetBlob() [2/2]

const Util::Blob & Attr::AttributeContainer::GetBlob ( const BlobAttrId & attrId,
const Util::Blob & defaultValue ) const
inline

get blob value with default if not exists

◆ GetBool() [1/2]

bool Attr::AttributeContainer::GetBool ( const BoolAttrId & attrId) const
inline

get bool value

◆ GetBool() [2/2]

bool Attr::AttributeContainer::GetBool ( const BoolAttrId & attrId,
bool defaultValue ) const
inline

get bool value with default if not exists

◆ GetFloat() [1/2]

float Attr::AttributeContainer::GetFloat ( const FloatAttrId & attrId) const
inline

get float value

◆ GetFloat() [2/2]

float Attr::AttributeContainer::GetFloat ( const FloatAttrId & attrId,
float defaultValue ) const
inline

get float value with default if not exists

◆ GetGuid() [1/2]

const Util::Guid & Attr::AttributeContainer::GetGuid ( const GuidAttrId & attrId) const
inline

get guid value

◆ GetGuid() [2/2]

const Util::Guid & Attr::AttributeContainer::GetGuid ( const GuidAttrId & attrId,
const Util::Guid & defaultValue ) const
inline

get guid value with default if not exists

◆ GetInt() [1/2]

int Attr::AttributeContainer::GetInt ( const IntAttrId & attrId) const
inline

get int value

◆ GetInt() [2/2]

int Attr::AttributeContainer::GetInt ( const IntAttrId & attrId,
int defaultValue ) const
inline

get int value with default if not exists

◆ GetMat4() [1/2]

const Math::mat4 & Attr::AttributeContainer::GetMat4 ( const Mat4AttrId & attrId) const
inline

get matrix44 value

◆ GetMat4() [2/2]

const Math::mat4 & Attr::AttributeContainer::GetMat4 ( const Mat4AttrId & attrId,
const Math::mat4 & defaultValue ) const
inline

get matrix44 value with default if not exists

◆ GetString() [1/2]

const Util::String & Attr::AttributeContainer::GetString ( const StringAttrId & attrId) const
inline

get string value

◆ GetString() [2/2]

const Util::String & Attr::AttributeContainer::GetString ( const StringAttrId & attrId,
const Util::String & defaultValue ) const
inline

get string value with default if not exists

◆ GetVec4() [1/2]

Math::vec4 Attr::AttributeContainer::GetVec4 ( const Vec4AttrId & attrId) const
inline

get float4 value

◆ GetVec4() [2/2]

Math::vec4 Attr::AttributeContainer::GetVec4 ( const Vec4AttrId & attrId,
const Math::vec4 & defaultValue ) const
inline

get float4 value with default if not exists

◆ HasAttr()

bool Attr::AttributeContainer::HasAttr ( const AttrId & attrId) const

check if an attribute exists in the container

Return true if an attribute exists.

◆ RemoveAttr()

void Attr::AttributeContainer::RemoveAttr ( const AttrId & attrId)

remove an attribute

This method removes an attribute from the container.

◆ SetAttr()

void Attr::AttributeContainer::SetAttr ( const Attribute & attr)

set a single attribute, new or existing

Set a generic attribute.

If the attribute exists, its value will be overwritten and a type check will be made (you can't overwrite an attribute with a different types one). If the attribute doesn't exist, a new attribute will be created.

◆ SetBlob()

void Attr::AttributeContainer::SetBlob ( const BlobAttrId & attrId,
const Util::Blob & blob )
inline

set blob value

◆ SetBool()

void Attr::AttributeContainer::SetBool ( const BoolAttrId & attrId,
bool val )
inline

set bool value

◆ SetFloat()

void Attr::AttributeContainer::SetFloat ( const FloatAttrId & attrId,
float val )
inline

set float value

◆ SetFloat4()

void Attr::AttributeContainer::SetFloat4 ( const Vec4AttrId & attrId,
const Math::vec4 & val )
inline

set float4 value

◆ SetGuid()

void Attr::AttributeContainer::SetGuid ( const GuidAttrId & attrId,
const Util::Guid & guid )
inline

set guid value

◆ SetInt()

void Attr::AttributeContainer::SetInt ( const IntAttrId & attrId,
int val )
inline

set int value

◆ SetMatrix44()

void Attr::AttributeContainer::SetMatrix44 ( const Mat4AttrId & attrId,
const Math::mat4 & val )
inline

set matrix44 value

◆ SetString()

void Attr::AttributeContainer::SetString ( const StringAttrId & attrId,
const Util::String & val )
inline

set string value

Member Data Documentation

◆ attrs

Util::Dictionary<Attr::AttrId, Attribute> Attr::AttributeContainer::attrs
private

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