Skip to content

Commit ef94df5

Browse files
fix build with updated ros container, clangd fixes (#11)
* fix build with updated ros container, clangd-tidy fixes, bump markdown pre-commit hook
1 parent 5182ec0 commit ef94df5

3 files changed

Lines changed: 27 additions & 13 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,9 @@ repos:
5555
files: \.(yml|yaml)$
5656

5757
- repo: https://github.com/tcort/markdown-link-check
58-
rev: v3.12.2
58+
rev: v3.13.6
5959
hooks:
6060
- id: markdown-link-check
61-
args:
62-
- "-c"
63-
- "markdown-link-check-config.json"
6461

6562
- repo: https://github.com/cheshirekow/cmake-format-precommit
6663
rev: v0.6.10

fuse_core/include/fuse_core/callback_wrapper.hpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ namespace fuse_core
9999
class CallbackWrapperBase
100100
{
101101
public:
102+
virtual ~CallbackWrapperBase() = default;
103+
CallbackWrapperBase() = default;
104+
CallbackWrapperBase(CallbackWrapperBase const&) = default;
105+
CallbackWrapperBase(CallbackWrapperBase&&) = default;
106+
CallbackWrapperBase& operator=(CallbackWrapperBase const&) = default;
107+
CallbackWrapperBase& operator=(CallbackWrapperBase&&) = default;
102108
/**
103109
* @brief Call this function. This is used by the callback queue.
104110
*/
@@ -153,7 +159,7 @@ inline void CallbackWrapper<void>::call()
153159
class CallbackAdapter : public rclcpp::Waitable
154160
{
155161
public:
156-
explicit CallbackAdapter(std::shared_ptr<rclcpp::Context> context_ptr);
162+
explicit CallbackAdapter(std::shared_ptr<rclcpp::Context> const& context_ptr);
157163

158164
/**
159165
* @brief tell the CallbackGroup how many guard conditions are ready in this waitable
@@ -183,6 +189,17 @@ class CallbackAdapter : public rclcpp::Waitable
183189

184190
void removeAllCallbacks();
185191

192+
void set_on_ready_callback(std::function<void(size_t, int)> /*callback*/) override
193+
{
194+
}
195+
void clear_on_ready_callback() override
196+
{
197+
}
198+
std::shared_ptr<void> take_data_by_entity_id(size_t /*id*/) override
199+
{
200+
return nullptr;
201+
}
202+
186203
private:
187204
rcl_guard_condition_t gc_; //!< guard condition to drive the waitable
188205

fuse_core/src/callback_wrapper.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@
3737
namespace fuse_core
3838
{
3939

40-
CallbackAdapter::CallbackAdapter(std::shared_ptr<rclcpp::Context> context_ptr)
40+
CallbackAdapter::CallbackAdapter(std::shared_ptr<rclcpp::Context> const& context_ptr)
41+
: gc_(rcl_get_zero_initialized_guard_condition())
4142
{
42-
rcl_guard_condition_options_t guard_condition_options = rcl_guard_condition_get_default_options();
43+
rcl_guard_condition_options_t const guard_condition_options = rcl_guard_condition_get_default_options();
4344

4445
// Guard condition is used by the wait set to handle execute-or-not logic
45-
gc_ = rcl_get_zero_initialized_guard_condition();
4646
if (RCL_RET_OK != rcl_guard_condition_init(&gc_, context_ptr->get_rcl_context().get(), guard_condition_options))
4747
{
4848
throw std::runtime_error("Could not init guard condition for callback waitable.");
@@ -74,7 +74,7 @@ bool CallbackAdapter::is_ready(rcl_wait_set_t const& wait_set)
7474
*/
7575
void CallbackAdapter::add_to_wait_set(rcl_wait_set_t& wait_set)
7676
{
77-
if (RCL_RET_OK != rcl_wait_set_add_guard_condition(&wait_set, &gc_, NULL))
77+
if (RCL_RET_OK != rcl_wait_set_add_guard_condition(&wait_set, &gc_, nullptr))
7878
{
7979
RCLCPP_WARN(rclcpp::get_logger("fuse"), "Could not add callback waitable to wait set.");
8080
}
@@ -89,7 +89,7 @@ std::shared_ptr<void> CallbackAdapter::take_data()
8989
std::shared_ptr<CallbackWrapperBase> cb_wrapper = nullptr;
9090
// fetch the callback ptr and release the lock without spending time in the callback
9191
{
92-
std::lock_guard<std::mutex> lock(queue_mutex_);
92+
std::lock_guard<std::mutex> const lock(queue_mutex_);
9393
if (!callback_queue_.empty())
9494
{
9595
cb_wrapper = callback_queue_.front();
@@ -122,7 +122,7 @@ void CallbackAdapter::execute(std::shared_ptr<void> const& data)
122122

123123
void CallbackAdapter::addCallback(const std::shared_ptr<CallbackWrapperBase>& callback)
124124
{
125-
std::lock_guard<std::mutex> lock(queue_mutex_);
125+
std::lock_guard<std::mutex> const lock(queue_mutex_);
126126
callback_queue_.push_back(callback);
127127
if (RCL_RET_OK != rcl_trigger_guard_condition(&gc_))
128128
{
@@ -134,7 +134,7 @@ void CallbackAdapter::addCallback(const std::shared_ptr<CallbackWrapperBase>& ca
134134

135135
void CallbackAdapter::addCallback(std::shared_ptr<CallbackWrapperBase>&& callback)
136136
{
137-
std::lock_guard<std::mutex> lock(queue_mutex_);
137+
std::lock_guard<std::mutex> const lock(queue_mutex_);
138138
callback_queue_.push_back(std::move(callback));
139139
if (RCL_RET_OK != rcl_trigger_guard_condition(&gc_))
140140
{
@@ -146,7 +146,7 @@ void CallbackAdapter::addCallback(std::shared_ptr<CallbackWrapperBase>&& callbac
146146

147147
void CallbackAdapter::removeAllCallbacks()
148148
{
149-
std::lock_guard<std::mutex> lock(queue_mutex_);
149+
std::lock_guard<std::mutex> const lock(queue_mutex_);
150150
callback_queue_.clear();
151151
}
152152

0 commit comments

Comments
 (0)