Skip to content

Commit

Permalink
Adding an empty implementation to setCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorWalter committed Apr 12, 2024
1 parent 38714af commit 73c25ae
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions include/mrs_lib/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,15 @@ namespace mrs_lib
*/
virtual void setPeriod(const ros::Duration& duration, const bool reset = true) override;

/**
* @brief change the callback method
*
* Usable e.g. for running thread with a specific parameter if you bind it using std::bind
*
* @param callback callback method to be called.
*/
virtual void setCallback(const std::function<void(const ros::TimerEvent&)>& callback) override;

/**
* @brief returns true if callbacks should be called
*
Expand Down
9 changes: 9 additions & 0 deletions src/timer/timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ void ROSTimer::setPeriod(const ros::Duration& duration, const bool reset) {
}
}

//}
//
/* setCallback() //{ */

void ROSTimer::setCallback([[maybe_unused]] const std::function<void(const ros::TimerEvent&)>& callback) {

ROS_ERROR("[mrs_lib::ROSTimer]: setCallback(...) is not implemented for ROSTimer! Check [mrs_lib/src/timer/timer.cpp].");
}

//}

/* running() //{ */
Expand Down

0 comments on commit 73c25ae

Please sign in to comment.