Usd Notice Framework  0.7.0
unf::Dispatcher Class Referenceabstract

Interface for objects emitting standalone notices triggered by incoming PXR_NS::TfNotice derived notices. More...

#include <dispatcher.h>

Inheritance diagram for unf::Dispatcher:
PXR_NS::TfRefBase PXR_NS::TfWeakBase unf::StageDispatcher

Public Member Functions

virtual UNF_API ~Dispatcher ()
 Revoke all registered listeners on destruction.
 
virtual UNF_API std::string GetIdentifier () const =0
 Get unique string identifier. More...
 
virtual UNF_API void Register ()=0
 Register listeners to PXR_NS::TfNotice derived notices.
 
virtual UNF_API void Revoke ()
 Revoke all registered listeners.
 

Protected Member Functions

UNF_API Dispatcher (const BrokerWeakPtr &)
 Create a dispatcher targeting a Broker.
 
template<class InputNotice , class OutputNotice >
void _Register ()
 Convenient templated method to register a listener for incoming InputNotice notice which emits a OutputNotice notice. More...
 
template<class InputNotice , class OutputNotice >
void _OnReceiving (const InputNotice &notice)
 Convenient templated method to emit a OutputNotice notice from an incoming InputNotice notice. More...
 

Protected Attributes

BrokerWeakPtr _broker
 Broker that the dispatcher is attached to.
 
std::vector< PXR_NS::TfNotice::Key_keys
 List of handle-objects used for registering listeners.
 

Detailed Description

Interface for objects emitting standalone notices triggered by incoming PXR_NS::TfNotice derived notices.

Member Function Documentation

◆ GetIdentifier()

virtual UNF_API std::string unf::Dispatcher::GetIdentifier ( ) const
pure virtual

Get unique string identifier.

Identifier will be used to retrieve Dispatcher from the Broker.

See also
Broker::GetDispatcher

Implemented in unf::StageDispatcher.

◆ _Register()

template<class InputNotice , class OutputNotice >
void unf::Dispatcher::_Register ( )
inlineprotected

Convenient templated method to register a listener for incoming InputNotice notice which emits a OutputNotice notice.

The following example will emit a UnfNotice::ObjectsChanged notice for each PXR_NS::UsdNotice::ObjectsChanged received.

UnfNotice::ObjectsChanged>();
void _Register()
Convenient templated method to register a listener for incoming InputNotice notice which emits a Outp...
Definition: dispatcher.h:65
Warning
The OutputNotice notice must be derived from UnfNotice::StageNotice and must have a constructor which takes an instance of InputNotice.

◆ _OnReceiving()

template<class InputNotice , class OutputNotice >
void unf::Dispatcher::_OnReceiving ( const InputNotice &  notice)
inlineprotected

Convenient templated method to emit a OutputNotice notice from an incoming InputNotice notice.

Warning
The OutputNotice notice must be derived from UnfNotice::StageNotice and must have a constructor which takes an instance of InputNotice.

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