ROS 2 rclcpp + rcl - rolling  rolling-20536064
ROS 2 C++ Client Library with ROS Client Library
timer_impl.h
1 // Copyright 2025 cellumation GmbH
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef RCL__TIMER_IMPL_H_
16 #define RCL__TIMER_IMPL_H_
17 
18 #include <inttypes.h>
19 
20 #include "rcl/timer.h"
21 #include "rcutils/stdatomic_helper.h"
22 
24 {
25  // The clock providing time.
26  rcl_clock_t * clock;
27  // The associated context.
28  rcl_context_t * context;
29  // A guard condition used to wake the associated wait set, either when
30  // ROSTime causes the timer to expire or when the timer is reset.
31  rcl_guard_condition_t guard_condition;
32  // The user supplied callback.
33  atomic_uintptr_t callback;
34  // optionally user supplied data which will be passed into the callback
35  atomic_uintptr_t callback_data;
36 
37  // This is a duration in nanoseconds, which is initialized as int64_t
38  // to be used for internal time calculation.
39  atomic_int_least64_t period;
40  // This is a time in nanoseconds since an unspecified time.
41  atomic_int_least64_t last_call_time;
42  // This is a time in nanoseconds since an unspecified time.
43  atomic_int_least64_t next_call_time;
44  // Credit for time elapsed before ROS time is activated or deactivated.
45  atomic_int_least64_t time_credit;
46  // A flag which indicates if the timer is canceled.
47  atomic_bool canceled;
48  // The user supplied allocator.
49  rcl_allocator_t allocator;
50  // The user supplied on reset callback data.
51  rcl_timer_on_reset_callback_data_t reset_callback_data;
52  bool in_use_by_waitset;
53 };
54 #endif // RCL__TIMER_IMPL_H_
rcutils_allocator_t rcl_allocator_t
Encapsulation of an allocator.
Definition: allocator.h:31
Encapsulation of a time source.
Definition: time.h:138
Encapsulates the non-global state of an init/shutdown cycle.
Definition: context.h:114
Handle for a rcl guard condition.
Structure which encapsulates the on reset callback data.
Definition: timer.h:48