rclcpp_lifecycle  master
C++ ROS Lifecycle Library API
transition.hpp
Go to the documentation of this file.
1 // Copyright 2016 Open Source Robotics Foundation, Inc.
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 RCLCPP_LIFECYCLE__TRANSITION_HPP_
16 #define RCLCPP_LIFECYCLE__TRANSITION_HPP_
17 
18 #include <string>
19 
22 
23 #include "rcutils/allocator.h"
24 
25 // forward declare rcl_transition_t
27 
28 namespace rclcpp_lifecycle
29 {
30 
32 
37 {
38 public:
40  Transition() = delete;
41 
43 
49  explicit Transition(
50  uint8_t id,
51  const std::string & label = "",
52  rcutils_allocator_t allocator = rcutils_get_default_allocator());
53 
55 
63  Transition(
64  uint8_t id, const std::string & label,
65  State && start, State && goal,
66  rcutils_allocator_t allocator = rcutils_get_default_allocator());
67 
69 
74  explicit Transition(
75  const rcl_lifecycle_transition_t * rcl_lifecycle_transition_handle,
76  rcutils_allocator_t allocator = rcutils_get_default_allocator());
77 
79  Transition(const Transition & rhs);
80 
82  virtual ~Transition();
83 
85  Transition & operator=(const Transition & rhs);
86 
88 
92  uint8_t
93  id() const;
94 
96 
101  label() const;
102 
104 
108  State
109  start_state() const;
110 
112 
116  State
117  goal_state() const;
118 
119 protected:
121  void
122  reset();
123 
124  rcutils_allocator_t allocator_;
125 
127 
129 };
130 
131 } // namespace rclcpp_lifecycle
132 #endif // RCLCPP_LIFECYCLE__TRANSITION_HPP_
rclcpp_lifecycle::Transition::start_state
State start_state() const
Return the start state of the transition.
std::string
rclcpp_lifecycle::Transition::operator=
Transition & operator=(const Transition &rhs)
rclcpp_lifecycle::Transition
The Transition class abstract the Lifecycle's states.
Definition: transition.hpp:36
rclcpp_lifecycle::Transition::allocator_
rcutils_allocator_t allocator_
Definition: transition.hpp:124
rclcpp_lifecycle::Transition::owns_rcl_transition_handle_
bool owns_rcl_transition_handle_
Definition: transition.hpp:126
rclcpp_lifecycle::State
Abstract class for the Lifecycle's states.
Definition: state.hpp:34
rclcpp_lifecycle::Transition::~Transition
virtual ~Transition()
rclcpp_lifecycle
Definition: lifecycle_node.hpp:90
rclcpp_lifecycle::Transition::label
std::string label() const
Return the label.
rclcpp_lifecycle::Transition::Transition
Transition()=delete
rclcpp_lifecycle::Transition::transition_handle_
rcl_lifecycle_transition_t * transition_handle_
Definition: transition.hpp:128
rclcpp_lifecycle::Transition::goal_state
State goal_state() const
Return the goal state of the transition.
rclcpp_lifecycle::Transition::id
uint8_t id() const
Return the id.
visibility_control.h
rclcpp_lifecycle::Transition::reset
void reset()
RCLCPP_LIFECYCLE_PUBLIC
#define RCLCPP_LIFECYCLE_PUBLIC
Definition: visibility_control.h:50
state.hpp
rcl_lifecycle_transition_t