Fix 393 (#418)
* correctly copy state label * correctly copy transition label * uncrustify * address comments * up * use init and fini functions from rcl
This commit is contained in:
parent
d823982f22
commit
c40f3c25c6
7 changed files with 272 additions and 71 deletions
|
@ -19,6 +19,8 @@
|
|||
|
||||
#include "rclcpp_lifecycle/visibility_control.h"
|
||||
|
||||
#include "rcutils/allocator.h"
|
||||
|
||||
// forward declare rcl_state_t
|
||||
typedef struct rcl_lifecycle_state_t rcl_lifecycle_state_t;
|
||||
|
||||
|
@ -29,13 +31,18 @@ class State
|
|||
{
|
||||
public:
|
||||
RCLCPP_LIFECYCLE_PUBLIC
|
||||
State();
|
||||
explicit State(rcutils_allocator_t allocator = rcutils_get_default_allocator());
|
||||
|
||||
RCLCPP_LIFECYCLE_PUBLIC
|
||||
State(uint8_t id, const std::string & label);
|
||||
State(
|
||||
uint8_t id,
|
||||
const std::string & label,
|
||||
rcutils_allocator_t allocator = rcutils_get_default_allocator());
|
||||
|
||||
RCLCPP_LIFECYCLE_PUBLIC
|
||||
explicit State(const rcl_lifecycle_state_t * rcl_lifecycle_state_handle);
|
||||
explicit State(
|
||||
const rcl_lifecycle_state_t * rcl_lifecycle_state_handle,
|
||||
rcutils_allocator_t allocator = rcutils_get_default_allocator());
|
||||
|
||||
RCLCPP_LIFECYCLE_PUBLIC
|
||||
virtual ~State();
|
||||
|
@ -49,8 +56,15 @@ public:
|
|||
label() const;
|
||||
|
||||
protected:
|
||||
RCLCPP_LIFECYCLE_PUBLIC
|
||||
void
|
||||
reset();
|
||||
|
||||
rcutils_allocator_t allocator_;
|
||||
|
||||
bool owns_rcl_state_handle_;
|
||||
const rcl_lifecycle_state_t * state_handle_;
|
||||
|
||||
rcl_lifecycle_state_t * state_handle_;
|
||||
};
|
||||
|
||||
} // namespace rclcpp_lifecycle
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include "rclcpp_lifecycle/state.hpp"
|
||||
#include "rclcpp_lifecycle/visibility_control.h"
|
||||
|
||||
#include "rcutils/allocator.h"
|
||||
|
||||
// forward declare rcl_transition_t
|
||||
typedef struct rcl_lifecycle_transition_t rcl_lifecycle_transition_t;
|
||||
|
||||
|
@ -33,15 +35,21 @@ public:
|
|||
Transition() = delete;
|
||||
|
||||
RCLCPP_LIFECYCLE_PUBLIC
|
||||
explicit Transition(uint8_t id, const std::string & label = "");
|
||||
explicit Transition(
|
||||
uint8_t id,
|
||||
const std::string & label = "",
|
||||
rcutils_allocator_t allocator = rcutils_get_default_allocator());
|
||||
|
||||
RCLCPP_LIFECYCLE_PUBLIC
|
||||
Transition(
|
||||
uint8_t id, const std::string & label,
|
||||
State && start, State && goal);
|
||||
State && start, State && goal,
|
||||
rcutils_allocator_t allocator = rcutils_get_default_allocator());
|
||||
|
||||
RCLCPP_LIFECYCLE_PUBLIC
|
||||
explicit Transition(const rcl_lifecycle_transition_t * rcl_lifecycle_transition_handle);
|
||||
explicit Transition(
|
||||
const rcl_lifecycle_transition_t * rcl_lifecycle_transition_handle,
|
||||
rcutils_allocator_t allocator = rcutils_get_default_allocator());
|
||||
|
||||
RCLCPP_LIFECYCLE_PUBLIC
|
||||
virtual ~Transition();
|
||||
|
@ -63,9 +71,15 @@ public:
|
|||
goal_state() const;
|
||||
|
||||
protected:
|
||||
RCLCPP_LIFECYCLE_PUBLIC
|
||||
void
|
||||
reset();
|
||||
|
||||
rcutils_allocator_t allocator_;
|
||||
|
||||
bool owns_rcl_transition_handle_;
|
||||
|
||||
const rcl_lifecycle_transition_t * transition_handle_;
|
||||
rcl_lifecycle_transition_t * transition_handle_;
|
||||
};
|
||||
|
||||
} // namespace rclcpp_lifecycle
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue