#include <synchronizer.h>
Public Member Functions | |
void | add0 (const T1 &t, unsigned long time) |
void | add1 (const T2 &t, unsigned long time) |
int | addCallback (const CallbackFunction &callback) |
void | removeCallback (int i) |
Synchronizer () | |
Private Types | |
typedef boost::function< void(T1, T2, unsigned long, unsigned long) > | CallbackFunction |
typedef std::pair< unsigned long, T1 > | T1Stamped |
typedef std::pair< unsigned long, T2 > | T2Stamped |
Private Member Functions | |
void | publish () |
void | publishData () |
Private Attributes | |
int | callback_counter |
std::map< int, CallbackFunction > | cb_ |
boost::mutex | mutex1_ |
boost::mutex | mutex2_ |
boost::mutex | publish_mutex_ |
std::deque< T1Stamped > | queueT1 |
std::deque< T2Stamped > | queueT2 |
/brief This template class synchronizes two data streams of different types. The data can be added using add0 and add1 methods which expects also a timestamp of type unsigned long. If two matching data objects are found, registered callback functions are invoked with the objects and the time stamps. The only assumption of the timestamp is, that they are in the same unit, linear and strictly monotonic increasing. If filtering is desired, e.g. thresholding of time differences, the user can do that in the callback method. This class is thread safe. /ingroup common
Definition at line 49 of file synchronizer.h.
typedef boost::function<void(T1, T2, unsigned long, unsigned long) > pcl::Synchronizer< T1, T2 >::CallbackFunction [private] |
Definition at line 59 of file synchronizer.h.
typedef std::pair<unsigned long, T1> pcl::Synchronizer< T1, T2 >::T1Stamped [private] |
Definition at line 51 of file synchronizer.h.
typedef std::pair<unsigned long, T2> pcl::Synchronizer< T1, T2 >::T2Stamped [private] |
Definition at line 52 of file synchronizer.h.
pcl::Synchronizer< T1, T2 >::Synchronizer | ( | ) | [inline] |
Definition at line 65 of file synchronizer.h.
void pcl::Synchronizer< T1, T2 >::add0 | ( | const T1 & | t, |
unsigned long | time | ||
) | [inline] |
Definition at line 83 of file synchronizer.h.
void pcl::Synchronizer< T1, T2 >::add1 | ( | const T2 & | t, |
unsigned long | time | ||
) | [inline] |
Definition at line 92 of file synchronizer.h.
int pcl::Synchronizer< T1, T2 >::addCallback | ( | const CallbackFunction & | callback | ) | [inline] |
Definition at line 68 of file synchronizer.h.
void pcl::Synchronizer< T1, T2 >::publish | ( | ) | [inline, private] |
Definition at line 121 of file synchronizer.h.
void pcl::Synchronizer< T1, T2 >::publishData | ( | ) | [inline, private] |
Definition at line 103 of file synchronizer.h.
void pcl::Synchronizer< T1, T2 >::removeCallback | ( | int | i | ) | [inline] |
Definition at line 76 of file synchronizer.h.
int pcl::Synchronizer< T1, T2 >::callback_counter [private] |
Definition at line 62 of file synchronizer.h.
std::map<int, CallbackFunction> pcl::Synchronizer< T1, T2 >::cb_ [private] |
Definition at line 61 of file synchronizer.h.
boost::mutex pcl::Synchronizer< T1, T2 >::mutex1_ [private] |
Definition at line 53 of file synchronizer.h.
boost::mutex pcl::Synchronizer< T1, T2 >::mutex2_ [private] |
Definition at line 54 of file synchronizer.h.
boost::mutex pcl::Synchronizer< T1, T2 >::publish_mutex_ [private] |
Definition at line 55 of file synchronizer.h.
std::deque<T1Stamped> pcl::Synchronizer< T1, T2 >::queueT1 [private] |
Definition at line 56 of file synchronizer.h.
std::deque<T2Stamped> pcl::Synchronizer< T1, T2 >::queueT2 [private] |
Definition at line 57 of file synchronizer.h.