Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
mitk::Message< A > Class Template Reference

Event/message/notification class. More...

#include <mitkMessage.h>

Inheritance diagram for mitk::Message< A >:
Collaboration diagram for mitk::Message< A >:

Public Types

typedef MessageBase< MessageAbstractDelegate< A > > Super
 
typedef Super::ListenerList ListenerList
 
- Public Types inherited from mitk::MessageBase< MessageAbstractDelegate< void > >
typedef std::vector< MessageAbstractDelegate< void > * > ListenerList
 

Public Member Functions

void Send () const
 
void operator() () const
 
- Public Member Functions inherited from mitk::MessageBase< MessageAbstractDelegate< void > >
virtual ~MessageBase ()
 
 MessageBase ()
 
 MessageBase (const MessageBase &o)
 
MessageBaseoperator= (const MessageBase &o)
 
void AddListener (const MessageAbstractDelegate< void > &delegate) const
 
void operator+= (const MessageAbstractDelegate< void > &delegate) const
 
void RemoveListener (const MessageAbstractDelegate< void > &delegate) const
 
void operator-= (const MessageAbstractDelegate< void > &delegate) const
 
const ListenerListGetListeners () const
 
bool HasListeners () const
 
bool IsEmpty () const
 

Additional Inherited Members

- Protected Attributes inherited from mitk::MessageBase< MessageAbstractDelegate< void > >
ListenerList m_Listeners
 List of listeners. More...
 
std::mutex m_Mutex
 

Detailed Description

template<typename A = void>
class mitk::Message< A >

Event/message/notification class.

See also
mitk::BinaryThresholdTool
QmitkBinaryThresholdToolGUI

This totally ITK, Qt, VTK, whatever toolkit independent class allows one class to send out messages and another class to receive these message. This class is templated over the return type (A) of the callback functions. There are variations of this class (Message1, Message2, etc.) for sending one, two or more parameters along with the messages.

This is an implementation of the Observer pattern.

  • There is no guarantee about the order of which observer is notified first. At the moment the observers which register first will be notified first.
  • Notifications are synchronous, by direct method calls. There is no support for asynchronous messages.

To conveniently add methods for registering/unregistering observers to Message variables of your class, you can use the mitkNewMessageMacro macros.

Definition at line 452 of file mitkMessage.h.

Member Typedef Documentation

◆ ListenerList

template<typename A = void>
typedef Super::ListenerList mitk::Message< A >::ListenerList

Definition at line 456 of file mitkMessage.h.

◆ Super

template<typename A = void>
typedef MessageBase<MessageAbstractDelegate<A> > mitk::Message< A >::Super

Definition at line 455 of file mitkMessage.h.

Member Function Documentation

◆ operator()()

template<typename A = void>
void mitk::Message< A >::operator() ( ) const
inline

Definition at line 475 of file mitkMessage.h.

References mitk::Message< A >::Send().

◆ Send()

template<typename A = void>
void mitk::Message< A >::Send ( ) const
inline

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