tf2_ros  master
This package contains the ROS bindings for the tf2 library, for both Python and C++.
create_timer_interface.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019, Open Source Robotics Foundation, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef TF2_ROS__CREATE_TIMER_INTERFACE_H
31 #define TF2_ROS__CREATE_TIMER_INTERFACE_H
32 
33 #include <functional>
34 
35 #include <rclcpp/rclcpp.hpp>
36 
37 #include <tf2/time.h>
38 
40 
41 namespace tf2_ros
42 {
43 
44 using TimerHandle = uint64_t;
46 
48 {
49 public:
52  : std::runtime_error(errorDescription)
53  {
54  }
55 };
56 
58 {
59 public:
62  : std::runtime_error(description)
63  {
64  }
65 };
66 
71 {
72 public:
76 
78  virtual
79  ~CreateTimerInterface() = default;
80 
91  virtual TimerHandle
93  rclcpp::Clock::SharedPtr clock,
94  const tf2::Duration & period,
95  TimerCallbackType callback) = 0;
96 
106  virtual void
107  cancel(const TimerHandle & timer_handle) = 0;
108 
118  virtual void
119  reset(const TimerHandle & timer_handle) = 0;
120 
130  virtual void
131  remove(const TimerHandle & timer_handle) = 0;
132 }; // class CreateTimerInterface
133 
134 } // namespace tf2_ros
135 
136 #endif // TF2_ROS__CREATE_TIMER_INTERFACE_H
tf2_ros::CreateTimerInterface
Abstract interface for creating timers.
Definition: create_timer_interface.h:70
tf2_ros::InvalidTimerHandleException
Definition: create_timer_interface.h:57
std::string
std::shared_ptr< CreateTimerInterface >
tf2_ros::TimerHandle
uint64_t TimerHandle
Definition: create_timer_interface.h:44
tf2_ros::CreateTimerInterfaceException::CreateTimerInterfaceException
TF2_ROS_PUBLIC CreateTimerInterfaceException(const std::string errorDescription)
Definition: create_timer_interface.h:51
tf2_ros::CreateTimerInterface::cancel
virtual TF2_ROS_PUBLIC void cancel(const TimerHandle &timer_handle)=0
Cancel a timer.
std::function
tf2_ros::CreateTimerInterface::~CreateTimerInterface
virtual TF2_ROS_PUBLIC ~CreateTimerInterface()=default
tf2_ros::CreateTimerInterface::reset
virtual TF2_ROS_PUBLIC void reset(const TimerHandle &timer_handle)=0
Reset the timer.
tf2_ros::CreateTimerInterface::remove
virtual TF2_ROS_PUBLIC void remove(const TimerHandle &timer_handle)=0
Remove a timer.
tf2_ros::CreateTimerInterfaceException
Definition: create_timer_interface.h:47
tf2_ros
Definition: async_buffer_interface.h:41
std::runtime_error
TF2_ROS_PUBLIC
#define TF2_ROS_PUBLIC
Definition: visibility_control.h:58
visibility_control.h
std
std::unique_ptr
tf2_ros::InvalidTimerHandleException::InvalidTimerHandleException
TF2_ROS_PUBLIC InvalidTimerHandleException(const std::string description)
Definition: create_timer_interface.h:61
tf2_ros::CreateTimerInterface::createTimer
virtual TF2_ROS_PUBLIC TimerHandle createTimer(rclcpp::Clock::SharedPtr clock, const tf2::Duration &period, TimerCallbackType callback)=0
Create a new timer.