|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
Base class for message/event objects that manage a list of delegate listeners. More...
#include <mitkMessage.h>


Public Types | |
| typedef std::vector< AbstractDelegate * > | ListenerList |
Public Member Functions | |
| virtual | ~MessageBase () |
| MessageBase () | |
| MessageBase (const MessageBase &o) | |
| MessageBase & | operator= (const MessageBase &o) |
| void | AddListener (const AbstractDelegate &delegate) const |
| Add a listener delegate. Duplicates are silently ignored. More... | |
| void | operator+= (const AbstractDelegate &delegate) const |
| Shorthand for AddListener(). More... | |
| void | RemoveListener (const AbstractDelegate &delegate) const |
| Remove a listener delegate. If not found, nothing happens. More... | |
| void | operator-= (const AbstractDelegate &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... | |
Protected Attributes | |
| ListenerList | m_Listeners |
| List of listeners. More... | |
| std::mutex | m_Mutex |
Base class for message/event objects that manage a list of delegate listeners.
Provides thread-safe add/remove listener functionality. Listeners are stored as cloned delegates to ensure ownership.
| AbstractDelegate | The abstract delegate type this message manages. |
Definition at line 402 of file mitkMessage.h.
| typedef std::vector<AbstractDelegate *> mitk::MessageBase< AbstractDelegate >::ListenerList |
Definition at line 405 of file mitkMessage.h.
|
inlinevirtual |
Definition at line 407 of file mitkMessage.h.
References mitk::MessageBase< AbstractDelegate >::m_Listeners.
|
inline |
Definition at line 415 of file mitkMessage.h.
|
inline |
Definition at line 416 of file mitkMessage.h.
References mitk::MessageBase< AbstractDelegate >::m_Listeners.
|
inline |
Add a listener delegate. Duplicates are silently ignored.
Definition at line 432 of file mitkMessage.h.
References mitk::MessageBase< AbstractDelegate >::m_Listeners, and mitk::MessageBase< AbstractDelegate >::m_Mutex.
Referenced by mitk::MessageBase< AbstractDelegate >::operator+=().
|
inline |
Get the list of currently registered listeners.
Definition at line 474 of file mitkMessage.h.
References mitk::MessageBase< AbstractDelegate >::m_Listeners.
|
inline |
Check whether any listeners are registered.
Definition at line 477 of file mitkMessage.h.
References mitk::MessageBase< AbstractDelegate >::m_Listeners.
|
inline |
Check whether the listener list is empty.
Definition at line 480 of file mitkMessage.h.
References mitk::MessageBase< AbstractDelegate >::m_Listeners.
|
inline |
Shorthand for AddListener().
Definition at line 451 of file mitkMessage.h.
References mitk::MessageBase< AbstractDelegate >::AddListener().
|
inline |
Shorthand for RemoveListener().
Definition at line 471 of file mitkMessage.h.
References mitk::MessageBase< AbstractDelegate >::RemoveListener().
|
inline |
Definition at line 424 of file mitkMessage.h.
References mitk::MessageBase< AbstractDelegate >::m_Listeners, and mitk::swap().
|
inline |
Remove a listener delegate. If not found, nothing happens.
Definition at line 454 of file mitkMessage.h.
References mitk::MessageBase< AbstractDelegate >::m_Listeners, and mitk::MessageBase< AbstractDelegate >::m_Mutex.
Referenced by mitk::MessageBase< AbstractDelegate >::operator-=().
|
mutableprotected |
List of listeners.
This is declared mutable for a reason: Imagine an object that sends out notifications and someone gets a const Database object, because he/she should not write to the database. He/she should anyway be able to register for notifications about changes in the database – this is why AddListener and RemoveListener are declared const. m_Listeners must be mutable so that AddListener and RemoveListener can modify it regardless of the object's constness.
Definition at line 491 of file mitkMessage.h.
Referenced by mitk::MessageBase< AbstractDelegate >::AddListener(), mitk::MessageBase< AbstractDelegate >::GetListeners(), mitk::MessageBase< AbstractDelegate >::HasListeners(), mitk::MessageBase< AbstractDelegate >::IsEmpty(), mitk::MessageBase< AbstractDelegate >::MessageBase(), mitk::MessageBase< AbstractDelegate >::operator=(), mitk::MessageBase< AbstractDelegate >::RemoveListener(), and mitk::MessageBase< AbstractDelegate >::~MessageBase().
|
mutableprotected |
Definition at line 492 of file mitkMessage.h.
Referenced by mitk::MessageBase< AbstractDelegate >::AddListener(), and mitk::MessageBase< AbstractDelegate >::RemoveListener().