#include <mitkMessage.h>
Public Types | |
typedef Message3 | Self |
typedef MessageAbstractDelegate3< T, U, V, A > | AbstractDelegate |
typedef std::vector < AbstractDelegate * > | ListenerList |
Public Member Functions | |
~Message3 () | |
void | AddListener (const AbstractDelegate &delegate) const |
void | operator+= (const AbstractDelegate &delegate) const |
void | RemoveListener (const AbstractDelegate &delegate) const |
void | operator-= (const AbstractDelegate &delegate) const |
void | Send (T t, U u, V v) |
void | operator() (T t, U u, V v) |
const ListenerList & | GetListeners () const |
bool | HasListeners () const |
bool | IsEmpty () const |
Protected Attributes | |
ListenerList | m_Listeners |
itk::SimpleFastMutexLock | m_Mutex |
Definition at line 857 of file mitkMessage.h.
typedef MessageAbstractDelegate3<T,U,V,A> mitk::Message3< T, U, V, A >::AbstractDelegate |
Definition at line 862 of file mitkMessage.h.
typedef std::vector<AbstractDelegate* > mitk::Message3< T, U, V, A >::ListenerList |
Definition at line 863 of file mitkMessage.h.
typedef Message3 mitk::Message3< T, U, V, A >::Self |
Definition at line 861 of file mitkMessage.h.
mitk::Message3< T, U, V, A >::~Message3 | ( | ) | [inline] |
Definition at line 865 of file mitkMessage.h.
References mitk::Message3< T, U, V, A >::m_Listeners.
{ for (typename ListenerList::iterator iter = m_Listeners.begin(); iter != m_Listeners.end(); ++iter ) { delete *iter; } }
void mitk::Message3< T, U, V, A >::AddListener | ( | const AbstractDelegate & | delegate ) | const [inline] |
Definition at line 873 of file mitkMessage.h.
References mitk::MessageAbstractDelegate3< T, U, V, A >::Clone(), mitk::Message3< T, U, V, A >::m_Listeners, and mitk::Message3< T, U, V, A >::m_Mutex.
Referenced by mitk::Message3< T, U, V, A >::operator+=().
{ AbstractDelegate* msgCmd = delegate.Clone(); m_Mutex.Lock(); for (typename ListenerList::iterator iter = m_Listeners.begin(); iter != m_Listeners.end(); ++iter ) { if ((*iter)->operator==(msgCmd)) { delete msgCmd; m_Mutex.Unlock(); return; } } m_Listeners.push_back(msgCmd); m_Mutex.Unlock(); }
const ListenerList& mitk::Message3< T, U, V, A >::GetListeners | ( | ) | const [inline] |
Definition at line 944 of file mitkMessage.h.
References mitk::Message3< T, U, V, A >::m_Listeners.
{ return m_Listeners; }
bool mitk::Message3< T, U, V, A >::HasListeners | ( | ) | const [inline] |
Definition at line 949 of file mitkMessage.h.
References mitk::Message3< T, U, V, A >::m_Listeners.
{ return !m_Listeners.empty(); }
bool mitk::Message3< T, U, V, A >::IsEmpty | ( | ) | const [inline] |
Definition at line 954 of file mitkMessage.h.
References mitk::Message3< T, U, V, A >::m_Listeners.
{ return m_Listeners.empty(); }
void mitk::Message3< T, U, V, A >::operator() | ( | T | t, |
U | u, | ||
V | v | ||
) | [inline] |
Definition at line 939 of file mitkMessage.h.
References mitk::Message3< T, U, V, A >::Send().
void mitk::Message3< T, U, V, A >::operator+= | ( | const AbstractDelegate & | delegate ) | const [inline] |
Definition at line 892 of file mitkMessage.h.
References mitk::Message3< T, U, V, A >::AddListener().
{ this->AddListener(delegate); }
void mitk::Message3< T, U, V, A >::operator-= | ( | const AbstractDelegate & | delegate ) | const [inline] |
Definition at line 915 of file mitkMessage.h.
References mitk::Message3< T, U, V, A >::RemoveListener().
{ this->RemoveListener(delegate); }
void mitk::Message3< T, U, V, A >::RemoveListener | ( | const AbstractDelegate & | delegate ) | const [inline] |
Definition at line 897 of file mitkMessage.h.
References mitk::Message3< T, U, V, A >::m_Listeners, and mitk::Message3< T, U, V, A >::m_Mutex.
Referenced by mitk::Message3< T, U, V, A >::operator-=().
{ m_Mutex.Lock(); for (typename ListenerList::iterator iter = m_Listeners.begin(); iter != m_Listeners.end(); ++iter ) { if ((*iter)->operator==(&delegate)) { delete *iter; m_Listeners.erase( iter ); m_Mutex.Unlock(); return; } } m_Mutex.Unlock(); }
void mitk::Message3< T, U, V, A >::Send | ( | T | t, |
U | u, | ||
V | v | ||
) | [inline] |
Definition at line 920 of file mitkMessage.h.
References mitk::Message3< T, U, V, A >::m_Listeners, and mitk::Message3< T, U, V, A >::m_Mutex.
Referenced by mitk::Message3< T, U, V, A >::operator()().
{ ListenerList listeners; { m_Mutex.Lock(); listeners.assign(m_Listeners.begin(), m_Listeners.end()); m_Mutex.Unlock(); } for ( typename ListenerList::iterator iter = listeners.begin(); iter != listeners.end(); ++iter ) { // notify each listener (*iter)->Execute(t,u,v); } }
ListenerList mitk::Message3< T, U, V, A >::m_Listeners [mutable, protected] |
Definition at line 961 of file mitkMessage.h.
Referenced by mitk::Message3< T, U, V, A >::AddListener(), mitk::Message3< T, U, V, A >::GetListeners(), mitk::Message3< T, U, V, A >::HasListeners(), mitk::Message3< T, U, V, A >::IsEmpty(), mitk::Message3< T, U, V, A >::RemoveListener(), mitk::Message3< T, U, V, A >::Send(), and mitk::Message3< T, U, V, A >::~Message3().
itk::SimpleFastMutexLock mitk::Message3< T, U, V, A >::m_Mutex [mutable, protected] |
Definition at line 962 of file mitkMessage.h.
Referenced by mitk::Message3< T, U, V, A >::AddListener(), mitk::Message3< T, U, V, A >::RemoveListener(), and mitk::Message3< T, U, V, A >::Send().