17#include "vreutil/delegate.h"
100 public DtDelegate<void, const DtAttributeHandle&>
111 template <
class OBJECT_T>
128 template <
typename Callable,
182 template <
class OBJECT_T,
typename METHOD_T>
196 template <
typename Callable,
249 template <
class OBJECT_T>
253 bool includeChildren =
false,
254 bool invokeNowIfSet =
false);
265 bool includeChildren =
false,
266 bool invokeNowIfSet =
false);
279 template <
class OBJECT_T,
typename ATTRIBUTE_T>
282 void (OBJECT_T::*method)(
const ATTRIBUTE_T&),
283 bool invokeNowIfSet =
false);
294 template <
class OBJECT_T,
typename ATTRIBUTE_T>
297 void (OBJECT_T::*method)(ATTRIBUTE_T),
298 bool invokeNowIfSet =
false);
307 template <
typename ATTRIBUTE_T>
309 void (*func)(
const ATTRIBUTE_T&),
310 bool invokeNowIfSet =
false);
319 template <
typename ATTRIBUTE_T>
321 void (*func)(ATTRIBUTE_T),
322 bool invokeNowIfSet =
false);
336 template <
typename Callable>
339 bool includeChildren =
false,
340 bool invokeNowIfSet =
false);
353 template <
typename ATTRIBUTE_T,
typename Callable>
356 bool invokeNowIfSet =
false);
380 std::map<std::string, std::unique_ptr<DtAttributeCallbackBase>>
myCallbackMap;
Abstract base class for all attribute change callbacks.
Definition attributeCallback.h:34
friend class DtAttribute
Definition attributeCallback.h:78
std::list< DtAttributeHandle > AttributeList
Type definition for the list of connected attributes.
Definition attributeCallback.h:82
virtual ~DtAttributeCallbackBase()
Virtual destructor.
virtual void disconnectAll()
Disconnects the callback from all connected attributes.
DtAttributeCallbackBase()
Constructor.
virtual void disconnect(DtAttributeHandle attribute)
Disconnects the callback from a specific attribute.
virtual bool isConnected(const DtAttributeHandle &attribute) const
Checks if the callback is connected to a specific attribute.
AttributeList myConnections
List of attributes this callback is connected to.
Definition attributeCallback.h:85
virtual void connect(DtAttributeHandle attribute, bool invokeNowIfSet=false)
Connects the callback to an attribute.
virtual bool hasConnection() const
Checks if the callback is connected to any attributes.
virtual void invoke(const DtAttributeHandle &changedAttribute) const =0
Invoked by DtAttribute when the connected attribute's value changes.
void connect(DtAttributeHandle attr, OBJECT_T *object, void(OBJECT_T::*method)(ATTRIBUTE_T), bool invokeNowIfSet=false)
Connects a member function callback receiving the new attribute value by value.
std::map< std::string, std::unique_ptr< DtAttributeCallbackBase > > myCallbackMap
Owns all registered callbacks, keyed by the full attribute path.
Definition attributeCallback.h:380
virtual ~DtAttributeCallbackManager()
Virtual destructor.
void connect(DtAttributeHandle attr, Callable &&callable, bool invokeNowIfSet=false)
Connects a callable (lambda, functor) for typed attribute value changes.
void connect(DtAttributeHandle attr, OBJECT_T *object, void(OBJECT_T::*method)(const DtAttributeHandle &), bool includeChildren=false, bool invokeNowIfSet=false)
Connects a member function callback for untyped attribute changes.
DtAttributeCallbackManager(const DtAttributeCallbackManager &)=delete
DtAttributeCallbackManager & operator=(const DtAttributeCallbackManager &)=delete
void connect(DtAttributeHandle attr, Callable &&callable, bool includeChildren=false, bool invokeNowIfSet=false)
Connects a callable (lambda, functor) for untyped attribute changes.
void connect(DtAttributeHandle attr, void(*func)(const ATTRIBUTE_T &), bool invokeNowIfSet=false)
Connects a free-function callback receiving the new attribute value by const reference.
void disconnect(DtAttributeHandle attr)
Removes and destroys the callback registered for the given attribute.
void connect(DtAttributeHandle attr, void(*func)(ATTRIBUTE_T), bool invokeNowIfSet=false)
Connects a free-function callback receiving the new attribute value by value.
void disconnectAll()
Removes and destroys all registered callbacks.
DtAttributeCallbackManager()
Default constructor.
bool isConnected(DtAttributeHandle attr) const
Checks whether a callback is currently registered for the given attribute.
DtAttributeCallbackBase * connection(DtAttributeHandle attr)
Returns a non-owning pointer to the callback registered for the given attribute.
void connect(DtAttributeHandle attr, OBJECT_T *object, void(OBJECT_T::*method)(const ATTRIBUTE_T &), bool invokeNowIfSet=false)
Connects a member function callback receiving the new attribute value by const reference.
void connect(DtAttributeHandle attr, void(*func)(const DtAttributeHandle &), bool includeChildren=false, bool invokeNowIfSet=false)
Connects a free-function callback for untyped attribute changes.
bool myIncludeChildren
Defines whether this callback is also invoked for any changes to children of the connected attribute.
Definition attributeCallback.h:161
DtAttributeChangeCallback(OBJECT_T *object, void(OBJECT_T::*method)(const DtAttributeHandle &), bool includeChildren=false)
Constructor for attribute callbacks using member functions.
DtAttributeChangeCallback(void(*func)(const DtAttributeHandle &), bool includeChildren=false)
Constructor for attribute callbacks using static function.
virtual void includeChildren(bool on)
Set whether this callback should also be invoked for any change to any child attribute.
virtual bool includesChildren() const
Get whether this callback is set to trigger on changes to child attributes.
virtual void invoke(const DtAttributeHandle &changedAttribute) const override
Delivers the change notification to the registered callback function.
virtual ~DtAttributeChangeCallback() override
Virtual destructor.
DtAttributeChangeCallback(Callable &&callable, bool includeChildren=false)
Constructor for attribute callbacks using a callable (lambda, functor, etc.)
Handle class for safe access to attributes.
Definition attributeHandle.h:30
Core attribute class for shared data storage.
Definition attribute.h:35
virtual ~DtAttributeValueCallback() override
Virtual destructor.
DtAttributeValueCallback(void(*func)(const T &))
Constructor for attribute callbacks using static function.
DtAttributeValueCallback(void(*func)(T))
DtAttributeValueCallback(Callable &&callable)
Constructor for attribute callbacks using a callable (lambda, functor, etc.)
virtual void invoke(const DtAttributeHandle &changedAttribute) const override
Delivers the typed attribute value to the registered callback function.
DtAttributeValueCallback(OBJECT_T *object, METHOD_T method)
Constructor for attribute callbacks using member functions.
Defines export macros for the VREngage Utility library.
#define UTIL_DLL
Export/import macro for non-Windows platforms.
Definition export.h:39
!
Definition glsVreMessageUtil.h:50