VR-Engage  2.3
Loading...
Searching...
No Matches
makVre::DtAttributeCallbackBase Class Referenceabstract

Detailed Description

Provides the connection management interface for registering and deregistering callbacks with DtAttribute instances. Derived classes implement the invoke() method to define how they respond to attribute changes. The destructor automatically disconnects from all connected attributes.

#include <attributeCallback.h>

Inheritance diagram for makVre::DtAttributeCallbackBase:
[legend]

Public Member Functions

 DtAttributeCallbackBase ()
 
virtual ~DtAttributeCallbackBase ()
 
virtual void connect (DtAttributeHandle attribute, bool invokeNowIfSet=false)
 
virtual void disconnect (DtAttributeHandle attribute)
 
virtual void disconnectAll ()
 
virtual bool isConnected (const DtAttributeHandle &attribute) const
 
virtual bool hasConnection () const
 

Protected Types

using AttributeList = std::list<DtAttributeHandle>
 

Protected Member Functions

virtual void invoke (const DtAttributeHandle &changedAttribute) const =0
 

Protected Attributes

AttributeList myConnections
 

Friends

class DtAttribute
 

Member Typedef Documentation

◆ AttributeList

Type definition for the list of connected attributes.

Constructor & Destructor Documentation

◆ DtAttributeCallbackBase()

makVre::DtAttributeCallbackBase::DtAttributeCallbackBase ( )

Constructor.

Captures the calling thread's ID so that callbacks are dispatched on the correct thread.

◆ ~DtAttributeCallbackBase()

virtual makVre::DtAttributeCallbackBase::~DtAttributeCallbackBase ( )
virtual

Virtual destructor.

Automatically disconnects from all connected attributes

Member Function Documentation

◆ connect()

virtual void makVre::DtAttributeCallbackBase::connect ( DtAttributeHandle attribute,
bool invokeNowIfSet = false )
virtual

Connects the callback to an attribute.

Parameters
attributeReference to the attribute to connect to
invokeNowIfSetOptional, default False. If set True, the callback is invoked immediately, if the attribute value has been set.

◆ disconnect()

virtual void makVre::DtAttributeCallbackBase::disconnect ( DtAttributeHandle attribute)
virtual

Disconnects the callback from a specific attribute.

Parameters
attributeReference to the attribute to disconnect from

◆ disconnectAll()

virtual void makVre::DtAttributeCallbackBase::disconnectAll ( )
virtual

Disconnects the callback from all connected attributes.

◆ isConnected()

virtual bool makVre::DtAttributeCallbackBase::isConnected ( const DtAttributeHandle & attribute) const
virtual

Checks if the callback is connected to a specific attribute.

Parameters
attributeReference to the attribute to check
Returns
True if connected to the attribute, false otherwise

◆ hasConnection()

virtual bool makVre::DtAttributeCallbackBase::hasConnection ( ) const
virtual

Checks if the callback is connected to any attributes.

Returns
True if connected to at least one attribute, false otherwise

◆ invoke()

virtual void makVre::DtAttributeCallbackBase::invoke ( const DtAttributeHandle & changedAttribute) const
protectedpure virtual

Invoked by DtAttribute when the connected attribute's value changes.

Derived classes implement this method to deliver the change notification to the registered function or functor.

Parameters
changedAttributeHandle to the attribute whose value changed

Implemented in makVre::DtAttributeChangeCallback, and makVre::DtAttributeValueCallback< T >.

Friends And Related Symbol Documentation

◆ DtAttribute

friend class DtAttribute
friend

References DtAttribute.

Referenced by DtAttribute.

Member Data Documentation

◆ myConnections

AttributeList makVre::DtAttributeCallbackBase::myConnections
protected

List of attributes this callback is connected to.


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