35 #ifndef MESSAGE_FILTERS_SYNC_EXACT_TIME_H
36 #define MESSAGE_FILTERS_SYNC_EXACT_TIME_H
43 #include <boost/tuple/tuple.hpp>
44 #include <boost/shared_ptr.hpp>
45 #include <boost/function.hpp>
46 #include <boost/thread/mutex.hpp>
48 #include <boost/bind.hpp>
49 #include <boost/type_traits/is_same.hpp>
50 #include <boost/noncopyable.hpp>
51 #include <boost/mpl/or.hpp>
52 #include <boost/mpl/at.hpp>
53 #include <boost/mpl/vector.hpp>
65 namespace sync_policies
68 namespace mpl = boost::mpl;
71 template<
typename M0,
typename M1,
typename M2 = NullType,
typename M3 = NullType,
typename M4 = NullType,
72 typename M5 = NullType,
typename M6 = NullType,
typename M7 = NullType,
typename M8 = NullType>
73 struct ExactTime :
public PolicyBase<M0, M1, M2, M3, M4, M5, M6, M7, M8>
75 typedef Synchronizer<ExactTime>
Sync;
76 typedef PolicyBase<M0, M1, M2, M3, M4, M5, M6, M7, M8>
Super;
90 typedef boost::tuple<M0Event, M1Event, M2Event, M3Event, M4Event, M5Event, M6Event, M7Event, M8Event>
Tuple;
122 void add(
const typename mpl::at_c<Events, i>::type& evt)
128 boost::mutex::scoped_lock lock(
mutex_);
135 ROS_WARN(
"Detected jump back in time. Clearing the message filters queue");
141 Tuple& t =
tuples_[mt::TimeStamp<typename mpl::at_c<Messages, i>::type>::value(*evt.getMessage())];
142 boost::get<i>(t) = evt;
167 template<
class C,
typename T>
177 template<
class C,
typename T>
200 full = full && (bool)boost::get<0>(t).getMessage();
201 full = full && (bool)boost::get<1>(t).getMessage();
202 full = full && (RealTypeCount::value > 2 ? (bool)boost::get<2>(t).getMessage() :
true);
203 full = full && (RealTypeCount::value > 3 ? (bool)boost::get<3>(t).getMessage() :
true);
204 full = full && (RealTypeCount::value > 4 ? (bool)boost::get<4>(t).getMessage() :
true);
205 full = full && (RealTypeCount::value > 5 ? (bool)boost::get<5>(t).getMessage() :
true);
206 full = full && (RealTypeCount::value > 6 ? (bool)boost::get<6>(t).getMessage() :
true);
207 full = full && (RealTypeCount::value > 7 ? (bool)boost::get<7>(t).getMessage() :
true);
208 full = full && (RealTypeCount::value > 8 ? (bool)boost::get<8>(t).getMessage() :
true);
213 boost::get<3>(t), boost::get<4>(t), boost::get<5>(t),
214 boost::get<6>(t), boost::get<7>(t), boost::get<8>(t));
229 boost::get<3>(t2), boost::get<4>(t2), boost::get<5>(t2),
230 boost::get<6>(t2), boost::get<7>(t2), boost::get<8>(t2));
239 typename M_TimeToTuple::iterator it =
tuples_.begin();
240 typename M_TimeToTuple::iterator end =
tuples_.end();
245 typename M_TimeToTuple::iterator old = it;
248 Tuple& t = old->second;
250 boost::get<3>(t), boost::get<4>(t), boost::get<5>(t),
251 boost::get<6>(t), boost::get<7>(t), boost::get<8>(t));
280 #endif // MESSAGE_FILTERS_SYNC_EXACT_TIME_H