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 Slots | Public Member Functions | Static Public Member Functions | List of all members
ctkEventBus::ctkEventBusManager Class Reference

#include <Plugins/org.commontk.eventbus/ctkEventBusManager.h>

Inheritance diagram for ctkEventBus::ctkEventBusManager:
Inheritance graph
[legend]
Collaboration diagram for ctkEventBus::ctkEventBusManager:
Collaboration graph
[legend]

Public Slots

void detachObjectFromBus ()
 Intercepts objects deletation and detach them from the event bus. More...
 

Public Member Functions

bool addEventProperty (ctkBusEvent &props) const
 Add a new event property (observer or event) to the event bus hash. More...
 
bool createClient (const QString &communication_protocol, const QString &server_host, unsigned int port)
 Create the client for remote communication according to the given protocol, server host and port. More...
 
bool createServer (const QString &communication_protocol, unsigned int listen_port)
 Create the server for remote communication according to the given protocol and listen port. More...
 
void enableEventLogging (bool enable=true)
 Enable/Disable event logging to allow dumping events notification into the selected logging output stream. More...
 
void initializeNetworkConnectors ()
 initialize NetworkConnectors More...
 
bool isLocalSignalPresent (const QString topic) const
 Retrieve if the signal has been registered previously. More...
 
void logAllEvents ()
 When enabled, allows logging all events. It reset the value for m_LogEventId to -1 (the default) More...
 
void logEventTopic (const QString topic)
 When logging is enabled, allows logging events releted to specific id (require a valid topic). More...
 
void notifyEvent (const QString topic, ctkEventType ev_type=ctkEventTypeLocal, ctkEventArgumentsList *argList=NULL, QGenericReturnArgument *returnArg=NULL) const
 Notify event associated to the given id locally to the application. More...
 
void notifyEvent (ctkBusEvent &event_dictionary, ctkEventArgumentsList *argList=NULL, QGenericReturnArgument *returnArg=NULL) const
 Notify events associated to the given id locally to the application. More...
 
void plugNetworkConnector (const QString &protocol, ctkNetworkConnector *connector)
 Plug a new network connector into the connector hash for the given network protocol (protocol eg. "XMLRPC") (connector_type eg. "ctkEventBus::ctkNetworkConnectorQXMLRPC"). More...
 
bool removeEventProperty (ctkBusEvent &props) const
 Remove the event property from the event bus hash. More...
 
void removeObserver (const QObject *obj, const QString topic="", bool qt_disconnect=true)
 Remove the object passed as argument from the observer's hash. More...
 
void removeSignal (const QObject *obj, QString topic="", bool qt_disconnect=true)
 Remove the object passed as argument from the signal emitter's hash. More...
 
void shutdown ()
 Destroy the singleton instance. To be called at the end of the application. More...
 
void startListen ()
 Allow to start server listening. More...
 

Static Public Member Functions

static ctkEventBusManagerinstance ()
 Return an instance of the event bus. More...
 

Detailed Description

Class name: ctkEventBusManager This singletone provides the access point of the Communication Bus for MAF3 framework. ctkEventBusManager defines also the mafId maf.local.eventBus.globalUpdate to be used as generic update notification mechanism that the event bus can send to all the observers.

Definition at line 30 of file ctkEventBusManager.h.

Member Function Documentation

◆ addEventProperty()

bool ctkEventBus::ctkEventBusManager::addEventProperty ( ctkBusEvent props) const

Add a new event property (observer or event) to the event bus hash.

Return true if observer has beed added correctly, false otherwise. This method check before adding a new observer that it has not already been inserted into the events' Hash with the same id and callback signature.

◆ createClient()

bool ctkEventBus::ctkEventBusManager::createClient ( const QString &  communication_protocol,
const QString &  server_host,
unsigned int  port 
)

Create the client for remote communication according to the given protocol, server host and port.

◆ createServer()

bool ctkEventBus::ctkEventBusManager::createServer ( const QString &  communication_protocol,
unsigned int  listen_port 
)

Create the server for remote communication according to the given protocol and listen port.

◆ detachObjectFromBus

void ctkEventBus::ctkEventBusManager::detachObjectFromBus ( )
slot

Intercepts objects deletation and detach them from the event bus.

◆ enableEventLogging()

void ctkEventBus::ctkEventBusManager::enableEventLogging ( bool  enable = true)

Enable/Disable event logging to allow dumping events notification into the selected logging output stream.

◆ initializeNetworkConnectors()

void ctkEventBus::ctkEventBusManager::initializeNetworkConnectors ( )

initialize NetworkConnectors

◆ instance()

static ctkEventBusManager* ctkEventBus::ctkEventBusManager::instance ( )
static

Return an instance of the event bus.

◆ isLocalSignalPresent()

bool ctkEventBus::ctkEventBusManager::isLocalSignalPresent ( const QString  topic) const

Retrieve if the signal has been registered previously.

◆ logAllEvents()

void ctkEventBus::ctkEventBusManager::logAllEvents ( )

When enabled, allows logging all events. It reset the value for m_LogEventId to -1 (the default)

◆ logEventTopic()

void ctkEventBus::ctkEventBusManager::logEventTopic ( const QString  topic)

When logging is enabled, allows logging events releted to specific id (require a valid topic).

◆ notifyEvent() [1/2]

void ctkEventBus::ctkEventBusManager::notifyEvent ( const QString  topic,
ctkEventType  ev_type = ctkEventTypeLocal,
ctkEventArgumentsList argList = NULL,
QGenericReturnArgument *  returnArg = NULL 
) const

Notify event associated to the given id locally to the application.

◆ notifyEvent() [2/2]

void ctkEventBus::ctkEventBusManager::notifyEvent ( ctkBusEvent event_dictionary,
ctkEventArgumentsList argList = NULL,
QGenericReturnArgument *  returnArg = NULL 
) const

Notify events associated to the given id locally to the application.

◆ plugNetworkConnector()

void ctkEventBus::ctkEventBusManager::plugNetworkConnector ( const QString &  protocol,
ctkNetworkConnector connector 
)

Plug a new network connector into the connector hash for the given network protocol (protocol eg. "XMLRPC") (connector_type eg. "ctkEventBus::ctkNetworkConnectorQXMLRPC").

◆ removeEventProperty()

bool ctkEventBus::ctkEventBusManager::removeEventProperty ( ctkBusEvent props) const

Remove the event property from the event bus hash.

◆ removeObserver()

void ctkEventBus::ctkEventBusManager::removeObserver ( const QObject *  obj,
const QString  topic = "",
bool  qt_disconnect = true 
)

Remove the object passed as argument from the observer's hash.

This method allows to remove from the observer's hash the object passed as argument. If no topic is specified, the observer will be removed from all the topic it was listening, otherwise it will be disconnected only from the given topic.

◆ removeSignal()

void ctkEventBus::ctkEventBusManager::removeSignal ( const QObject *  obj,
QString  topic = "",
bool  qt_disconnect = true 
)

Remove the object passed as argument from the signal emitter's hash.

This method allows to remove from the signal emitter's hash the object passed as argument. If no topic is specified, the emitter will be removed from all the topic it was emitting signals, otherwise it will be removed only from the given topic.

◆ shutdown()

void ctkEventBus::ctkEventBusManager::shutdown ( )

Destroy the singleton instance. To be called at the end of the application.

◆ startListen()

void ctkEventBus::ctkEventBusManager::startListen ( )

Allow to start server listening.


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