MIRA
|
Class that can be registered as a filter when subscribing to more than one channel to only get a callback when all channels have data with a similar timestamp (differ only in the specified tolerance). More...
#include <filter/ChannelVectorSynchronizer.h>
Public Member Functions | |
ChannelVectorSynchronizer1 () | |
void | unsubscribe (Authority &authority) |
Call this instead of Authority::unsubscribe(...) to unsubscribe all the channels of the synchronizer. More... | |
void | subscribe (Authority &authority, const std::vector< std::string > &channelID0, const Duration &t=Duration::seconds(0)) |
Call this instead of Authority::subscribe() Function provided for convenience (if no callback function is required). More... | |
void | subscribe (Authority &authority, const std::vector< std::string > &channelID0, boost::function< void(std::vector< ChannelRead< type0 >>)> fn, const Duration &t=Duration::seconds(0)) |
Call this instead of Authority::subscribe() More... | |
template<typename Class > | |
void | subscribe (Authority &authority, const std::vector< std::string > &channelID0, void(Class::*f)(std::vector< ChannelRead< type0 >>), Class *obj, const Duration &t=Duration::seconds(0)) |
Same as above but with a function and object pointer. More... | |
void | callback0 (ChannelRead< type0 > ic) |
void | call (std::vector< ChannelRead< type0 >> c0) |
boost::tuple< std::vector< ChannelRead< type0 > > > | read () |
Return (synchronized) ChannelRead objects. More... | |
bool | isValid () const |
Return true if all ChannelRead objects contain valid data. More... | |
boost::tuple< std::vector< ChannelRead< type0 > > > | waitForData (const Duration &timeout=Duration::infinity()) |
Return the latest (synchronized) element once it is available. More... | |
bool | waitForPublisher (const Duration &timeout=Duration::infinity()) const |
Public Attributes | |
std::vector< Time > | mLast0 |
std::vector< Channel< type0 > > | mChannel0 |
std::vector< ChannelRead< type0 > > | mChannelRead0 |
Duration | mTolerance |
boost::function< void(std::vector< ChannelRead< type0 >>)> | mFunction |
Class that can be registered as a filter when subscribing to more than one channel to only get a callback when all channels have data with a similar timestamp (differ only in the specified tolerance).
All channels have to be of the same type. To synchronize channels of differnt types, you have to use the ChannelVectorSynchronizer2, ChannelVectorSynchronizer3, ... template class. To synchronize arbitrary different types of channels, just define MIRA_CHANNEL_SYNCHRONIZER(MySynchronizerName, 5). Where MySynchronizerName defines the name of the template class which will be generated, the number will define the number of channels, which the synchronizer is using. After that you can use your MySynchronizerName class exactly the same way.
|
inline |
|
inline |
Call this instead of Authority::unsubscribe(...) to unsubscribe all the channels of the synchronizer.
|
inline |
Call this instead of Authority::subscribe() Function provided for convenience (if no callback function is required).
|
inline |
Call this instead of Authority::subscribe()
authority | The authority that does the basic subscription |
channelIDA | The ID of the channel A we are subscribing on |
channelIDB | The ID of the channel B we are subscribing on |
fn | The function that should be called when the filter matches |
t | Maximum time difference of the channels message timestamps for still being synchronous |
|
inline |
Same as above but with a function and object pointer.
Provided for convenience.
|
inline |
|
inline |
|
inline |
Return (synchronized) ChannelRead objects.
The ChannelRead objects are always synchronized by the channel with the lowest update frequency. Please note that the ChannelRead objects may be invalid if no data has been published yet.
|
inline |
Return true if all ChannelRead objects contain valid data.
|
inline |
Return the latest (synchronized) element once it is available.
If the functions times out, invalid channelRead objects will be returned. Please note that the function does not regard synchronized elements that were available BEFORE this function was called.
|
inline |
std::vector<Time> mLast0 |
std::vector<Channel<type0> > mChannel0 |
std::vector<ChannelRead<type0> > mChannelRead0 |
Duration mTolerance |
boost::function<void ( std::vector<ChannelRead<type0>>)> mFunction |