rclcpp_lifecycle  master
C++ ROS Lifecycle Library API
state.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__STATE_HPP_
16 #define RCLCPP_LIFECYCLE__STATE_HPP_
17 
18 #include <string>
19 
21 
22 #include "rcutils/allocator.h"
23 
24 // forward declare rcl_state_t
26 
27 namespace rclcpp_lifecycle
28 {
29 
31 
34 class State
35 {
36 public:
38  explicit State(rcutils_allocator_t allocator = rcutils_get_default_allocator());
39 
41 
47  State(
48  uint8_t id,
49  const std::string & label,
50  rcutils_allocator_t allocator = rcutils_get_default_allocator());
51 
53 
58  explicit State(
59  const rcl_lifecycle_state_t * rcl_lifecycle_state_handle,
60  rcutils_allocator_t allocator = rcutils_get_default_allocator());
61 
63  State(const State & rhs);
64 
66  virtual ~State();
67 
69  State & operator=(const State & rhs);
70 
72 
76  uint8_t
77  id() const;
78 
80 
85  label() const;
86 
87 protected:
89  void
90  reset();
91 
92  rcutils_allocator_t allocator_;
93 
95 
97 };
98 
99 } // namespace rclcpp_lifecycle
100 #endif // RCLCPP_LIFECYCLE__STATE_HPP_
std::string
rcl_lifecycle_state_t
rclcpp_lifecycle::State::id
uint8_t id() const
Return the id.
rclcpp_lifecycle::State::operator=
State & operator=(const State &rhs)
rclcpp_lifecycle::State::owns_rcl_state_handle_
bool owns_rcl_state_handle_
Definition: state.hpp:94
rclcpp_lifecycle::State::State
State(rcutils_allocator_t allocator=rcutils_get_default_allocator())
rclcpp_lifecycle::State
Abstract class for the Lifecycle's states.
Definition: state.hpp:34
rclcpp_lifecycle::State::allocator_
rcutils_allocator_t allocator_
Definition: state.hpp:92
rclcpp_lifecycle
Definition: lifecycle_node.hpp:90
rclcpp_lifecycle::State::state_handle_
rcl_lifecycle_state_t * state_handle_
Definition: state.hpp:96
visibility_control.h
rclcpp_lifecycle::State::~State
virtual ~State()
RCLCPP_LIFECYCLE_PUBLIC
#define RCLCPP_LIFECYCLE_PUBLIC
Definition: visibility_control.h:50
rclcpp_lifecycle::State::label
std::string label() const
Return the label.
rclcpp_lifecycle::State::reset
void reset()