Skip to content

Commit

Permalink
chore: make iron ament_uncrustify happy
Browse files Browse the repository at this point in the history
  • Loading branch information
YuanYuYuan committed Sep 5, 2024
1 parent 458414d commit bf49775
Show file tree
Hide file tree
Showing 9 changed files with 1,362 additions and 1,127 deletions.
20 changes: 11 additions & 9 deletions rmw_zenoh_cpp/src/detail/attachment_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
namespace rmw_zenoh_cpp
{

bool create_attachment_iter(z_owned_bytes_t *kv_pair, void *context)
bool create_attachment_iter(z_owned_bytes_t * kv_pair, void * context)
{
attachement_context_t *ctx = reinterpret_cast<attachement_context_t *>(context);
attachement_context_t * ctx = reinterpret_cast<attachement_context_t *>(context);
z_owned_bytes_t k, v;

if (ctx->idx == 0) {
Expand All @@ -40,8 +40,9 @@ bool create_attachment_iter(z_owned_bytes_t *kv_pair, void *context)
z_bytes_serialize_from_int64(&v, ctx->data->source_timestamp);
} else if (ctx->idx == 2) {
z_bytes_serialize_from_str(&k, "source_gid");
z_bytes_serialize_from_buf(&v, ctx->data->source_gid,
RMW_GID_STORAGE_SIZE);
z_bytes_serialize_from_buf(
&v, ctx->data->source_gid,
RMW_GID_STORAGE_SIZE);
} else {
return false;
}
Expand All @@ -51,16 +52,17 @@ bool create_attachment_iter(z_owned_bytes_t *kv_pair, void *context)
return true;
}

z_result_t attachement_data_t::serialize_to_zbytes(z_owned_bytes_t *attachment)
z_result_t attachement_data_t::serialize_to_zbytes(z_owned_bytes_t * attachment)
{
attachement_context_t context = attachement_context_t(this);
return z_bytes_from_iter(attachment, create_attachment_iter,
reinterpret_cast<void *>(&context));
return z_bytes_from_iter(
attachment, create_attachment_iter,
reinterpret_cast<void *>(&context));
}

bool get_attachment(
const z_loaned_bytes_t *const attachment,
const std::string & key, z_owned_bytes_t *val)
const std::string & key, z_owned_bytes_t * val)
{
if (z_bytes_is_empty(attachment)) {
return false;
Expand Down Expand Up @@ -141,7 +143,7 @@ int64_t get_int64_from_attachment(
z_owned_bytes_t val;
if (!get_attachment(attachment, name, &val)) {
RMW_ZENOH_LOG_ERROR_NAMED(
"rmw_zenoh_cpp", "Failed to deserialize int64 from the attachment.")
"rmw_zenoh_cpp", "Failed to deserialize int64 from the attachment.")
return false;
}

Expand Down
12 changes: 7 additions & 5 deletions rmw_zenoh_cpp/src/detail/attachment_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
namespace rmw_zenoh_cpp
{

class attachement_data_t final {
class attachement_data_t final
{
public:
int64_t sequence_number;
int64_t source_timestamp;
Expand All @@ -41,19 +42,20 @@ class attachement_data_t final {
z_result_t serialize_to_zbytes(z_owned_bytes_t *);
};

class attachement_context_t final {
class attachement_context_t final
{
public:
const attachement_data_t *data;
const attachement_data_t * data;
int length = 3;
int idx = 0;

attachement_context_t(const attachement_data_t *_data)
attachement_context_t(const attachement_data_t * _data)
: data(_data) {}
};

bool get_attachment(
const z_loaned_bytes_t *const attachment,
const std::string & key, z_owned_bytes_t *val);
const std::string & key, z_owned_bytes_t * val);

bool get_gid_from_attachment(
const z_loaned_bytes_t *const attachment,
Expand Down
4 changes: 2 additions & 2 deletions rmw_zenoh_cpp/src/detail/graph_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,8 @@ rmw_ret_t GraphCache::get_node_names(
rcutils_ret_t ret = rcutils_string_array_fini(enclaves);
if (ret != RCUTILS_RET_OK) {
RMW_ZENOH_LOG_ERROR_NAMED(
"rmw_zenoh_cpp",
"failed to cleanup during error handling: %s", rcutils_get_error_string().str);
"rmw_zenoh_cpp",
"failed to cleanup during error handling: %s", rcutils_get_error_string().str);
}
};

Expand Down
10 changes: 5 additions & 5 deletions rmw_zenoh_cpp/src/detail/logging_macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
// invoke GraphCache::parse_put() and GraphCache::parse_del() functions.
// See https://github.com/ros2/rmw_zenoh/issues/182 for more details.
#define RMW_ZENOH_LOG_DEBUG_NAMED(...) {rmw_zenoh_cpp::Logger::get().log_named( \
RCUTILS_LOG_SEVERITY_DEBUG, __func__, __FILE__, __LINE__, __VA_ARGS__);}
RCUTILS_LOG_SEVERITY_DEBUG, __func__, __FILE__, __LINE__, __VA_ARGS__);}
#define RMW_ZENOH_LOG_ERROR_NAMED(...) {rmw_zenoh_cpp::Logger::get().log_named( \
RCUTILS_LOG_SEVERITY_ERROR, __func__, __FILE__, __LINE__, __VA_ARGS__);}
RCUTILS_LOG_SEVERITY_ERROR, __func__, __FILE__, __LINE__, __VA_ARGS__);}
#define RMW_ZENOH_LOG_FATAL_NAMED(...) {rmw_zenoh_cpp::Logger::get().log_named( \
RCUTILS_LOG_SEVERITY_FATAL, __func__, __FILE__, __LINE__, __VA_ARGS__);}
RCUTILS_LOG_SEVERITY_FATAL, __func__, __FILE__, __LINE__, __VA_ARGS__);}
#define RMW_ZENOH_LOG_INFO_NAMED(...) {rmw_zenoh_cpp::Logger::get().log_named( \
RCUTILS_LOG_SEVERITY_INFO, __func__, __FILE__, __LINE__, __VA_ARGS__);}
RCUTILS_LOG_SEVERITY_INFO, __func__, __FILE__, __LINE__, __VA_ARGS__);}
#define RMW_ZENOH_LOG_WARN_NAMED(...) {rmw_zenoh_cpp::Logger::get().log_named( \
RCUTILS_LOG_SEVERITY_WARN, __func__, __FILE__, __LINE__, __VA_ARGS__);}
RCUTILS_LOG_SEVERITY_WARN, __func__, __FILE__, __LINE__, __VA_ARGS__);}

#endif // DETAIL__LOGGING_MACROS_HPP_
2 changes: 1 addition & 1 deletion rmw_zenoh_cpp/src/detail/qos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace rmw_zenoh_cpp
{
//==============================================================================
/// Signature matching rmw_get_publishers_info_by_topic and rmw_get_subscriptions_info_by_topic
using GetEndpointInfoByTopicFunction = std::function<rmw_ret_t(
using GetEndpointInfoByTopicFunction = std::function<rmw_ret_t (
const rmw_node_t *,
rcutils_allocator_t *,
const char *,
Expand Down
Loading

0 comments on commit bf49775

Please sign in to comment.