The Nebula Device 3: Attr::AttributeContainer Class Reference

The Nebula Device 3

Attr::AttributeContainer Class Reference

#include <attributecontainer.h>


Detailed Description

A simple container for attributes.

(C) 2007 Radon Labs GmbH

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 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 Float4AttrId &attrId, const Math::float4 &val)
 set float4 value
Math::float4 GetFloat4 (const Float4AttrId &attrId) const
 get float4 value
Math::float4 GetFloat4 (const Float4AttrId &attrId, const Math::float4 &defaultValue) const
 get float4 value with default if not exists
void SetMatrix44 (const Matrix44AttrId &attrId, const Math::matrix44 &val)
 set matrix44 value
const Math::matrix44GetMatrix44 (const Matrix44AttrId &attrId) const
 get matrix44 value
const Math::matrix44GetMatrix44 (const Matrix44AttrId &attrId, const Math::matrix44 &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

Member Function Documentation

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

check if an attribute exists in the container

Return true if an attribute exists.

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.

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.

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.

void Attr::AttributeContainer::Clear (  ) 

clear the attribute container

This method clears the attributes in the attribute container.

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.