Privacy
An open-source, flexible 3D physical simulation framework
mars::data_broker::DataBroker Class Reference

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< DataInfogetDataList (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,...)
 
- Public Member Functions inherited from mars::data_broker::DataBrokerInterface
 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 ()
 
- Public Member Functions inherited from lib_manager::LibInterface
 LibInterface (LibManager *theManager)
 
virtual ~LibInterface (void)
 
ModuleInfo getModuleInfo () const
 
virtual void newLibLoaded (const std::string &libName)
 
virtual void createModuleInfo (void)
 
- Public Member Functions inherited from mars::utils::Thread
 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...
 

Private Attributes

std::set< DataElement * > * updatedElementsBackBuffer
 
std::set< DataElement * > * updatedElementsFrontBuffer
 
unsigned long next_id
 
pthread_t theThread
 
pthread_t realtimeThread
 
mars::utils::Mutex idMutex
 
mars::utils::Mutex realtimeMutex
 
bool thread_running
 
bool stop_thread
 
bool realtimeThreadRunning
 
bool stopRealtimeThread
 
bool startingRealtimeThread
 
LockableContainer< std::list< PendingRegistration > > pendingAsyncRegistrations
 
LockableContainer< std::list< PendingRegistration > > pendingSyncRegistrations
 
LockableContainer< std::list< PendingTimedProducer > > pendingTimedProducers
 
LockableContainer< std::list< PendingTimedRegistration > > pendingTimedRegistrations
 
std::list< PendingTriggeredRegistration > pendingTriggeredRegistrations
 
std::map< unsigned long, DataElement * > elementsById
 
std::map< std::string, Trigger > triggers
 
std::map< std::pair< std::string, std::string >, DataElement * > elementsByName
 
mars::utils::ReadWriteLock elementsLock
 
mars::utils::ReadWriteLock timersLock
 
mars::utils::ReadWriteLock triggersLock
 
mars::utils::Mutex updatedElementsLock
 
mars::utils::Mutex pendingRegistrationLock
 
mars::utils::WaitCondition wakeupCondition
 
mars::utils::Mutex wakeupMutex
 
std::map< std::string, Timer > timers
 
unsigned long newStreamId
 
unsigned long pushMessageIds [__DB_MESSAGE_TYPE_COUNT]
 

Additional Inherited Members

- Static Public Member Functions inherited from mars::utils::Thread
static ThreadgetCurrentThread ()
 
static void cancelAll (bool block=false)
 
- Static Protected Member Functions inherited from mars::utils::Thread
static void msleep (unsigned long msec)
 causes the current thread to sleep for More...
 
- Protected Attributes inherited from lib_manager::LibInterface
LibManagerlibManager
 
ModuleInfo moduleInfo
 

Detailed Description

Central class of the DataBroker library.

Definition at line 150 of file DataBroker.h.

Constructor & Destructor Documentation

◆ DataBroker()

mars::data_broker::DataBroker::DataBroker ( lib_manager::LibManager theManager)

Definition at line 92 of file DataBroker.cpp.

◆ ~DataBroker()

mars::data_broker::DataBroker::~DataBroker ( )
virtual

Definition at line 138 of file DataBroker.cpp.

Member Function Documentation

◆ connectDataItems()

void mars::data_broker::DataBroker::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 
)
virtual

Implements mars::data_broker::DataBrokerInterface.

Definition at line 1337 of file DataBroker.cpp.

◆ createDataElement()

DataElement * mars::data_broker::DataBroker::createDataElement ( const std::string &  groupName,
const std::string &  dataName,
PackageFlag  flags 
)
private

Definition at line 1171 of file DataBroker.cpp.

◆ createId()

unsigned long mars::data_broker::DataBroker::createId ( )
private

Definition at line 1165 of file DataBroker.cpp.

◆ createTimer()

bool mars::data_broker::DataBroker::createTimer ( const std::string &  timerName)
virtual

creates a new timer with the given name

Parameters
timerNamethe name of the new timer
Returns
false if a timer with the given name already exists. true otherwise.
See also
stepTimer, registerTimedReceiver, unregisterTimedReceiver, ReceiverInterface

Implements mars::data_broker::DataBrokerInterface.

Definition at line 206 of file DataBroker.cpp.

◆ createTrigger()

bool mars::data_broker::DataBroker::createTrigger ( const std::string &  triggerName)
virtual

create a new trigger with the given name

Parameters
triggerNamethe name of the new trigger
Returns
false if a trigger with the given name already exists. true otherwise.
See also
trigger, registerTriggeredReceiver, unregisterTriggeredReceiver, ReceiverInterface

Implements mars::data_broker::DataBrokerInterface.

Definition at line 623 of file DataBroker.cpp.

◆ disconnectDataItems() [1/2]

void mars::data_broker::DataBroker::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 
)
virtual

Implements mars::data_broker::DataBrokerInterface.

Definition at line 1381 of file DataBroker.cpp.

◆ disconnectDataItems() [2/2]

void mars::data_broker::DataBroker::disconnectDataItems ( const std::string &  toGroupName,
const std::string &  toDataName,
const std::string &  toItemName 
)
virtual

Implements mars::data_broker::DataBrokerInterface.

Definition at line 1423 of file DataBroker.cpp.

◆ getDataID()

unsigned long mars::data_broker::DataBroker::getDataID ( const std::string &  groupName,
const std::string &  dataName 
) const
virtual

get the unique dataId assosiated with a given groupName and dataName

Parameters
groupNameThe DataInfo::groupName of the DataPackage.
dataNameThe DataInfo::dataName of the DataPackage.
Returns
The DataInfo::dataId of the DataPackage with the given groupName and dataName. If no such package exists this method returns 0.

Implements mars::data_broker::DataBrokerInterface.

Definition at line 1139 of file DataBroker.cpp.

◆ getDataInfo()

const DataInfo mars::data_broker::DataBroker::getDataInfo ( const std::string &  groupName,
const std::string &  dataName 
) const
virtual

get the DataInfo assosiated with a certain DataPackage

Parameters
groupNameThe DataInfo::groupName of the DataPackage
dataNameThe DataInfo::dataName of the DataPackage
Returns
A copy of the DataInfo of the DataPackage with the given groupName and dataName. If no such package exists this method returns and DataInfo object with dataId set to 0 and empty strings as groupName and dataName.

Implements mars::data_broker::DataBrokerInterface.

Definition at line 1152 of file DataBroker.cpp.

◆ getDataList()

const std::vector< DataInfo > mars::data_broker::DataBroker::getDataList ( PackageFlag  flag) const
virtual

get a list of all DataInfo items currently in the DataBroker

Parameters
flagA 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.

◆ getDataPackage()

const DataPackage mars::data_broker::DataBroker::getDataPackage ( unsigned long  dataId) const
virtual

get the DataPackage with a given dataId

Parameters
dataIdThe unique DataInfo::dataId of the DataPackage to return.
Returns
A copy of the DataPackage with the given dataId.

Implements mars::data_broker::DataBrokerInterface.

Definition at line 1124 of file DataBroker.cpp.

◆ getElement()

DataElement* mars::data_broker::DataBroker::getElement ( const std::string &  groupName,
const std::string &  dataName 
) const
private

◆ getElementsByName()

void mars::data_broker::DataBroker::getElementsByName ( const std::string &  groupName,
const std::string &  dataName,
std::vector< DataElement *> *  elements 
) const
private

Get all DataElements that match groupName and dataName.

They may contain wildcards.

See also
match

Definition at line 1314 of file DataBroker.cpp.

◆ lockRealtimeMutex()

void mars::data_broker::DataBroker::lockRealtimeMutex ( )
inline

Definition at line 255 of file DataBroker.h.

◆ publishDataElement()

void mars::data_broker::DataBroker::publishDataElement ( const DataElement *  element)
private

Definition at line 1190 of file DataBroker.cpp.

◆ pushData() [1/2]

unsigned long mars::data_broker::DataBroker::pushData ( const std::string &  groupName,
const std::string &  dataName,
const DataPackage dataPackage,
const ReceiverInterface producer,
PackageFlag  flags 
)
virtual

pushes a DataPackage into the DataBroker

Parameters
groupNameA string to identify different DataPackages belonging to the same group or category. The combination of groupName and dataName should be unique.
dataNameA string to to identify this DataPackage. The combination of groupName and dataName should be unique.
dataPackageThe DataPackage that will be distributed to the receivers.
producerIn 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.
flagsThis is used to indicate the nature of the data.
Returns
A unique pushId.

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.

See also
pushData(unsigned long, const DataPackage&, const ReceiverInterface*)

Implements mars::data_broker::DataBrokerInterface.

Definition at line 891 of file DataBroker.cpp.

◆ pushData() [2/2]

unsigned long mars::data_broker::DataBroker::pushData ( unsigned long  id,
const DataPackage dataPackage,
const ReceiverInterface producer = NULL 
)
virtual

pushes a DataPackage into the DataBroker

Parameters
idThe pushId previously returned by this method.
dataPackageThe DataPackage that will be distributed to the receivers.
producerIn 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.
Returns
The pushId id.

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.

See also
pushData(const std::string& , const std::string&, const DataPackage&, const ReceiverInterface*, PackageFlag)

Implements mars::data_broker::DataBrokerInterface.

Definition at line 915 of file DataBroker.cpp.

◆ pushDebug()

void mars::data_broker::DataBroker::pushDebug ( const std::string &  format,
  ... 
)
virtual

Implements mars::data_broker::DataBrokerInterface.

Definition at line 1029 of file DataBroker.cpp.

◆ pushError()

void mars::data_broker::DataBroker::pushError ( const std::string &  format,
  ... 
)
virtual

Implements mars::data_broker::DataBrokerInterface.

Definition at line 1008 of file DataBroker.cpp.

◆ pushFatal()

void mars::data_broker::DataBroker::pushFatal ( const std::string &  format,
  ... 
)
virtual

Implements mars::data_broker::DataBrokerInterface.

Definition at line 1001 of file DataBroker.cpp.

◆ pushInfo()

void mars::data_broker::DataBroker::pushInfo ( const std::string &  format,
  ... 
)
virtual

Implements mars::data_broker::DataBrokerInterface.

Definition at line 1022 of file DataBroker.cpp.

◆ pushMessage() [1/2]

void mars::data_broker::DataBroker::pushMessage ( MessageType  messageType,
const std::string &  format,
va_list  args 
)
virtual

Implements mars::data_broker::DataBrokerInterface.

Definition at line 983 of file DataBroker.cpp.

◆ pushMessage() [2/2]

void mars::data_broker::DataBroker::pushMessage ( MessageType  messageType,
const std::string &  format,
  ... 
)
virtual

Implements mars::data_broker::DataBrokerInterface.

Definition at line 993 of file DataBroker.cpp.

◆ pushWarning()

void mars::data_broker::DataBroker::pushWarning ( const std::string &  format,
  ... 
)
virtual

Implements mars::data_broker::DataBrokerInterface.

Definition at line 1015 of file DataBroker.cpp.

◆ registerAsyncReceiver()

bool mars::data_broker::DataBroker::registerAsyncReceiver ( ReceiverInterface receiver,
const std::string &  groupName,
const std::string &  dataName,
int  callbackParam = 0 
)
virtual

register a receiver to receive a asynchronous callback for a certain stream

Parameters
receiverThe ReceiverInterface that should be called whenever a certain stream is pushed to the DataBroker.
groupNameThe groupName of the DataPackage the receiver is interested in.
dataNameThe dataName of the DataPackage the receiver is interested in.
callbackParamAn 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.
Returns
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.

See also
unregisterAsyncReceiver, registerSyncReceiver, ReceiverInterface, pushData

Implements mars::data_broker::DataBrokerInterface.

Definition at line 827 of file DataBroker.cpp.

◆ registerSyncReceiver()

bool mars::data_broker::DataBroker::registerSyncReceiver ( ReceiverInterface receiver,
const std::string &  groupName,
const std::string &  dataName,
int  callbackParam = 0 
)
virtual

register a receiver to receive a synchronous callback for a certain stream

Parameters
receiverThe ReceiverInterface that should be called whenever a certain stream is pushed to the DataBroker.
groupNameThe groupName of the DataPackage the receiver is interested in.
dataNameThe dataName of the DataPackage the receiver is interested in.
callbackParamAn 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.
Returns
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.

See also
unregisterSyncReceiver, registerAsyncReceiver, ReceiverInterface, pushData

Implements mars::data_broker::DataBrokerInterface.

Definition at line 763 of file DataBroker.cpp.

◆ registerTimedProducer()

bool mars::data_broker::DataBroker::registerTimedProducer ( ProducerInterface producer,
const std::string &  groupName,
const std::string &  dataName,
const std::string &  timerName,
int  updatePeriod,
int  callbackParam = 0 
)
virtual

Implements mars::data_broker::DataBrokerInterface.

Definition at line 525 of file DataBroker.cpp.

◆ registerTimedReceiver()

bool mars::data_broker::DataBroker::registerTimedReceiver ( ReceiverInterface receiver,
const std::string &  groupName,
const std::string &  dataName,
const std::string &  timerName,
int  updatePeriod,
int  callbackParam = 0 
)
virtual

registers a receiver for a group/data with a timer

Parameters
receiverThe ReceiverInterface that should be called back.
groupNameThe groupName of the DataPackage the receiver is interested in.
dataNameThe dataName of the DataPackage the receiver is interested in.
timerNameThe name of the timer that should call the receiver.
updatePeriodThe 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.
callbackParamAn 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.
Returns
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.
See also
createTimer, stepTimer, unregisterTimedReceiver, ReceiverInterface

Implements mars::data_broker::DataBrokerInterface.

Definition at line 421 of file DataBroker.cpp.

◆ registerTriggeredReceiver()

bool mars::data_broker::DataBroker::registerTriggeredReceiver ( ReceiverInterface receiver,
const std::string &  groupName,
const std::string &  dataName,
const std::string &  triggerName,
int  callbackParam = 0 
)
virtual

registers a receiver for a group/data with a trigger

Parameters
receiverThe ReceiverInterface that should be called back.
groupNameThe groupName of the DataPackage the receiver is intersted in.
dataNameThe dataName of the DataPackage the receiver is intersted in.
triggerNameThe name of the trigger that should call the receiver.
callbackParamAn 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.
Returns
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.
See also
createTrigger, trigger, unregisterTriggeredReceiver, ReceiverInterface

Implements mars::data_broker::DataBrokerInterface.

Definition at line 687 of file DataBroker.cpp.

◆ run()

void mars::data_broker::DataBroker::run ( void  )
virtual

The thread will execute this method once it has been started .

See also
start(), cancel(), wait(), wait(unsigned long)

Implements mars::utils::Thread.

Definition at line 1047 of file DataBroker.cpp.

◆ runRealtime()

void mars::data_broker::DataBroker::runRealtime ( void  )

Definition at line 1036 of file DataBroker.cpp.

◆ setRTThreadStopped()

void mars::data_broker::DataBroker::setRTThreadStopped ( bool  val)
inline

Definition at line 251 of file DataBroker.h.

◆ setThreadStopped()

void mars::data_broker::DataBroker::setThreadStopped ( bool  val)
inline

Definition at line 250 of file DataBroker.h.

◆ stepTimer()

bool mars::data_broker::DataBroker::stepTimer ( const std::string &  timerName,
long  step = 1 
)
virtual
Returns
true if the timer was stepped. false if no timer with the given name exists.

Implements mars::data_broker::DataBrokerInterface.

Definition at line 288 of file DataBroker.cpp.

◆ trigger()

bool mars::data_broker::DataBroker::trigger ( const std::string &  triggerName)
virtual

triggers the trigger triggerName

Parameters
triggerNameThe name of the trigger that should be triggered. It should have been previously created with createTrigger.
Returns
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.

See also
createTrigger, registerTriggeredReceiver, unregisterTriggeredReceiver, ReceiverInterface

Implements mars::data_broker::DataBrokerInterface.

Definition at line 661 of file DataBroker.cpp.

◆ unlockRealtimeMutex()

void mars::data_broker::DataBroker::unlockRealtimeMutex ( )
inline

Definition at line 258 of file DataBroker.h.

◆ unregisterAsyncReceiver()

bool mars::data_broker::DataBroker::unregisterAsyncReceiver ( ReceiverInterface receiver,
const std::string &  groupName,
const std::string &  dataName 
)
virtual

unregister a receiver from receiving callbacks for certain group/data

Parameters
receiverThe ReceiverInterface that wants to unregister.
groupNameThe groupName of the DataPackage for which the receiver no longer wishes to receive callbacks.
dataNameThe dataName of the DataPackage for which the receiver no longer wishes to receive callbacks.
Returns
true if the receiver successfully unregistered. false otherwise. Returning false could have several reasons
  • No DataPackage with the given groupName and dataName exist.
  • The receiver was not registered for the DataPackage of the given groupName and dataName.
See also
registerAsyncReceiver, ReceiverInterface

Implements mars::data_broker::DataBrokerInterface.

Definition at line 850 of file DataBroker.cpp.

◆ unregisterSyncReceiver()

bool mars::data_broker::DataBroker::unregisterSyncReceiver ( ReceiverInterface receiver,
const std::string &  groupName,
const std::string &  dataName 
)
virtual

unregister a receiver from receiving callbacks for certain group/data

Parameters
receiverThe ReceiverInterface that wants to unregister.
groupNameThe groupName of the DataPackage for which the receiver no longer wishes to receive callbacks.
dataNameThe dataName of the DataPackage for which the receiver no longer wishes to receive callbacks.
Returns
true if the receiver successfully unregistered. false otherwise. Returning false could have several reasons
  • No DataPackage with the given groupName and dataName exist.
  • The receiver was not registered for the DataPackage of the given groupName and dataName.
See also
registerSyncReceiver, ReceiverInterface

Implements mars::data_broker::DataBrokerInterface.

Definition at line 786 of file DataBroker.cpp.

◆ unregisterTimedProducer()

bool mars::data_broker::DataBroker::unregisterTimedProducer ( ProducerInterface producer,
const std::string &  groupName,
const std::string &  dataName,
const std::string &  timerName 
)
virtual

Implements mars::data_broker::DataBrokerInterface.

Definition at line 575 of file DataBroker.cpp.

◆ unregisterTimedReceiver()

bool mars::data_broker::DataBroker::unregisterTimedReceiver ( ReceiverInterface receiver,
const std::string &  groupName,
const std::string &  dataName,
const std::string &  timerName 
)
virtual

unregister a receiver from receiving callbacks from a timer for certain group/data

Parameters
receiverThe ReceiverInterface that wants to unregister.
groupNameThe groupName of the DataPackage for which the receiver no longer wishes to receive callbacks from the timer.
dataNameThe dataName of the DataPackage for which the receiver no longer wishes to receive callbacks from the timer.
timerNameThe name of the timer that should stop notifying the receiver.
Returns
true if the receiver successfully unregistered. false otherwise. Returning false could have several reasons
  • No timer called timerName was created
  • No DataPackage with the given groupName and dataName exist.
  • The receiver was not registered with this timer for the DataPackage of the given groupName and dataName.
See also
createTimer, stepTimer, registerTimedReceiver, ReceiverInterface

Implements mars::data_broker::DataBrokerInterface.

Definition at line 473 of file DataBroker.cpp.

◆ unregisterTriggeredReceiver()

bool mars::data_broker::DataBroker::unregisterTriggeredReceiver ( ReceiverInterface receiver,
const std::string &  groupName,
const std::string &  dataName,
const std::string &  triggerName 
)
virtual

register a receiver from receiving callbacks from a trigger for certain group/data

Parameters
receiverThe ReceiverInterface that wants to unregister.
groupNameThe groupName of the DataPackage for which the receiver no longer wishes to receive callbacks from the trigger.
dataNameThe dataName of the DataPackage for which the receiver no longer wishes to receive callbacks from the trigger.
triggerNameThe name of the trigger that should stop notifying the receiver.
Returns
true if the receiver successfully unregistered. false otherwise. Returning false could have several reasons
  • No trigger called timerName was created
  • No DataPackage with the given groupName and dataName exist.
  • The receiver was not registered with this trigger for the DataPackage of the given groupName and dataName.
See also
createTrigger, trigger, registerTriggeredReceiver, ReceiverInterface

Implements mars::data_broker::DataBrokerInterface.

Definition at line 713 of file DataBroker.cpp.

◆ updatePendingRegistrations()

void mars::data_broker::DataBroker::updatePendingRegistrations ( DataElement *  newElement)
private

Definition at line 1208 of file DataBroker.cpp.

Member Data Documentation

◆ elementsById

std::map<unsigned long, DataElement*> mars::data_broker::DataBroker::elementsById
private

Definition at line 311 of file DataBroker.h.

◆ elementsByName

std::map<std::pair<std::string, std::string>, DataElement*> mars::data_broker::DataBroker::elementsByName
private

Definition at line 313 of file DataBroker.h.

◆ elementsLock

mars::utils::ReadWriteLock mars::data_broker::DataBroker::elementsLock
mutableprivate

Definition at line 314 of file DataBroker.h.

◆ idMutex

mars::utils::Mutex mars::data_broker::DataBroker::idMutex
private

Definition at line 300 of file DataBroker.h.

◆ newStreamId

unsigned long mars::data_broker::DataBroker::newStreamId
private

Definition at line 323 of file DataBroker.h.

◆ next_id

unsigned long mars::data_broker::DataBroker::next_id
private

Definition at line 297 of file DataBroker.h.

◆ pendingAsyncRegistrations

LockableContainer<std::list<PendingRegistration> > mars::data_broker::DataBroker::pendingAsyncRegistrations
private

Definition at line 306 of file DataBroker.h.

◆ pendingRegistrationLock

mars::utils::Mutex mars::data_broker::DataBroker::pendingRegistrationLock
private

Definition at line 318 of file DataBroker.h.

◆ pendingSyncRegistrations

LockableContainer<std::list<PendingRegistration> > mars::data_broker::DataBroker::pendingSyncRegistrations
private

Definition at line 307 of file DataBroker.h.

◆ pendingTimedProducers

LockableContainer<std::list<PendingTimedProducer> > mars::data_broker::DataBroker::pendingTimedProducers
private

Definition at line 308 of file DataBroker.h.

◆ pendingTimedRegistrations

LockableContainer<std::list<PendingTimedRegistration> > mars::data_broker::DataBroker::pendingTimedRegistrations
private

Definition at line 309 of file DataBroker.h.

◆ pendingTriggeredRegistrations

std::list<PendingTriggeredRegistration> mars::data_broker::DataBroker::pendingTriggeredRegistrations
private

Definition at line 310 of file DataBroker.h.

◆ pushMessageIds

unsigned long mars::data_broker::DataBroker::pushMessageIds[__DB_MESSAGE_TYPE_COUNT]
private

Definition at line 324 of file DataBroker.h.

◆ realtimeMutex

mars::utils::Mutex mars::data_broker::DataBroker::realtimeMutex
private

Definition at line 301 of file DataBroker.h.

◆ realtimeThread

pthread_t mars::data_broker::DataBroker::realtimeThread
private

Definition at line 299 of file DataBroker.h.

◆ realtimeThreadRunning

bool mars::data_broker::DataBroker::realtimeThreadRunning
private

Definition at line 303 of file DataBroker.h.

◆ startingRealtimeThread

bool mars::data_broker::DataBroker::startingRealtimeThread
private

Definition at line 304 of file DataBroker.h.

◆ stop_thread

bool mars::data_broker::DataBroker::stop_thread
private

Definition at line 302 of file DataBroker.h.

◆ stopRealtimeThread

bool mars::data_broker::DataBroker::stopRealtimeThread
private

Definition at line 303 of file DataBroker.h.

◆ theThread

pthread_t mars::data_broker::DataBroker::theThread
private

Definition at line 298 of file DataBroker.h.

◆ thread_running

bool mars::data_broker::DataBroker::thread_running
private

Definition at line 302 of file DataBroker.h.

◆ timers

std::map<std::string, Timer> mars::data_broker::DataBroker::timers
private

Definition at line 322 of file DataBroker.h.

◆ timersLock

mars::utils::ReadWriteLock mars::data_broker::DataBroker::timersLock
private

Definition at line 315 of file DataBroker.h.

◆ triggers

std::map<std::string, Trigger> mars::data_broker::DataBroker::triggers
private

Definition at line 312 of file DataBroker.h.

◆ triggersLock

mars::utils::ReadWriteLock mars::data_broker::DataBroker::triggersLock
private

Definition at line 316 of file DataBroker.h.

◆ updatedElementsBackBuffer

std::set<DataElement*>* mars::data_broker::DataBroker::updatedElementsBackBuffer
private

Definition at line 294 of file DataBroker.h.

◆ updatedElementsFrontBuffer

std::set<DataElement*>* mars::data_broker::DataBroker::updatedElementsFrontBuffer
private

Definition at line 295 of file DataBroker.h.

◆ updatedElementsLock

mars::utils::Mutex mars::data_broker::DataBroker::updatedElementsLock
private

Definition at line 317 of file DataBroker.h.

◆ wakeupCondition

mars::utils::WaitCondition mars::data_broker::DataBroker::wakeupCondition
private

Definition at line 320 of file DataBroker.h.

◆ wakeupMutex

mars::utils::Mutex mars::data_broker::DataBroker::wakeupMutex
private

Definition at line 321 of file DataBroker.h.


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