Skip to content

Commit 35741d3

Browse files
author
iRobot ROS
authored
Merge pull request #26 from alsora/asoragna/make-functions-private
Asoragna/make functions private
2 parents 2259a67 + 4df706d commit 35741d3

File tree

2 files changed

+53
-60
lines changed

2 files changed

+53
-60
lines changed

rclcpp/include/rclcpp/executors/events_executor.hpp

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,58 @@ class EventsExecutor : public rclcpp::Executor
123123
void
124124
remove_node(std::shared_ptr<rclcpp::Node> node_ptr, bool notify = true) override;
125125

126+
/// Add a callback group to an executor.
127+
/**
128+
* \sa rclcpp::Executor::add_callback_group
129+
*/
130+
void
131+
add_callback_group(
132+
rclcpp::CallbackGroup::SharedPtr group_ptr,
133+
rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr,
134+
bool notify = true) override;
135+
136+
/// Remove callback group from the executor
137+
/**
138+
* \sa rclcpp::Executor::remove_callback_group
139+
*/
140+
RCLCPP_PUBLIC
141+
void
142+
remove_callback_group(
143+
rclcpp::CallbackGroup::SharedPtr group_ptr,
144+
bool notify = true) override;
145+
146+
RCLCPP_PUBLIC
147+
std::vector<rclcpp::CallbackGroup::WeakPtr>
148+
get_all_callback_groups() override;
149+
150+
/// Get callback groups that belong to executor.
151+
/**
152+
* \sa rclcpp::Executor::get_manually_added_callback_groups()
153+
*/
154+
RCLCPP_PUBLIC
155+
std::vector<rclcpp::CallbackGroup::WeakPtr>
156+
get_manually_added_callback_groups() override;
157+
158+
/// Get callback groups that belong to executor.
159+
/**
160+
* \sa rclcpp::Executor::get_automatically_added_callback_groups_from_nodes()
161+
*/
162+
RCLCPP_PUBLIC
163+
std::vector<rclcpp::CallbackGroup::WeakPtr>
164+
get_automatically_added_callback_groups_from_nodes() override;
165+
166+
protected:
167+
RCLCPP_PUBLIC
168+
void
169+
spin_once_impl(std::chrono::nanoseconds timeout) override;
170+
171+
private:
172+
RCLCPP_DISABLE_COPY(EventsExecutor)
173+
174+
// Event queue implementation is a deque only to
175+
// facilitate the removal of events from expired entities.
176+
using EventQueue = std::deque<ExecutorEvent>;
177+
126178
// Executor callback: Push new events into the queue and trigger cv.
127179
// This function is called by the DDS entities when an event happened,
128180
// like a subscription receiving a message.
@@ -177,58 +229,6 @@ class EventsExecutor : public rclcpp::Executor
177229
}
178230
}
179231

180-
/// Add a callback group to an executor.
181-
/**
182-
* \sa rclcpp::Executor::add_callback_group
183-
*/
184-
void
185-
add_callback_group(
186-
rclcpp::CallbackGroup::SharedPtr group_ptr,
187-
rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr,
188-
bool notify = true) override;
189-
190-
/// Remove callback group from the executor
191-
/**
192-
* \sa rclcpp::Executor::remove_callback_group
193-
*/
194-
RCLCPP_PUBLIC
195-
void
196-
remove_callback_group(
197-
rclcpp::CallbackGroup::SharedPtr group_ptr,
198-
bool notify = true) override;
199-
200-
RCLCPP_PUBLIC
201-
std::vector<rclcpp::CallbackGroup::WeakPtr>
202-
get_all_callback_groups() override;
203-
204-
/// Get callback groups that belong to executor.
205-
/**
206-
* \sa rclcpp::Executor::get_manually_added_callback_groups()
207-
*/
208-
RCLCPP_PUBLIC
209-
std::vector<rclcpp::CallbackGroup::WeakPtr>
210-
get_manually_added_callback_groups() override;
211-
212-
/// Get callback groups that belong to executor.
213-
/**
214-
* \sa rclcpp::Executor::get_automatically_added_callback_groups_from_nodes()
215-
*/
216-
RCLCPP_PUBLIC
217-
std::vector<rclcpp::CallbackGroup::WeakPtr>
218-
get_automatically_added_callback_groups_from_nodes() override;
219-
220-
protected:
221-
RCLCPP_PUBLIC
222-
void
223-
spin_once_impl(std::chrono::nanoseconds timeout) override;
224-
225-
private:
226-
RCLCPP_DISABLE_COPY(EventsExecutor)
227-
228-
// Event queue implementation is a deque only to
229-
// facilitate the removal of events from expired entities.
230-
using EventQueue = std::deque<ExecutorEvent>;
231-
232232
/// Extract and execute events from the queue until it is empty
233233
RCLCPP_PUBLIC
234234
void

rclcpp/test/rclcpp/executors/test_events_executor.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,10 @@ TEST_F(TestEventsExecutor, notify_waitable)
5252
EXPECT_THROW(notifier->add_to_wait_set(&wait_set), std::runtime_error);
5353
EXPECT_THROW(notifier->is_ready(&wait_set), std::runtime_error);
5454

55-
EventsExecutor executor;
56-
rcl_guard_condition_t gc = rcl_get_zero_initialized_guard_condition();
57-
notifier->add_guard_condition(&gc);
5855
{
5956
auto mock = mocking_utils::patch_and_return(
6057
"lib:rclcpp", rcl_guard_condition_set_events_executor_callback, RCL_RET_ERROR);
61-
EXPECT_THROW(
62-
notifier->set_events_executor_callback(
63-
&executor,
64-
&EventsExecutor::push_event),
65-
std::runtime_error);
58+
EXPECT_THROW(std::make_shared<EventsExecutor>(), std::runtime_error);
6659
}
6760
}
6861

0 commit comments

Comments
 (0)