From c37a75bedac9945b640c10c83e5609625e746cbc Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 14 Dec 2018 14:46:31 +0100 Subject: [PATCH] roscpp: add missing member function ros::SteadyTimer::hasStarted() --- clients/roscpp/src/libros/steady_timer.cpp | 16 +++++++++++----- clients/roscpp/src/libros/timer.cpp | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/clients/roscpp/src/libros/steady_timer.cpp b/clients/roscpp/src/libros/steady_timer.cpp index aefc1d1e83..b01ca7d148 100644 --- a/clients/roscpp/src/libros/steady_timer.cpp +++ b/clients/roscpp/src/libros/steady_timer.cpp @@ -110,6 +110,16 @@ SteadyTimer::Impl::~Impl() stop(); } +bool SteadyTimer::Impl::hasStarted() const +{ + return started_; +} + +bool SteadyTimer::Impl::isValid() +{ + return !period_.isZero(); +} + void SteadyTimer::Impl::start() { if (!started_) @@ -119,6 +129,7 @@ void SteadyTimer::Impl::start() { tracked_object = tracked_object_.lock(); } + timer_handle_ = TimerManager::global().add(period_, callback_, callback_queue_, tracked_object, oneshot_); started_ = true; } @@ -134,11 +145,6 @@ void SteadyTimer::Impl::stop() } } -bool SteadyTimer::Impl::isValid() -{ - return !period_.isZero(); -} - bool SteadyTimer::Impl::hasPending() { if (!isValid() || timer_handle_ == -1) diff --git a/clients/roscpp/src/libros/timer.cpp b/clients/roscpp/src/libros/timer.cpp index a063bc480c..7ce68d3ff4 100644 --- a/clients/roscpp/src/libros/timer.cpp +++ b/clients/roscpp/src/libros/timer.cpp @@ -93,6 +93,7 @@ void Timer::Impl::setPeriod(const Duration& period, bool reset) TimerManager::global().setPeriod(timer_handle_, period, reset); } + Timer::Timer(const TimerOptions& ops) : impl_(new Impl) {