Medical Imaging Interaction Toolkit  2026.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)
 
MessageBase & operator= (const MessageBase &o)
 
void AddListener (const MessageAbstractDelegate< void > &delegate) const
 Add a listener delegate. Duplicates are silently ignored. More...
 
void operator+= (const MessageAbstractDelegate< void > &delegate) const
 Shorthand for AddListener(). More...
 
void RemoveListener (const MessageAbstractDelegate< void > &delegate) const
 Remove a listener delegate. If not found, nothing happens. More...
 
void operator-= (const MessageAbstractDelegate< void > &delegate) const
 Shorthand for RemoveListener(). More...
 
const ListenerList & GetListeners () const
 Get the list of currently registered listeners. More...
 
bool HasListeners () const
 Check whether any listeners are registered. More...
 
bool IsEmpty () const
 Check whether the listener list is empty. More...
 

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 520 of file mitkMessage.h.

Member Typedef Documentation

◆ ListenerList

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

Definition at line 524 of file mitkMessage.h.

◆ Super

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

Definition at line 523 of file mitkMessage.h.

Member Function Documentation

◆ operator()()

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

Definition at line 543 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: