![]() |
An open-source, flexible 3D physical simulation framework
|
The interface every DataBroker should implement. More...
#include <DataBrokerInterface.h>
Public Member Functions | |
DataBrokerInterface (lib_manager::LibManager *theManager) | |
Constructor takes no arguments. More... | |
virtual | ~DataBrokerInterface () |
virtual int | getLibVersion () const |
virtual const std::string | getLibName () const |
CREATE_MODULE_INFO () | |
virtual bool | createTimer (const std::string &timerName)=0 |
creates a new timer with the given name More... | |
virtual bool | stepTimer (const std::string &timerName, long step=1)=0 |
advances the timer timerName by step More... | |
virtual bool | registerTimedReceiver (ReceiverInterface *receiver, const std::string &groupName, const std::string &dataName, const std::string &timerName, int updatePeriod, int callbackParam=0)=0 |
registers a receiver for a group/data with a timer More... | |
virtual bool | unregisterTimedReceiver (ReceiverInterface *receiver, const std::string &groupName, const std::string &dataName, const std::string &timerName)=0 |
unregister a receiver from receiving callbacks from a timer for certain group/data More... | |
virtual bool | registerTimedProducer (ProducerInterface *producer, const std::string &groupName, const std::string &dataName, const std::string &timerName, int updatePeriod, int callbackParam=0)=0 |
virtual bool | unregisterTimedProducer (ProducerInterface *producer, const std::string &groupName, const std::string &dataName, const std::string &timerName)=0 |
virtual bool | createTrigger (const std::string &triggerName)=0 |
create a new trigger with the given name More... | |
virtual bool | trigger (const std::string &triggerName)=0 |
triggers the trigger triggerName More... | |
virtual bool | registerTriggeredReceiver (ReceiverInterface *receiver, const std::string &groupName, const std::string &dataName, const std::string &triggerName, int callbackParam=0)=0 |
registers a receiver for a group/data with a trigger More... | |
virtual bool | unregisterTriggeredReceiver (ReceiverInterface *receiver, const std::string &groupName, const std::string &dataName, const std::string &triggerName)=0 |
register a receiver from receiving callbacks from a trigger for certain group/data More... | |
virtual bool | registerSyncReceiver (ReceiverInterface *receiver, const std::string &groupName, const std::string &dataName, int callbackParam=0)=0 |
register a receiver to receive a synchronous callback for a certain stream More... | |
virtual bool | unregisterSyncReceiver (ReceiverInterface *receiver, const std::string &groupName, const std::string &dataName)=0 |
unregister a receiver from receiving callbacks for certain group/data More... | |
virtual bool | registerAsyncReceiver (ReceiverInterface *receiver, const std::string &groupName, const std::string &dataName, int callbackParam=0)=0 |
register a receiver to receive a asynchronous callback for a certain stream More... | |
virtual bool | unregisterAsyncReceiver (ReceiverInterface *receiver, const std::string &groupName, const std::string &dataName)=0 |
unregister a receiver from receiving callbacks for certain group/data More... | |
virtual unsigned long | pushData (const std::string &groupName, const std::string &dataName, const DataPackage &dataPackage, const ReceiverInterface *producer, PackageFlag flags)=0 |
pushes a DataPackage into the DataBroker More... | |
virtual unsigned long | pushData (unsigned long id, const DataPackage &dataPackage, const ReceiverInterface *producer=NULL)=0 |
pushes a DataPackage into the DataBroker More... | |
virtual unsigned long | getDataID (const std::string &groupName, const std::string &dataName) const =0 |
get the unique dataId assosiated with a given groupName and dataName More... | |
virtual const DataInfo | getDataInfo (const std::string &groupName, const std::string &dataName) const =0 |
get the DataInfo assosiated with a certain DataPackage More... | |
virtual const DataPackage | getDataPackage (unsigned long dataId) const =0 |
get the DataPackage with a given dataId More... | |
virtual const std::vector< DataInfo > | getDataList (PackageFlag flag=DATA_PACKAGE_NO_FLAG) const =0 |
get a list of all DataInfo items currently in the DataBroker More... | |
virtual void | connectDataItems (const std::string &fromGroupName, const std::string &fromDataName, const std::string &fromItemName, const std::string &toGroupName, const std::string &toDataName, const std::string &toItemName)=0 |
virtual void | disconnectDataItems (const std::string &fromGroupName, const std::string &fromDataName, const std::string &fromItemName, const std::string &toGroupName, const std::string &toDataName, const std::string &toItemName)=0 |
virtual void | disconnectDataItems (const std::string &toGroupName, const std::string &toDataName, const std::string &toItemName)=0 |
virtual void | pushMessage (MessageType messageType, const std::string &format, va_list args)=0 |
virtual void | pushMessage (MessageType messageType, const std::string &format,...)=0 |
virtual void | pushFatal (const std::string &format,...)=0 |
virtual void | pushError (const std::string &format,...)=0 |
virtual void | pushWarning (const std::string &format,...)=0 |
virtual void | pushInfo (const std::string &format,...)=0 |
virtual void | pushDebug (const std::string &format,...)=0 |
![]() | |
LibInterface (LibManager *theManager) | |
virtual | ~LibInterface (void) |
ModuleInfo | getModuleInfo () const |
virtual void | newLibLoaded (const std::string &libName) |
virtual void | createModuleInfo (void) |
Additional Inherited Members | |
![]() | |
LibManager * | libManager |
ModuleInfo | moduleInfo |
The interface every DataBroker should implement.
Definition at line 105 of file DataBrokerInterface.h.
|
inline |
Constructor takes no arguments.
Definition at line 111 of file DataBrokerInterface.h.
|
inlinevirtual |
Definition at line 114 of file DataBrokerInterface.h.
|
pure virtual |
Implemented in mars::data_broker::DataBroker.
mars::data_broker::DataBrokerInterface::CREATE_MODULE_INFO | ( | ) |
|
pure virtual |
creates a new timer with the given name
timerName | the name of the new timer |
false
if a timer with the given name already exists. true
otherwise. Implemented in mars::data_broker::DataBroker.
|
pure virtual |
create a new trigger with the given name
triggerName | the name of the new trigger |
false
if a trigger with the given name already exists. true
otherwise. Implemented in mars::data_broker::DataBroker.
|
pure virtual |
Implemented in mars::data_broker::DataBroker.
|
pure virtual |
Implemented in mars::data_broker::DataBroker.
|
pure virtual |
get the unique dataId assosiated with a given groupName and dataName
groupName | The DataInfo::groupName of the DataPackage. |
dataName | The DataInfo::dataName of the DataPackage. |
Implemented in mars::data_broker::DataBroker.
|
pure virtual |
get the DataInfo assosiated with a certain DataPackage
groupName | The DataInfo::groupName of the DataPackage |
dataName | The DataInfo::dataName of the DataPackage |
Implemented in mars::data_broker::DataBroker.
|
pure virtual |
get a list of all DataInfo items currently in the DataBroker
flag | A bitmask to filter out what kind of DataPackages we are interested in. |
Implemented in mars::data_broker::DataBroker.
|
pure virtual |
get the DataPackage with a given dataId
dataId | The unique DataInfo::dataId of the DataPackage to return. |
Implemented in mars::data_broker::DataBroker.
|
inlinevirtual |
Implements lib_manager::LibInterface.
Definition at line 119 of file DataBrokerInterface.h.
|
inlinevirtual |
Implements lib_manager::LibInterface.
Definition at line 117 of file DataBrokerInterface.h.
|
pure virtual |
pushes a DataPackage into the DataBroker
groupName | A string to identify different DataPackages belonging to the same group or category. The combination of groupName and dataName should be unique. |
dataName | A string to to identify this DataPackage. The combination of groupName and dataName should be unique. |
dataPackage | The DataPackage that will be distributed to the receivers. |
producer | In case a receiver pushes data to the stream it has registered itself to, it normally would get a callback. To prevent this self-callback it may pass pointer to itself to prevent receiving a callback for this single push it did itself. If NULL is passed this has no effect. |
flags | This is used to indicate the nature of the data. |
An object that regularly pushes data to the DataBroker should only use this method once and record the returned pushId. Subsequently it should use the pushId and call pushData(unsigned long,...) for better performance.
Implemented in mars::data_broker::DataBroker.
|
pure virtual |
pushes a DataPackage into the DataBroker
id | The pushId previously returned by this method. |
dataPackage | The DataPackage that will be distributed to the receivers. |
producer | In case a receiver pushes data to the stream it has registered itself to, it normally would get a callback. To prevent this self-callback it may pass pointer to itself to prevent receiving a callback for this single push it did itself. If NULL is passed this has no effect. |
An object that regularly pushes data to the DataBroker should use the named version of this method once and record the returned pushId. Subsequently it should use the pushId and call this method for better performance.
Implemented in mars::data_broker::DataBroker.
|
pure virtual |
Implemented in mars::data_broker::DataBroker.
|
pure virtual |
Implemented in mars::data_broker::DataBroker.
|
pure virtual |
Implemented in mars::data_broker::DataBroker.
|
pure virtual |
Implemented in mars::data_broker::DataBroker.
|
pure virtual |
Implemented in mars::data_broker::DataBroker.
|
pure virtual |
Implemented in mars::data_broker::DataBroker.
|
pure virtual |
Implemented in mars::data_broker::DataBroker.
|
pure virtual |
register a receiver to receive a asynchronous callback for a certain stream
receiver | The ReceiverInterface that should be called whenever a certain stream is pushed to the DataBroker. |
groupName | The groupName of the DataPackage the receiver is interested in. |
dataName | The dataName of the DataPackage the receiver is interested in. |
callbackParam | An optional int that will be passed back to the receiver in receiveData. This can be used by the receiver to distinguish callbacks from different registrations. |
true
if the registration was successful. false
if no DataPackage with the given groupName and dataName exists. This doesn't necessarily indicate an error. The registration will be cached and may be performed when the requested DataPackage is pushed at a later time.The callbacks to the receivers will be performed asynchronous by the DataBroker. This means that the callback will occur from a different thread as the one from which pushData was called. The receivers will only get a callback for the latest pushData call. This means that asynchronous receivers might miss some DataPackages when they are pushed fast to the DataBroker. If you cannot afford to miss DataPackages you should use registerSyncReceiver.
Implemented in mars::data_broker::DataBroker.
|
pure virtual |
register a receiver to receive a synchronous callback for a certain stream
receiver | The ReceiverInterface that should be called whenever a certain stream is pushed to the DataBroker. |
groupName | The groupName of the DataPackage the receiver is interested in. |
dataName | The dataName of the DataPackage the receiver is interested in. |
callbackParam | An optional int that will be passed back to the receiver in receiveData. This can be used by the receiver to distinguish callbacks from different registrations. |
true
if the registration was successful. false
if no DataPackage with the given groupName and dataName exists. This doesn't necessarily indicate an error. The registration will be cached and may be performed when the requested DataPackage is pushed at a later time.The callbacks to the receivers will be performed synchronous by the DataBroker. This means that the callback will occur from within the same thread where the pushData happened and the call to pushData will not return until all receivers that registered to this stream were called and returned from their callbacks.
Implemented in mars::data_broker::DataBroker.
|
pure virtual |
Implemented in mars::data_broker::DataBroker.
|
pure virtual |
registers a receiver for a group/data with a timer
receiver | The ReceiverInterface that should be called back. |
groupName | The groupName of the DataPackage the receiver is interested in. |
dataName | The dataName of the DataPackage the receiver is interested in. |
timerName | The name of the timer that should call the receiver. |
updatePeriod | The number of timer steps that should lie between callbacks. If you pass 0 the receiver will be called back every time the timer is stepped. |
callbackParam | An optional int that will be passed back to the receiver in receiveData. This can be used by the receiver to distinguish callbacks from different registrations. |
false
if the timer timerName doesn't exist. true
otherwise. If this method returns false
this doesn't necessarily indicate an error. The registration will be cached in case the timer gets created at a later time. This is only intended as feedback in case you know the timer should exist. Implemented in mars::data_broker::DataBroker.
|
pure virtual |
registers a receiver for a group/data with a trigger
receiver | The ReceiverInterface that should be called back. |
groupName | The groupName of the DataPackage the receiver is intersted in. |
dataName | The dataName of the DataPackage the receiver is intersted in. |
triggerName | The name of the trigger that should call the receiver. |
callbackParam | An optional int that will be passed back to the receiver in receiveData. This can be used by the receiver to distinguish callbacks from different registrations. |
false
if the trigger triggerName doesn't exist. true
otherwise. If this method returns false
this doesn't necessarily indicate an error. The registration will be cached in case the trigger gets created at a later time. This is only intended as feedback in case you know the trigger should exist. Implemented in mars::data_broker::DataBroker.
|
pure virtual |
advances the timer timerName by step
timerName | The name of the timer that should be stepped. It should have been previously created with createTimer. |
step | The amount by which the timer should be stepped. This can be anything from the amount of seconds passed in real time to an artificial simulation time or something entirely different. It's up to you. |
true
if the timer was stepped. false
if no timer with the name timerName exists.Stepping a timer with this function will advance its internal time by the given step. It will then check all receivers who registered to this timer with registerTimedReceiver if their update time has expired in which case they will be called from within this thread.
Implemented in mars::data_broker::DataBroker.
|
pure virtual |
triggers the trigger triggerName
triggerName | The name of the trigger that should be triggered. It should have been previously created with createTrigger. |
true
if the trigger was triggered. false
if no trigger with the name triggerName exists.Triggering a trigger causes it to send the latest DataPackage to all receivers that registered to this trigger.
Implemented in mars::data_broker::DataBroker.
|
pure virtual |
unregister a receiver from receiving callbacks for certain group/data
receiver | The ReceiverInterface that wants to unregister. |
groupName | The groupName of the DataPackage for which the receiver no longer wishes to receive callbacks. |
dataName | The dataName of the DataPackage for which the receiver no longer wishes to receive callbacks. |
true
if the receiver successfully unregistered. false
otherwise. Returning false
could have several reasonsImplemented in mars::data_broker::DataBroker.
|
pure virtual |
unregister a receiver from receiving callbacks for certain group/data
receiver | The ReceiverInterface that wants to unregister. |
groupName | The groupName of the DataPackage for which the receiver no longer wishes to receive callbacks. |
dataName | The dataName of the DataPackage for which the receiver no longer wishes to receive callbacks. |
true
if the receiver successfully unregistered. false
otherwise. Returning false
could have several reasonsImplemented in mars::data_broker::DataBroker.
|
pure virtual |
Implemented in mars::data_broker::DataBroker.
|
pure virtual |
unregister a receiver from receiving callbacks from a timer for certain group/data
receiver | The ReceiverInterface that wants to unregister. |
groupName | The groupName of the DataPackage for which the receiver no longer wishes to receive callbacks from the timer. |
dataName | The dataName of the DataPackage for which the receiver no longer wishes to receive callbacks from the timer. |
timerName | The name of the timer that should stop notifying the receiver. |
true
if the receiver successfully unregistered. false
otherwise. Returning false
could have several reasonsImplemented in mars::data_broker::DataBroker.
|
pure virtual |
register a receiver from receiving callbacks from a trigger for certain group/data
receiver | The ReceiverInterface that wants to unregister. |
groupName | The groupName of the DataPackage for which the receiver no longer wishes to receive callbacks from the trigger. |
dataName | The dataName of the DataPackage for which the receiver no longer wishes to receive callbacks from the trigger. |
triggerName | The name of the trigger that should stop notifying the receiver. |
true
if the receiver successfully unregistered. false
otherwise. Returning false
could have several reasonsImplemented in mars::data_broker::DataBroker.