MeVisLab Toolbox Reference
|
EventSourceBase class adds event listener handling to Base. More...
#include <mlEventSource.h>
Public Member Functions | |
EventSource () | |
EventSource (const EventSource &evSource) | |
~EventSource () override | |
void | addEventListener (BaseEventCallback *cb, void *userData) |
Adds event listener callback to this Base object. More... | |
void | removeEventListener (BaseEventCallback *cb, void *userData) |
Removes event listener callback from this Base object. More... | |
bool | hasEventListeners () const |
Checks whether 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. More... | |
![]() | |
Base () | |
Constructor. More... | |
virtual | ~Base () |
Destructor. More... | |
virtual Base * | deepCopy () const |
Creates a deep copy of the given object. More... | |
bool | isOfAllowedType (const std::vector< const RuntimeType * > &types) const |
Checks whether this object's type is equal to or derived from one of the types given in the argument. More... | |
virtual bool | isRefCountedBase () const |
Returns whether the instance is derived from RefCountedBase. More... | |
virtual std::string | detailString () const |
Returns a string describing this object. More... | |
virtual bool | implementsPersistence (PersistenceInterface) const |
Override this method to declare which persistence interfaces are implemented by your derived class. More... | |
virtual std::string | persistentState () const |
Returns a string describing the object's internal state. More... | |
virtual void | setPersistentState (const std::string &state) |
Restores the object's internal state from a string that had been previously generated using persistentState(). More... | |
virtual void | addStateToTree (TreeNode *) const |
Attaches the object state as children of the given parent node. More... | |
virtual void | readStateFromTree (TreeNode *) |
Reads the object state from the children of the given parent node. More... | |
virtual void | writeTo (AbstractPersistenceOutputStream *) const |
Writes the objects state to the data stream object. More... | |
virtual void | readFrom (AbstractPersistenceInputStream *, int) |
Reads the objects state from the data stream object. More... | |
Protected Member Functions | |
void | sendEvent (BaseEvent *event, void *skipListener=nullptr) |
Macro for the declaration of the runtime type system methods, defined in mlRuntimeSubClass.h. More... | |
Additional Inherited Members | |
![]() | |
enum | PersistenceInterface { PersistenceByString , PersistenceByTreeNode , PersistenceByStream } |
This enum describes the different persistence interfaces available. More... | |
EventSourceBase class adds event listener handling to Base.
Events are derived from BaseEvent.
Definition at line 30 of file mlEventSource.h.
ml::EventSource::EventSource | ( | ) |
ml::EventSource::EventSource | ( | const EventSource & | evSource | ) |
|
override |
void ml::EventSource::addEventListener | ( | BaseEventCallback * | cb, |
void * | userData | ||
) |
Adds event listener callback to this Base object.
The userData will be the first argument when the callback is called.
bool ml::EventSource::hasEventListeners | ( | ) | const |
Checks whether 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.
void ml::EventSource::removeEventListener | ( | BaseEventCallback * | cb, |
void * | userData | ||
) |
Removes event listener callback from this Base object.
Arguments must be the same as for the addEventListener call.
|
protected |
Macro for the declaration of the runtime type system methods, defined in mlRuntimeSubClass.h.
Passes event object to all registered listeners, ownership stays with the sender. This way, 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. This way, you can avoid to be notified of your own changes.