Skip to content

Commit 3cc52d7

Browse files
committed
(fix) correct dllexport in windows
1 parent cb66fbb commit 3cc52d7

File tree

3 files changed

+28
-34
lines changed

3 files changed

+28
-34
lines changed

rclcpp_lifecycle/include/rcl_lifecycle/lifecycle_state.h

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,30 +78,39 @@ typedef struct LIFECYCLE_EXPORT _rcl_state_machine_t
7878
* @return the transition state which is valid
7979
* NULL if not available
8080
*/
81+
LIFECYCLE_EXPORT
8182
const rcl_state_transition_t*
82-
LIFECYCLE_EXPORT rcl_is_valid_transition_by_index(rcl_state_machine_t* state_machine, unsigned int transition_index);
83+
rcl_is_valid_transition_by_index(rcl_state_machine_t* state_machine, unsigned int transition_index);
84+
LIFECYCLE_EXPORT
8385
const rcl_state_transition_t*
84-
LIFECYCLE_EXPORT rcl_is_valid_transition_by_label(rcl_state_machine_t* state_machine, const char* transition_label);
86+
rcl_is_valid_transition_by_label(rcl_state_machine_t* state_machine, const char* transition_label);
8587

88+
LIFECYCLE_EXPORT
8689
const rcl_state_transition_t*
87-
LIFECYCLE_EXPORT rcl_get_registered_transition_by_index(rcl_state_machine_t* state_machine, unsigned int transition_state_index);
90+
rcl_get_registered_transition_by_index(rcl_state_machine_t* state_machine, unsigned int transition_state_index);
91+
LIFECYCLE_EXPORT
8892
const rcl_state_transition_t*
89-
LIFECYCLE_EXPORT rcl_get_registered_transition_by_label(rcl_state_machine_t* state_machine, const char* transition_state_label);
93+
rcl_get_registered_transition_by_label(rcl_state_machine_t* state_machine, const char* transition_state_label);
9094

95+
LIFECYCLE_EXPORT
9196
rcl_state_t
92-
LIFECYCLE_EXPORT rcl_create_state(unsigned int state, char* label);
97+
rcl_create_state(unsigned int state, char* label);
9398

99+
LIFECYCLE_EXPORT
94100
rcl_state_transition_t
95-
LIFECYCLE_EXPORT rcl_create_transition(rcl_state_t start, rcl_state_t goal);
101+
rcl_create_transition(rcl_state_t start, rcl_state_t goal);
96102

103+
LIFECYCLE_EXPORT
97104
rcl_state_machine_t
98-
LIFECYCLE_EXPORT rcl_get_default_state_machine();
105+
rcl_get_default_state_machine();
99106

107+
LIFECYCLE_EXPORT
100108
void
101-
LIFECYCLE_EXPORT rcl_register_callback(rcl_state_machine_t* state_machine, unsigned int state_index, unsigned int transition_index, bool(*fcn)(void));
109+
rcl_register_callback(rcl_state_machine_t* state_machine, unsigned int state_index, unsigned int transition_index, bool(*fcn)(void));
102110

111+
LIFECYCLE_EXPORT
103112
bool
104-
LIFECYCLE_EXPORT rcl_invoke_transition(rcl_state_machine_t* state_machine, rcl_state_t transition_index);
113+
rcl_invoke_transition(rcl_state_machine_t* state_machine, rcl_state_t transition_index);
105114

106115
#if __cplusplus
107116
}

rclcpp_lifecycle/include/rclcpp_lifecycle/lifecycle_manager.hpp

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,18 @@ class LifecycleManagerInterface
5858
virtual bool deactivate(const std::string& node_name = "") = 0;
5959
};
6060

61-
class LifecycleManager : public LifecycleManagerInterface
61+
class LIFECYCLE_EXPORT LifecycleManager : public LifecycleManagerInterface
6262
{
6363
public:
6464
LifecycleManager();
6565
~LifecycleManager();
6666

67-
LIFECYCLE_EXPORT
6867
void
6968
add_node_interface(const std::shared_ptr<node::lifecycle::LifecycleNodeInterface>& node_interface);
7069

71-
LIFECYCLE_EXPORT
7270
void
7371
add_node_interface(const std::shared_ptr<node::lifecycle::LifecycleNodeInterface>& node_interface, rcl_state_machine_t custom_state_machine);
7472

75-
LIFECYCLE_EXPORT
7673
template<typename T>
7774
bool
7875
register_on_configure(const std::string& node_name, bool(T::*method)(void), T* instance)
@@ -81,15 +78,12 @@ class LifecycleManager : public LifecycleManagerInterface
8178
return register_on_configure(node_name, cb);
8279
}
8380

84-
LIFECYCLE_EXPORT
8581
bool
8682
register_on_configure(const std::string& node_name, std::function<bool(void)>& fcn);
8783

88-
LIFECYCLE_EXPORT
8984
bool
9085
configure(const std::string& node_name = "");
9186

92-
LIFECYCLE_EXPORT
9387
template<typename T>
9488
bool
9589
register_on_cleanup(const std::string& node_name, bool(T::*method)(void), T* instance)
@@ -98,15 +92,12 @@ class LifecycleManager : public LifecycleManagerInterface
9892
return register_on_cleanup(node_name, cb);
9993
}
10094

101-
LIFECYCLE_EXPORT
10295
bool
10396
register_on_cleanup(const std::string& node_name, std::function<bool(void)>& fcn);
10497

105-
LIFECYCLE_EXPORT
10698
bool
10799
cleanup(const std::string& node_name = "");
108100

109-
LIFECYCLE_EXPORT
110101
template<typename T>
111102
bool
112103
register_on_shutdown(const std::string& node_name, bool(T::*method)(void), T* instance)
@@ -115,15 +106,12 @@ class LifecycleManager : public LifecycleManagerInterface
115106
return register_on_shutdown(node_name, cb);
116107
}
117108

118-
LIFECYCLE_EXPORT
119109
bool
120110
register_on_shutdown(const std::string& node_name, std::function<bool(void)>& fcn);
121111

122-
LIFECYCLE_EXPORT
123112
bool
124113
shutdown(const std::string& node_name = "");
125114

126-
LIFECYCLE_EXPORT
127115
template<typename T>
128116
bool
129117
register_on_activate(const std::string& node_name, bool(T::*method)(void), T* instance)
@@ -132,15 +120,12 @@ class LifecycleManager : public LifecycleManagerInterface
132120
return register_on_activate(node_name, cb);
133121
}
134122

135-
LIFECYCLE_EXPORT
136123
bool
137124
register_on_activate(const std::string& node_name, std::function<bool(void)>& fcn);
138125

139-
LIFECYCLE_EXPORT
140126
bool
141127
activate(const std::string& node_name = "");
142128

143-
LIFECYCLE_EXPORT
144129
template<typename T>
145130
bool
146131
register_on_deactivate(const std::string& node_name, bool(T::*method)(void), T* instance)
@@ -149,16 +134,14 @@ class LifecycleManager : public LifecycleManagerInterface
149134
return register_on_deactivate(node_name, cb);
150135
}
151136

152-
LIFECYCLE_EXPORT
153137
bool
154138
register_on_deactivate(const std::string& node_name, std::function<bool(void)>& fcn);
155139

156-
LIFECYCLE_EXPORT
157140
bool
158141
deactivate(const std::string& node_name = "");
159142

160143
private:
161-
class LifecycleManagerImpl;
144+
class LIFECYCLE_EXPORT LifecycleManagerImpl;
162145
std::unique_ptr<LifecycleManagerImpl> impl_;
163146
//LifecycleManagerImpl* impl_;
164147
};

rclcpp_lifecycle/src/rclcpp_lifecycle/lifecycle_manager_impl.hpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
#include <memory>
1919
#include <vector>
2020
#include <map>
21+
#include <functional>
22+
23+
#include <rclcpp_lifecycle/lifecycle_node.hpp>
24+
#include <rclcpp_lifecycle/lifecycle_manager.hpp>
2125

2226
#include <rcl_lifecycle/lifecycle_state.h>
2327
#include <rcl_lifecycle/default_state_machine.h>
@@ -27,8 +31,9 @@ namespace rclcpp
2731
namespace lifecycle
2832
{
2933

30-
using NodeInterfacePtr = std::shared_ptr<node::lifecycle::LifecycleNodeInterface>;
31-
using NodeInterfaceWeakPtr = std::weak_ptr<node::lifecycle::LifecycleNodeInterface>;
34+
using NodeInterface = rclcpp::node::lifecycle::LifecycleNode;
35+
using NodeInterfacePtr = std::shared_ptr<rclcpp::node::lifecycle::LifecycleNodeInterface>;
36+
using NodeInterfaceWeakPtr = std::weak_ptr<rclcpp::node::lifecycle::LifecycleNodeInterface>;
3237

3338
struct NodeStateMachine
3439
{
@@ -37,21 +42,19 @@ struct NodeStateMachine
3742
std::map<LifecycleTransitionsT, std::function<bool(void)>> cb_map;
3843
};
3944

40-
class LifecycleManager::LifecycleManagerImpl
45+
class LIFECYCLE_EXPORT LifecycleManager::LifecycleManagerImpl
4146
{
4247
public:
4348
LifecycleManagerImpl() = default;
4449
~LifecycleManagerImpl() = default;
4550

46-
LIFECYCLE_EXPORT
4751
void
4852
add_node_interface(const NodeInterfacePtr& node_interface)
4953
{
5054
rcl_state_machine_t state_machine = rcl_get_default_state_machine();
5155
add_node_interface(node_interface, state_machine);
5256
}
5357

54-
LIFECYCLE_EXPORT
5558
void
5659
add_node_interface(const NodeInterfacePtr& node_interface, rcl_state_machine_t custom_state_machine)
5760
{
@@ -62,7 +65,6 @@ class LifecycleManager::LifecycleManagerImpl
6265

6366
// register default callbacks
6467
// maybe optional
65-
using NodeInterface = node::lifecycle::LifecycleNodeInterface;
6668
std::function<bool(void)> cb_configuring = std::bind(&NodeInterface::on_configure, node_interface);
6769
std::function<bool(void)> cb_cleaningup = std::bind(&NodeInterface::on_cleanup, node_interface);
6870
std::function<bool(void)> cb_shuttingdown = std::bind(&NodeInterface::on_shutdown, node_interface);

0 commit comments

Comments
 (0)