VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtAttributeHandle Class Reference

Detailed Description

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>

Inheritance diagram for makVre::DtAttributeHandle:
[legend]

Public Member Functions

 DtAttributeHandle (const DtAttributeHandle &other)
 
 DtAttributeHandle ()
 
virtual ~DtAttributeHandle ()
 
void assign (const DtAttributeHandle &other)
 
DtAttributeHandleoperator= (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 DtAttributeoperator-> ()
 
virtual const DtAttributeoperator-> () 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
 

Member Typedef Documentation

◆ Ptr

using makVre::DtAttributeHandle::Ptr = std::shared_ptr<DtAttribute>
protected

Shared pointer type for attributes.

Constructor & Destructor Documentation

◆ DtAttributeHandle() [1/3]

makVre::DtAttributeHandle::DtAttributeHandle ( const DtAttributeHandle & other)

◆ DtAttributeHandle() [2/3]

makVre::DtAttributeHandle::DtAttributeHandle ( )

Default constructor.

Creates an unassigned handle

◆ ~DtAttributeHandle()

virtual makVre::DtAttributeHandle::~DtAttributeHandle ( )
virtual

Virtual destructor.

◆ DtAttributeHandle() [3/3]

makVre::DtAttributeHandle::DtAttributeHandle ( Ptr ptr)
protected

Constructor that takes a shared pointer to an attribute.

Parameters
ptrThe shared pointer to the attribute

Member Function Documentation

◆ assign()

void makVre::DtAttributeHandle::assign ( const DtAttributeHandle & other)

Assigns this handle to refer to the same attribute as another handle.

Parameters
otherThe handle to assign from

References DtAttributeHandle().

◆ operator=()

DtAttributeHandle & makVre::DtAttributeHandle::operator= ( const DtAttributeHandle & other)

References DtAttributeHandle().

◆ assigned()

bool makVre::DtAttributeHandle::assigned ( ) const

Checks if this handle is assigned to an attribute.

Returns
true if the handle is assigned, false otherwise

◆ assignedSame()

bool makVre::DtAttributeHandle::assignedSame ( const DtAttributeHandle & other) const

Checks if this handle is assigned to the same attribute as another handle.

Parameters
otherThe handle to compare with
Returns
true if both handles refer to the same attribute, false otherwise

References DtAttributeHandle().

◆ unassign()

void makVre::DtAttributeHandle::unassign ( )

Unassigns this handle from its attribute.

◆ as() [1/2]

template<typename T>
DtAttributeHandleType< T > makVre::DtAttributeHandle::as ( )

Converts this handle to a typed handle.

Returns
A typed handle to the same attribute

◆ as() [2/2]

template<typename T>
const DtAttributeHandleType< T > makVre::DtAttributeHandle::as ( ) const

Converts this handle to a const typed handle.

Returns
A const typed handle to the same attribute

◆ operator->() [1/2]

virtual DtAttribute * makVre::DtAttributeHandle::operator-> ( )
virtual

◆ operator->() [2/2]

virtual const DtAttribute * makVre::DtAttributeHandle::operator-> ( ) const
virtual

◆ operator[]() [1/4]

DtAttributeHandle makVre::DtAttributeHandle::operator[] ( const std::string & name)

Indexing operator for accessing child attributes by name.

Parameters
nameThe name of the child attribute
Returns
A handle to the child attribute

References DtAttributeHandle().

◆ operator[]() [2/4]

const DtAttributeHandle makVre::DtAttributeHandle::operator[] ( const std::string & name) const

Const indexing operator for accessing child attributes by name.

Parameters
nameThe name of the child attribute
Returns
A const handle to the child attribute

References DtAttributeHandle().

◆ operator[]() [3/4]

DtAttributeHandle makVre::DtAttributeHandle::operator[] ( const unsigned int i)

Indexing operator for accessing child attributes by index.

Parameters
iThe index of the child attribute
Returns
A handle to the child attribute

References DtAttributeHandle().

◆ operator[]() [4/4]

const DtAttributeHandle makVre::DtAttributeHandle::operator[] ( const unsigned int i) const

Const indexing operator for accessing child attributes by index.

Parameters
iThe index of the child attribute
Returns
A const handle to the child attribute

References DtAttributeHandle().

◆ lock()

bool makVre::DtAttributeHandle::lock ( )

Locks the attribute.

Returns
true if the attribute was successfully locked, false otherwise

◆ unlock()

bool makVre::DtAttributeHandle::unlock ( )

Unlocks the attribute.

Returns
true if the attribute was successfully unlocked, false otherwise

◆ locking()

bool makVre::DtAttributeHandle::locking ( ) const

Checks if this handle has locking enabled.

Returns
true if locking is enabled for this handle, false otherwise

◆ avoidNull()

void makVre::DtAttributeHandle::avoidNull ( ) const
protected

Ensures that the handle is assigned to an attribute.

Checks if the handle is unassigned and asserts if it is

◆ nextKey()

static unsigned int makVre::DtAttributeHandle::nextKey ( )
staticprotected

Generates a new unique key for locking.

Returns
A new unique key

Friends And Related Symbol Documentation

◆ DtAttribute

friend class DtAttribute
friend

References DtAttribute.

Referenced by DtAttribute, operator->(), and operator->().

Member Data Documentation

◆ myPtr

Ptr makVre::DtAttributeHandle::myPtr
mutableprotected

Shared pointer to the attribute.

◆ myLocking

bool makVre::DtAttributeHandle::myLocking
protected

Flag indicating if this handle uses locking.

◆ myKey

unsigned int makVre::DtAttributeHandle::myKey
protected

Key used for locking and unlocking.


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