CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Public Member Functions | List of all members
ctkEventHandler Struct Referenceabstract

#include <Libs/PluginFramework/service/event/ctkEventHandler.h>

Public Member Functions

virtual void handleEvent (const ctkEvent &event)=0
 
virtual ~ctkEventHandler ()
 

Detailed Description

Listener for Events.

ctkEventHandler objects are registered with the Framework service registry and are notified with an ctkEvent object when an event is sent or posted.

ctkEventHandler objects can inspect the received ctkEvent object to determine its topic and properties.

ctkEventHandler objects must be registered with a service property ctkEventConstants#EVENT_TOPIC whose value is the list of topics in which the event handler is interested.

For example:

QStringList topics("com/isv/&#42;");
props.insert(ctkEventConstants::EVENT_TOPIC, topics);
context->registerService<ctkEventHandler>(this, props);
static const QString EVENT_TOPIC

Event Handler services can also be registered with an ctkEventConstants#EVENT_FILTER service property to further filter the events. If the syntax of this filter is invalid, then the Event Handler must be ignored by the Event Admin service. The Event Admin service should log a warning.

Security Considerations. Plugins wishing to monitor ctkEvent objects will require ctkServicePermission[ctkEventHandler,REGISTER] to register a ctkEventHandler service. The plugin must also have ctkTopicPermission[topic,SUBSCRIBE] for the topic specified in the event in order to receive the event.

See also
ctkEvent
Remarks
This class is thread safe.

Definition at line 71 of file ctkEventHandler.h.

Constructor & Destructor Documentation

◆ ~ctkEventHandler()

virtual ctkEventHandler::~ctkEventHandler ( )
inlinevirtual

Definition at line 73 of file ctkEventHandler.h.

Member Function Documentation

◆ handleEvent()

virtual void ctkEventHandler::handleEvent ( const ctkEvent event)
pure virtual

Called by the ctkEventAdmin service to notify the listener of an event.

Parameters
eventThe event that occurred.

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