Skip to content

Commit

Permalink
roscpp: add missing member function ros::SteadyTimer::hasStarted()
Browse files Browse the repository at this point in the history
  • Loading branch information
meyerj committed Dec 14, 2018
1 parent 3afb85d commit c37a75b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
16 changes: 11 additions & 5 deletions clients/roscpp/src/libros/steady_timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_)
Expand All @@ -119,6 +129,7 @@ void SteadyTimer::Impl::start()
{
tracked_object = tracked_object_.lock();
}

This comment has been minimized.

Copy link
@meyerj

meyerj Dec 14, 2018

Author Contributor

Whitespace changes are the result of merging with timer.cpp and wall_timer.cpp. In a future release it would be possible to define a template class TimerBase<T,D,E> and three typedefs for Timer, WallTimer and SteadyTimer to avoid code duplication.

timer_handle_ = TimerManager<SteadyTime, WallDuration, SteadyTimerEvent>::global().add(period_, callback_, callback_queue_, tracked_object, oneshot_);
started_ = true;
}
Expand All @@ -134,11 +145,6 @@ void SteadyTimer::Impl::stop()
}
}

bool SteadyTimer::Impl::isValid()
{
return !period_.isZero();
}

bool SteadyTimer::Impl::hasPending()
{
if (!isValid() || timer_handle_ == -1)
Expand Down
1 change: 1 addition & 0 deletions clients/roscpp/src/libros/timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ void Timer::Impl::setPeriod(const Duration& period, bool reset)
TimerManager<Time, Duration, TimerEvent>::global().setPeriod(timer_handle_, period, reset);
}


Timer::Timer(const TimerOptions& ops)
: impl_(new Impl)
{
Expand Down

0 comments on commit c37a75b

Please sign in to comment.