Skip to content

Commit

Permalink
Add hasStarted()const to Timer API (#1464)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmagyar authored and dirk-thomas committed Aug 20, 2018
1 parent b1d1dd4 commit 25b6421
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions clients/roscpp/include/ros/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions clients/roscpp/src/libros/timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ Timer::Impl::~Impl()
stop();
}

bool Timer::Impl::hasStarted() const
{
return started_;
}

bool Timer::Impl::isValid()
{
return !period_.isZero();
Expand Down

0 comments on commit 25b6421

Please sign in to comment.