MeVisLab Toolbox Reference
ml::EventSource Class Reference

EventSourceBase class adds event listener handling to Base. More...

#include <mlEventSource.h>

Inheritance diagram for ml::EventSource:
ml::Base ml::RefCountedBase ml::AbstractItemModel ml::CSOList ml::CurveData ml::CurveList ml::DicomConfigurableMessageFilterBaseRefCounted ml::DicomTree ml::MultiFileVolumeListRefCounted ml::PCLBaseObject ml::SelectedClusters ml::VTKObjectWrapper ml::WEM

Public Member Functions

 EventSource ()
 
 EventSource (const EventSource &evSource)
 
 ~EventSource () override
 
void addEventListener (BaseEventCallback *cb, void *userData)
 add event listener callback to this Base object - the userData will be the first argument when the callback is called
 
void removeEventListener (BaseEventCallback *cb, void *userData)
 remove event listener callback from this Base object - arguments must be the same as for the addEventListener call
 
bool hasEventListeners () const
 check if any event listeners have been added to this Base object; this can be used to skip the sendEvent call (and the potentially expensive building of the event object) altogether
 
- Public Member Functions inherited from ml::Base
 Base ()
 Constructor.
 
virtual ~Base ()
 Destructor.
 
virtual BasedeepCopy () const
 Set addStateToTree version number that can be accessed via getAddStateVersion()
 
bool isOfAllowedType (const std::vector< const RuntimeType * > &types) const
 Check if this object's type is equal to or derived from one of the types given in the argument.
 
virtual bool isRefCountedBase () const
 Returns if the instance is derived from RefCountedBase.
 
virtual std::string detailString () const
 Return a string describing this object.
 
virtual bool implementsPersistence (PersistenceInterface) const
 Override this method to declare which persistence interfaces are implemented by your derived class.
 
virtual std::string persistentState () const
 Returns a string describing the object's internal state.
 
virtual void setPersistentState (const std::string &state)
 Restores the object's internal state from a string that had been previously generated using persistentState().
 
virtual void addStateToTree (TreeNode *) const
 Attaches the object state as children of the given parent node.
 
virtual void readStateFromTree (TreeNode *)
 Reads the object state from the children of the given parent node.
 
virtual void writeTo (AbstractPersistenceOutputStream *) const
 Write the objects state to the data stream object.
 
virtual void readFrom (AbstractPersistenceInputStream *, int)
 Read the objects state from the data stream object.
 

Protected Member Functions

void sendEvent (BaseEvent *event, void *skipListener=nullptr)
 Macro for the declaration of the runtime type system methods, defined in mlRuntimeSubClass.h.
 

Additional Inherited Members

- Public Types inherited from ml::Base
enum  PersistenceInterface { PersistenceByString , PersistenceByTreeNode , PersistenceByStream }
 This enum describes the different persistence interfaces available. More...
 

Detailed Description

EventSourceBase class adds event listener handling to Base.

Events are derived from BaseEvent.

Definition at line 30 of file mlEventSource.h.

Constructor & Destructor Documentation

◆ EventSource() [1/2]

ml::EventSource::EventSource ( )

◆ EventSource() [2/2]

ml::EventSource::EventSource ( const EventSource & evSource)

◆ ~EventSource()

ml::EventSource::~EventSource ( )
override

Member Function Documentation

◆ addEventListener()

void ml::EventSource::addEventListener ( BaseEventCallback * cb,
void * userData )

add event listener callback to this Base object - the userData will be the first argument when the callback is called

◆ hasEventListeners()

bool ml::EventSource::hasEventListeners ( ) const

check if any event listeners have been added to this Base object; this can be used to skip the sendEvent call (and the potentially expensive building of the event object) altogether

◆ removeEventListener()

void ml::EventSource::removeEventListener ( BaseEventCallback * cb,
void * userData )

remove event listener callback from this Base object - arguments must be the same as for the addEventListener call

◆ sendEvent()

void ml::EventSource::sendEvent ( BaseEvent * event,
void * skipListener = nullptr )
protected

Macro for the declaration of the runtime type system methods, defined in mlRuntimeSubClass.h.

pass event object to all registered listeners, ownership stays with the sender (so you can create the event object on the stack). If skipListener is set to a non-NULL value, the event will not be sent to any listeners that have the same userData set, so you can avoid to be notified of your own changes.


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