From ef12a52be0c0150b9ad6a866626bfcbd62a9aa86 Mon Sep 17 00:00:00 2001 From: Bence Magyar Date: Tue, 24 Jul 2018 17:09:54 +0100 Subject: [PATCH] Add hasStarted()const to Timer API --- clients/roscpp/include/ros/timer.h | 2 ++ clients/roscpp/src/libros/timer.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/clients/roscpp/include/ros/timer.h b/clients/roscpp/include/ros/timer.h index 68498751ca..2d5663e443 100644 --- a/clients/roscpp/include/ros/timer.h +++ b/clients/roscpp/include/ros/timer.h @@ -71,6 +71,7 @@ class ROSCPP_DECL Timer */ void setPeriod(const Duration& period, bool reset=true); + bool hasStarted() const { return impl_->hasStarted(); } bool isValid() { return impl_ && impl_->isValid(); } operator void*() { return isValid() ? (void*)1 : (void*)0; } @@ -98,6 +99,7 @@ class ROSCPP_DECL Timer Impl(); ~Impl(); + bool hasStarted() const; bool isValid(); bool hasPending(); void setPeriod(const Duration& period, bool reset=true); diff --git a/clients/roscpp/src/libros/timer.cpp b/clients/roscpp/src/libros/timer.cpp index 6db917dd27..a063bc480c 100644 --- a/clients/roscpp/src/libros/timer.cpp +++ b/clients/roscpp/src/libros/timer.cpp @@ -42,6 +42,11 @@ Timer::Impl::~Impl() stop(); } +bool Timer::Impl::hasStarted() const +{ + return started_; +} + bool Timer::Impl::isValid() { return !period_.isZero();