Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
Medical Imaging Interaction Toolkit
mitk::Dispatcher Class Reference

Manages event distribution. More...

#include <mitkDispatcher.h>

Inheritance diagram for mitk::Dispatcher:
Collaboration diagram for mitk::Dispatcher:

Public Types

typedef Dispatcher Self
 
typedef itk::LightObject Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 
typedef std::list< mitk::WeakPointer< DataInteractor > > ListInteractorType
 
typedef std::list< itk::SmartPointer< InteractionEvent > > ListEventsType
 

Public Member Functions

virtual std::vector< std::string > GetClassHierarchy () const
 
virtual const char * GetClassName () const
 
bool ProcessEvent (InteractionEvent *event)
 
void QueueEvent (InteractionEvent *event)
 
void AddDataInteractor (const DataNode *dataNode)
 
void RemoveDataInteractor (const DataNode *dataNode)
 
size_t GetNumberOfInteractors ()
 

Static Public Member Functions

static const char * GetStaticNameOfClass ()
 
static Pointer New (const std::string &_arg)
 

Protected Member Functions

 Dispatcher (const std::string &rendererName)
 
 ~Dispatcher () override
 

Detailed Description

Manages event distribution.

Receives Events (Mouse-,Key-, ... Events) and dispatches them to the registered DataInteractor Objects. The order in which DataInteractors are offered to handle an event is determined by layer of their associated DataNode. Higher layers are preferred.

Definition at line 44 of file mitkDispatcher.h.

Member Typedef Documentation

◆ ConstPointer

Definition at line 47 of file mitkDispatcher.h.

◆ ListEventsType

◆ ListInteractorType

◆ Pointer

Definition at line 47 of file mitkDispatcher.h.

◆ Self

Definition at line 47 of file mitkDispatcher.h.

◆ Superclass

typedef itk::LightObject mitk::Dispatcher::Superclass

Definition at line 47 of file mitkDispatcher.h.

Constructor & Destructor Documentation

◆ Dispatcher()

mitk::Dispatcher::Dispatcher ( const std::string &  rendererName)
protected

◆ ~Dispatcher()

mitk::Dispatcher::~Dispatcher ( )
overrideprotected

Member Function Documentation

◆ AddDataInteractor()

void mitk::Dispatcher::AddDataInteractor ( const DataNode dataNode)

Adds the DataInteractor that is associated with the DataNode to the Dispatcher Queue. If there already exists an DataInteractor that has a reference to the same DataNode, it is removed. Note that within this method also all other DataInteractors are checked and removed if they are no longer active, and were not removed properly.

◆ GetClassHierarchy()

virtual std::vector<std::string> mitk::Dispatcher::GetClassHierarchy ( ) const
inlinevirtual

Definition at line 47 of file mitkDispatcher.h.

◆ GetClassName()

virtual const char* mitk::Dispatcher::GetClassName ( ) const
virtual

◆ GetNumberOfInteractors()

size_t mitk::Dispatcher::GetNumberOfInteractors ( )

◆ GetStaticNameOfClass()

static const char* mitk::Dispatcher::GetStaticNameOfClass ( )
inlinestatic

Definition at line 47 of file mitkDispatcher.h.

◆ New()

static Pointer mitk::Dispatcher::New ( const std::string &  _arg)
inlinestatic

Definition at line 48 of file mitkDispatcher.h.

◆ ProcessEvent()

bool mitk::Dispatcher::ProcessEvent ( InteractionEvent event)

To post new Events which are to be handled by the Dispatcher.

Returns
Returns true if the event has been handled by an DataInteractor, and false else.

◆ QueueEvent()

void mitk::Dispatcher::QueueEvent ( InteractionEvent event)

Adds an Event to the Dispatchers EventQueue, these events will be processed after a a regular posted event has been fully handled. This allows DataInteractors to post their own events without interrupting regular Dispatching workflow. It is important to note that the queued events will be processed AFTER the state change of a current transition (which queued the events) is performed.

Note
1) If an event is added from an other source than an DataInteractor / Observer its execution will be delayed until the next regular event comes in.
2) Make sure you're not causing infinite loops!

◆ RemoveDataInteractor()

void mitk::Dispatcher::RemoveDataInteractor ( const DataNode dataNode)

Remove all DataInteractors related to this Node, to prevent double entries and dead references.


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