|
VR-Engage
2.2
|
This class provides a handle-based mechanism for accessing attributes safely. It manages reference counting, type safety, and automatic attribute creation when needed. It works in conjunction with the DtAttribute class to provide a clean interface for attribute manipulation.
#include <attributeHandle.h>
Public Member Functions | |
| DtAttributeHandle (const DtAttributeHandle &other) | |
| DtAttributeHandle () | |
| virtual | ~DtAttributeHandle () |
| void | assign (const DtAttributeHandle &other) |
| DtAttributeHandle & | operator= (const DtAttributeHandle &other) |
| bool | assigned () const |
| bool | assignedSame (const DtAttributeHandle &other) const |
| void | unassign () |
| template<typename T> | |
| DtAttributeHandleType< T > | as () |
| template<typename T> | |
| const DtAttributeHandleType< T > | as () const |
| virtual DtAttribute * | operator-> () |
| virtual const DtAttribute * | operator-> () const |
| DtAttributeHandle | operator[] (const std::string &name) |
| const DtAttributeHandle | operator[] (const std::string &name) const |
| DtAttributeHandle | operator[] (const unsigned int i) |
| const DtAttributeHandle | operator[] (const unsigned int i) const |
| bool | lock () |
| bool | unlock () |
| bool | locking () const |
Protected Types | |
| using | Ptr = std::shared_ptr<DtAttribute> |
Protected Member Functions | |
| DtAttributeHandle (Ptr ptr) | |
| void | avoidNull () const |
Static Protected Member Functions | |
| static unsigned int | nextKey () |
Protected Attributes | |
| Ptr | myPtr |
| bool | myLocking |
| unsigned int | myKey |
Friends | |
| class | DtAttribute |
|
protected |
Shared pointer type for attributes.
| makVre::DtAttributeHandle::DtAttributeHandle | ( | const DtAttributeHandle & | other | ) |
Copy constructor.
| other | The handle to copy |
References DtAttributeHandle().
Referenced by assign(), assignedSame(), DtAttributeHandle(), makVre::DtAttributeHandleType< T >::DtAttributeHandleType(), operator=(), operator[](), operator[](), operator[](), and operator[]().
| makVre::DtAttributeHandle::DtAttributeHandle | ( | ) |
Default constructor.
Creates an unassigned handle
|
virtual |
Virtual destructor.
|
protected |
Constructor that takes a shared pointer to an attribute.
| ptr | The shared pointer to the attribute |
| void makVre::DtAttributeHandle::assign | ( | const DtAttributeHandle & | other | ) |
Assigns this handle to refer to the same attribute as another handle.
| other | The handle to assign from |
References DtAttributeHandle().
| DtAttributeHandle & makVre::DtAttributeHandle::operator= | ( | const DtAttributeHandle & | other | ) |
References DtAttributeHandle().
| bool makVre::DtAttributeHandle::assigned | ( | ) | const |
Checks if this handle is assigned to an attribute.
| bool makVre::DtAttributeHandle::assignedSame | ( | const DtAttributeHandle & | other | ) | const |
Checks if this handle is assigned to the same attribute as another handle.
| other | The handle to compare with |
References DtAttributeHandle().
| void makVre::DtAttributeHandle::unassign | ( | ) |
Unassigns this handle from its attribute.
| DtAttributeHandleType< T > makVre::DtAttributeHandle::as | ( | ) |
Converts this handle to a typed handle.
| const DtAttributeHandleType< T > makVre::DtAttributeHandle::as | ( | ) | const |
Converts this handle to a const typed handle.
|
virtual |
Dereference operator for accessing the attribute.
Reimplemented in makVre::DtAttributeHandleType< T >, makVre::DtAttributeHandleType< bool >, makVre::DtAttributeHandleType< DtEntityIdentifier >, makVre::DtAttributeHandleType< makVre::DtPlayerStationApp * >, and makVre::DtAttributeHandleType< std::vector< std::string > >.
References DtAttribute.
|
virtual |
Const dereference operator for accessing the attribute.
Reimplemented in makVre::DtAttributeHandleType< T >, makVre::DtAttributeHandleType< bool >, makVre::DtAttributeHandleType< DtEntityIdentifier >, makVre::DtAttributeHandleType< makVre::DtPlayerStationApp * >, and makVre::DtAttributeHandleType< std::vector< std::string > >.
References DtAttribute.
| DtAttributeHandle makVre::DtAttributeHandle::operator[] | ( | const std::string & | name | ) |
Indexing operator for accessing child attributes by name.
| name | The name of the child attribute |
References DtAttributeHandle().
| const DtAttributeHandle makVre::DtAttributeHandle::operator[] | ( | const std::string & | name | ) | const |
Const indexing operator for accessing child attributes by name.
| name | The name of the child attribute |
References DtAttributeHandle().
| DtAttributeHandle makVre::DtAttributeHandle::operator[] | ( | const unsigned int | i | ) |
Indexing operator for accessing child attributes by index.
| i | The index of the child attribute |
References DtAttributeHandle().
| const DtAttributeHandle makVre::DtAttributeHandle::operator[] | ( | const unsigned int | i | ) | const |
Const indexing operator for accessing child attributes by index.
| i | The index of the child attribute |
References DtAttributeHandle().
| bool makVre::DtAttributeHandle::lock | ( | ) |
Locks the attribute.
| bool makVre::DtAttributeHandle::unlock | ( | ) |
Unlocks the attribute.
| bool makVre::DtAttributeHandle::locking | ( | ) | const |
Checks if this handle has locking enabled.
|
protected |
Ensures that the handle is assigned to an attribute.
Checks if the handle is unassigned and asserts if it is
|
staticprotected |
Generates a new unique key for locking.
|
friend |
References DtAttribute.
Referenced by DtAttribute, operator->(), and operator->().
|
mutableprotected |
Shared pointer to the attribute.
|
protected |
Flag indicating if this handle uses locking.
|
protected |
Key used for locking and unlocking.