![]() |
An open-source, flexible 3D physical simulation framework
|
Central class of the DataBroker library. More...
#include <DataBroker.h>
Public Member Functions | |
DataBroker (lib_manager::LibManager *theManager) | |
virtual | ~DataBroker () |
bool | createTimer (const std::string &timerName) |
creates a new timer with the given name More... | |
bool | stepTimer (const std::string &timerName, long step=1) |
bool | registerTimedReceiver (ReceiverInterface *receiver, const std::string &groupName, const std::string &dataName, const std::string &timerName, int updatePeriod, int callbackParam=0) |
registers a receiver for a group/data with a timer More... | |
bool | unregisterTimedReceiver (ReceiverInterface *receiver, const std::string &groupName, const std::string &dataName, const std::string &timerName) |
unregister a receiver from receiving callbacks from a timer for certain group/data More... | |
bool | registerTimedProducer (ProducerInterface *producer, const std::string &groupName, const std::string &dataName, const std::string &timerName, int updatePeriod, int callbackParam=0) |
bool | unregisterTimedProducer (ProducerInterface *producer, const std::string &groupName, const std::string &dataName, const std::string &timerName) |
bool | createTrigger (const std::string &triggerName) |
create a new trigger with the given name More... | |
bool | trigger (const std::string &triggerName) |
triggers the trigger triggerName More... | |
bool | registerTriggeredReceiver (ReceiverInterface *receiver, const std::string &groupName, const std::string &dataName, const std::string &triggerName, int callbackParam=0) |
registers a receiver for a group/data with a trigger More... | |
bool | unregisterTriggeredReceiver (ReceiverInterface *receiver, const std::string &groupName, const std::string &dataName, const std::string &triggerName) |
register a receiver from receiving callbacks from a trigger for certain group/data More... | |
bool | registerSyncReceiver (ReceiverInterface *receiver, const std::string &groupName, const std::string &dataName, int callbackParam=0) |
register a receiver to receive a synchronous callback for a certain stream More... | |
bool | unregisterSyncReceiver (ReceiverInterface *receiver, const std::string &groupName, const std::string &dataName) |
unregister a receiver from receiving callbacks for certain group/data More... | |
bool | registerAsyncReceiver (ReceiverInterface *receiver, const std::string &groupName, const std::string &dataName, int callbackParam=0) |
register a receiver to receive a asynchronous callback for a certain stream More... | |
bool | unregisterAsyncReceiver (ReceiverInterface *receiver, const std::string &groupName, const std::string &dataName) |
unregister a receiver from receiving callbacks for certain group/data More... | |
unsigned long | pushData (const std::string &groupName, const std::string &dataName, const DataPackage &dataPackage, const ReceiverInterface *producer, PackageFlag flags) |
pushes a DataPackage into the DataBroker More... | |
unsigned long | pushData (unsigned long id, const DataPackage &dataPackage, const ReceiverInterface *producer=NULL) |
pushes a DataPackage into the DataBroker More... | |
unsigned long | getDataID (const std::string &groupName, const std::string &dataName) const |
get the unique dataId assosiated with a given groupName and dataName More... | |
const DataInfo | getDataInfo (const std::string &groupName, const std::string &dataName) const |
get the DataInfo assosiated with a certain DataPackage More... | |
const DataPackage | getDataPackage (unsigned long id) const |
get the DataPackage with a given dataId More... | |
const std::vector< DataInfo > | getDataList (PackageFlag flag) const |
get a list of all DataInfo items currently in the DataBroker More... | |
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) |
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) |
void | disconnectDataItems (const std::string &toGroupName, const std::string &toDataName, const std::string &toItemName) |
void | run (void) |
The thread will execute this method once it has been started . More... | |
void | runRealtime (void) |
void | setThreadStopped (bool val) |
void | setRTThreadStopped (bool val) |
void | lockRealtimeMutex () |
void | unlockRealtimeMutex () |
virtual void | pushMessage (MessageType messageType, const std::string &format, va_list args) |
virtual void | pushMessage (MessageType messageType, const std::string &format,...) |
virtual void | pushFatal (const std::string &format,...) |
virtual void | pushError (const std::string &format,...) |
virtual void | pushWarning (const std::string &format,...) |
virtual void | pushInfo (const std::string &format,...) |
virtual void | pushDebug (const std::string &format,...) |
![]() | |
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 () | |
![]() | |
LibInterface (LibManager *theManager) | |
virtual | ~LibInterface (void) |
ModuleInfo | getModuleInfo () const |
virtual void | newLibLoaded (const std::string &libName) |
virtual void | createModuleInfo (void) |
![]() | |
Thread () | |
virtual | ~Thread () |
void | start () |
Starts the execution of this Thread. More... | |
void | cancel (bool block=false) |
Tries to cancel the Thread. More... | |
void | setCancellationPoint () |
Adds a cancellation point to your run method. More... | |
bool | wait () |
stops execution until the thread has finished. More... | |
bool | join () |
bool | wait (unsigned long timeoutMilliseconds) |
puts the Thread to sleep for a specified amount of time. More... | |
bool | isRunning () const |
returns true if the Thread is running. More... | |
bool | isFinished () const |
void | setStackSize (std::size_t stackSize) |
std::size_t | getStackSize () const |
bool | isCurrentThread () const |
Private Member Functions | |
DataElement * | createDataElement (const std::string &groupName, const std::string &dataName, PackageFlag flags) |
void | publishDataElement (const DataElement *element) |
void | updatePendingRegistrations (DataElement *newElement) |
unsigned long | createId () |
DataElement * | getElement (const std::string &groupName, const std::string &dataName) const |
void | getElementsByName (const std::string &groupName, const std::string &dataName, std::vector< DataElement *> *elements) const |
Get all DataElements that match groupName and dataName. More... | |
Additional Inherited Members | |
![]() | |
static Thread * | getCurrentThread () |
static void | cancelAll (bool block=false) |
![]() | |
static void | msleep (unsigned long msec) |
causes the current thread to sleep for More... | |
![]() | |
LibManager * | libManager |
ModuleInfo | moduleInfo |
Central class of the DataBroker library.
Definition at line 150 of file DataBroker.h.
mars::data_broker::DataBroker::DataBroker | ( | lib_manager::LibManager * | theManager | ) |
Definition at line 92 of file DataBroker.cpp.
|
virtual |
Definition at line 138 of file DataBroker.cpp.
|
virtual |
Implements mars::data_broker::DataBrokerInterface.
Definition at line 1337 of file DataBroker.cpp.
|
private |
Definition at line 1171 of file DataBroker.cpp.
|
private |
Definition at line 1165 of file DataBroker.cpp.
|
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. Implements mars::data_broker::DataBrokerInterface.
Definition at line 206 of file DataBroker.cpp.
|
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. Implements mars::data_broker::DataBrokerInterface.
Definition at line 623 of file DataBroker.cpp.
|
virtual |
Implements mars::data_broker::DataBrokerInterface.
Definition at line 1381 of file DataBroker.cpp.
|
virtual |
Implements mars::data_broker::DataBrokerInterface.
Definition at line 1423 of file DataBroker.cpp.
|
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. |
Implements mars::data_broker::DataBrokerInterface.
Definition at line 1139 of file DataBroker.cpp.
|
virtual |
get the DataInfo assosiated with a certain DataPackage
groupName | The DataInfo::groupName of the DataPackage |
dataName | The DataInfo::dataName of the DataPackage |
Implements mars::data_broker::DataBrokerInterface.
Definition at line 1152 of file DataBroker.cpp.
|
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. |
Implements mars::data_broker::DataBrokerInterface.
Definition at line 1110 of file DataBroker.cpp.
|
virtual |
get the DataPackage with a given dataId
dataId | The unique DataInfo::dataId of the DataPackage to return. |
Implements mars::data_broker::DataBrokerInterface.
Definition at line 1124 of file DataBroker.cpp.
|
private |
|
private |
Get all DataElements that match groupName and dataName.
They may contain wildcards.
Definition at line 1314 of file DataBroker.cpp.
|
inline |
Definition at line 255 of file DataBroker.h.
|
private |
Definition at line 1190 of file DataBroker.cpp.
|
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.
Implements mars::data_broker::DataBrokerInterface.
Definition at line 891 of file DataBroker.cpp.
|
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.
Implements mars::data_broker::DataBrokerInterface.
Definition at line 915 of file DataBroker.cpp.
|
virtual |
Implements mars::data_broker::DataBrokerInterface.
Definition at line 1029 of file DataBroker.cpp.
|
virtual |
Implements mars::data_broker::DataBrokerInterface.
Definition at line 1008 of file DataBroker.cpp.
|
virtual |
Implements mars::data_broker::DataBrokerInterface.
Definition at line 1001 of file DataBroker.cpp.
|
virtual |
Implements mars::data_broker::DataBrokerInterface.
Definition at line 1022 of file DataBroker.cpp.
|
virtual |
Implements mars::data_broker::DataBrokerInterface.
Definition at line 983 of file DataBroker.cpp.
|
virtual |
Implements mars::data_broker::DataBrokerInterface.
Definition at line 993 of file DataBroker.cpp.
|
virtual |
Implements mars::data_broker::DataBrokerInterface.
Definition at line 1015 of file DataBroker.cpp.
|
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.
Implements mars::data_broker::DataBrokerInterface.
Definition at line 827 of file DataBroker.cpp.
|
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.
Implements mars::data_broker::DataBrokerInterface.
Definition at line 763 of file DataBroker.cpp.
|
virtual |
Implements mars::data_broker::DataBrokerInterface.
Definition at line 525 of file DataBroker.cpp.
|
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. Implements mars::data_broker::DataBrokerInterface.
Definition at line 421 of file DataBroker.cpp.
|
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. Implements mars::data_broker::DataBrokerInterface.
Definition at line 687 of file DataBroker.cpp.
|
virtual |
The thread will execute this method once it has been started .
Implements mars::utils::Thread.
Definition at line 1047 of file DataBroker.cpp.
void mars::data_broker::DataBroker::runRealtime | ( | void | ) |
Definition at line 1036 of file DataBroker.cpp.
|
inline |
Definition at line 251 of file DataBroker.h.
|
inline |
Definition at line 250 of file DataBroker.h.
|
virtual |
Implements mars::data_broker::DataBrokerInterface.
Definition at line 288 of file DataBroker.cpp.
|
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.
Implements mars::data_broker::DataBrokerInterface.
Definition at line 661 of file DataBroker.cpp.
|
inline |
Definition at line 258 of file DataBroker.h.
|
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 reasonsImplements mars::data_broker::DataBrokerInterface.
Definition at line 850 of file DataBroker.cpp.
|
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 reasonsImplements mars::data_broker::DataBrokerInterface.
Definition at line 786 of file DataBroker.cpp.
|
virtual |
Implements mars::data_broker::DataBrokerInterface.
Definition at line 575 of file DataBroker.cpp.
|
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 reasonsImplements mars::data_broker::DataBrokerInterface.
Definition at line 473 of file DataBroker.cpp.
|
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 reasonsImplements mars::data_broker::DataBrokerInterface.
Definition at line 713 of file DataBroker.cpp.
|
private |
Definition at line 1208 of file DataBroker.cpp.
|
private |
Definition at line 311 of file DataBroker.h.
|
private |
Definition at line 313 of file DataBroker.h.
|
mutableprivate |
Definition at line 314 of file DataBroker.h.
|
private |
Definition at line 300 of file DataBroker.h.
|
private |
Definition at line 323 of file DataBroker.h.
|
private |
Definition at line 297 of file DataBroker.h.
|
private |
Definition at line 306 of file DataBroker.h.
|
private |
Definition at line 318 of file DataBroker.h.
|
private |
Definition at line 307 of file DataBroker.h.
|
private |
Definition at line 308 of file DataBroker.h.
|
private |
Definition at line 309 of file DataBroker.h.
|
private |
Definition at line 310 of file DataBroker.h.
|
private |
Definition at line 324 of file DataBroker.h.
|
private |
Definition at line 301 of file DataBroker.h.
|
private |
Definition at line 299 of file DataBroker.h.
|
private |
Definition at line 303 of file DataBroker.h.
|
private |
Definition at line 304 of file DataBroker.h.
|
private |
Definition at line 302 of file DataBroker.h.
|
private |
Definition at line 303 of file DataBroker.h.
|
private |
Definition at line 298 of file DataBroker.h.
|
private |
Definition at line 302 of file DataBroker.h.
|
private |
Definition at line 322 of file DataBroker.h.
|
private |
Definition at line 315 of file DataBroker.h.
|
private |
Definition at line 312 of file DataBroker.h.
|
private |
Definition at line 316 of file DataBroker.h.
|
private |
Definition at line 294 of file DataBroker.h.
|
private |
Definition at line 295 of file DataBroker.h.
|
private |
Definition at line 317 of file DataBroker.h.
|
private |
Definition at line 320 of file DataBroker.h.
|
private |
Definition at line 321 of file DataBroker.h.