21 #ifndef INCLUDE_FKIE_MESSAGE_FILTERS_COMBINER_POLICIES_EXACT_TIME_IMPL_H_ 22 #define INCLUDE_FKIE_MESSAGE_FILTERS_COMBINER_POLICIES_EXACT_TIME_IMPL_H_ 25 #include "../helpers/access_ros_header.h" 26 #include "../helpers/tuple.h" 27 #include "../helpers/scoped_unlock.h" 32 namespace combiner_policies
35 template<
typename... IOs>
37 : max_age_(
ros::Duration(1, 0)), max_queue_size_(0)
41 template<
typename... IOs>
49 template<
typename... IOs>
57 template<
typename... IOs>
58 template<std::
size_t N>
62 if (!std::get<N>(
queues_).emplace(stamp, in).second)
64 ROS_WARN_STREAM_NAMED(
"Combiner<ExactTime>",
"message with repeating time stamp " << stamp <<
" is dropped");
73 [
this, &cutoff](
auto I)
75 auto& queue = std::get<I>(this->
queues_);
76 auto ub = queue.upper_bound(cutoff);
77 queue.erase(queue.begin(), ub);
83 auto& queue = std::get<N>(
queues_);
89 [
this, &out, &lock](
auto... Is)
92 this->
emit(std::tuple_cat(*std::get<Is>(out)...));
98 template<
typename... IOs>
108 auto& queue = std::get<I>(this->
queues_);
109 auto it = queue.find(time);
110 if (it != queue.end())
112 std::get<I>(result) = it->second;
124 template<
typename... IOs>
130 auto& queue = std::get<I>(this->
queues_);
ExactTime & set_max_queue_size(std::size_t queue_size, const boost::optional< ros::Duration > &max_age=boost::none) noexcept
Set maximum queue size.
std::tuple< boost::optional< helpers::io_tuple_t< IOs > >... > MaybeOutgoingTuples
Tuple of outgoing tuple candidates.
void for_each_apply(Function f)
ScopedUnlock< BasicLockable > with_scoped_unlock(BasicLockable &lockable)
void reset() noexcept override
Reset internal state.
std::size_t max_queue_size_
MaybeOutgoingTuples try_assemble_output(const ros::Time &time, bool &complete) noexcept
void add(std::unique_lock< std::mutex > &, const std::tuple_element_t< N, IncomingTuples > &)
Input function.
boost::optional< ros::Duration > max_age_
void emit(const OutgoingTuple &out)
Emit data.
auto index_apply(Function f)
ExactTime & set_max_age(const ros::Duration &max_age) noexcept
Set maximum age of any data in the queue.
ros::Time access_ros_header_stamp(const M &m) noexcept
#define ROS_WARN_STREAM_NAMED(name, args)