Skip to content

Commit

Permalink
Merge branch 'dev/1.0.0' into ahcorde/rolling/1.0.0_windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ahcorde committed Dec 4, 2024
2 parents be37792 + 435186a commit 26ce44f
Show file tree
Hide file tree
Showing 37 changed files with 1,481 additions and 1,597 deletions.
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

11 changes: 1 addition & 10 deletions rmw_zenoh_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

set(RMW_ZENOH_BUILD_WITH_SHARED_MEMORY ON CACHE BOOL "Compile Zenoh RMW with Shared Memory support")

# find dependencies
find_package(ament_cmake REQUIRED)

Expand All @@ -36,8 +34,8 @@ add_library(rmw_zenoh_cpp SHARED
src/detail/logging.cpp
src/detail/message_type_support.cpp
src/detail/qos.cpp
src/detail/rmw_client_data.cpp
src/detail/rmw_context_impl_s.cpp
src/detail/rmw_data_types.cpp
src/detail/rmw_publisher_data.cpp
src/detail/rmw_node_data.cpp
src/detail/rmw_service_data.cpp
Expand Down Expand Up @@ -82,13 +80,6 @@ target_compile_definitions(rmw_zenoh_cpp
RMW_VERSION_PATCH=${rmw_VERSION_PATCH}
)

if(${RMW_ZENOH_BUILD_WITH_SHARED_MEMORY})
target_compile_definitions(rmw_zenoh_cpp
PRIVATE
RMW_ZENOH_BUILD_WITH_SHARED_MEMORY
)
endif()

ament_export_targets(export_rmw_zenoh_cpp)

register_rmw_implementation(
Expand Down
2 changes: 2 additions & 0 deletions rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,8 @@
/// A probing procedure for shared memory is performed upon session opening. To enable zenoh to operate
/// over shared memory (and to not fallback on network mode), shared memory needs to be enabled also on the
/// subscriber side. By doing so, the probing procedure will succeed and shared memory will operate as expected.
///
/// ROS setting: disabled by default until fully tested
enabled: false,
},
auth: {
Expand Down
2 changes: 2 additions & 0 deletions rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_SESSION_CONFIG.json5
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@
/// A probing procedure for shared memory is performed upon session opening. To enable zenoh to operate
/// over shared memory (and to not fallback on network mode), shared memory needs to be enabled also on the
/// subscriber side. By doing so, the probing procedure will succeed and shared memory will operate as expected.
///
/// ROS setting: disabled by default until fully tested
enabled: false,
},
auth: {
Expand Down
8 changes: 4 additions & 4 deletions rmw_zenoh_cpp/src/detail/attachment_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
namespace rmw_zenoh_cpp
{

attachement_data_t::attachement_data_t(
attachment_data_t::attachment_data_t(
const int64_t _sequence_number,
const int64_t _source_timestamp,
const uint8_t _source_gid[RMW_GID_STORAGE_SIZE])
Expand All @@ -37,14 +37,14 @@ attachement_data_t::attachement_data_t(
memcpy(source_gid, _source_gid, RMW_GID_STORAGE_SIZE);
}

attachement_data_t::attachement_data_t(attachement_data_t && data)
attachment_data_t::attachment_data_t(attachment_data_t && data)
{
sequence_number = std::move(data.sequence_number);
source_timestamp = std::move(data.source_timestamp);
memcpy(source_gid, data.source_gid, RMW_GID_STORAGE_SIZE);
}

void attachement_data_t::serialize_to_zbytes(z_owned_bytes_t * attachment)
void attachment_data_t::serialize_to_zbytes(z_owned_bytes_t * attachment)
{
ze_owned_serializer_t serializer;
ze_serializer_empty(&serializer);
Expand All @@ -57,7 +57,7 @@ void attachement_data_t::serialize_to_zbytes(z_owned_bytes_t * attachment)
ze_serializer_finish(z_move(serializer), attachment);
}

attachement_data_t::attachement_data_t(const z_loaned_bytes_t * attachment)
attachment_data_t::attachment_data_t(const z_loaned_bytes_t * attachment)
{
ze_deserializer_t deserializer = ze_deserializer_from_bytes(attachment);
z_owned_string_t key;
Expand Down
8 changes: 4 additions & 4 deletions rmw_zenoh_cpp/src/detail/attachment_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
namespace rmw_zenoh_cpp
{

class attachement_data_t final
class attachment_data_t final
{
public:
explicit attachement_data_t(
explicit attachment_data_t(
const int64_t _sequence_number,
const int64_t _source_timestamp,
const uint8_t _source_gid[RMW_GID_STORAGE_SIZE]);
explicit attachement_data_t(const z_loaned_bytes_t *);
explicit attachement_data_t(attachement_data_t && data);
explicit attachment_data_t(const z_loaned_bytes_t *);
explicit attachment_data_t(attachment_data_t && data);

int64_t sequence_number;
int64_t source_timestamp;
Expand Down
18 changes: 9 additions & 9 deletions rmw_zenoh_cpp/src/detail/graph_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <memory>
#include <mutex>
#include <optional>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
Expand All @@ -35,7 +36,6 @@

#include "graph_cache.hpp"
#include "logging_macros.hpp"
#include "rmw_data_types.hpp"

namespace rmw_zenoh_cpp
{
Expand Down Expand Up @@ -612,10 +612,10 @@ void GraphCache::parse_del(

if (entity->type() == EntityType::Node) {
// Node
// In case the remote Node closed abruptly or was disconnected, Zenoh could deliver the
// liveliness tokens unregistration events in any order.
// If the event for Node unregistration comes before the unregistration of its
// pubs/subs/services, we should update the count in graph_topics_ and graph_services_.
// When destroying a node, Zenoh does not guarantee that liveliness tokens to remove pub/subs
// arrive before the one to remove the node from the graph despite un-registering those entities
// earlier. In such scenarios, if we find any pub/subs present in the node, we reduce their
// counts in graph_topics_.
const GraphNodePtr graph_node = node_it->second;
if (!graph_node->pubs_.empty() ||
!graph_node->subs_.empty() ||
Expand Down Expand Up @@ -1182,15 +1182,15 @@ rmw_ret_t GraphCache::get_entities_info_by_topic(

///=============================================================================
rmw_ret_t GraphCache::service_server_is_available(
const char * service_name,
const char * service_type,
const liveliness::TopicInfo & client_topic_info,
bool * is_available) const
{
*is_available = false;
std::lock_guard<std::mutex> lock(graph_mutex_);
GraphNode::TopicMap::const_iterator service_it = graph_services_.find(service_name);
GraphNode::TopicMap::const_iterator service_it = graph_services_.find(client_topic_info.name_);
if (service_it != graph_services_.end()) {
GraphNode::TopicTypeMap::const_iterator type_it = service_it->second.find(service_type);
GraphNode::TopicTypeMap::const_iterator type_it =
service_it->second.find(client_topic_info.type_);
if (type_it != service_it->second.end()) {
for (const auto & [_, topic_data] : type_it->second) {
if (topic_data->subs_.size() > 0) {
Expand Down
8 changes: 5 additions & 3 deletions rmw_zenoh_cpp/src/detail/graph_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include "event.hpp"
#include "liveliness_utils.hpp"
#include "ordered_map.hpp"

#include "rcutils/allocator.h"
#include "rcutils/types.h"

#include "rmw/topic_endpoint_info_array.h"
#include "rmw/rmw.h"
#include "rmw/get_topic_endpoint_info.h"
#include "rmw/names_and_types.h"


Expand Down Expand Up @@ -169,8 +172,7 @@ class GraphCache final
rmw_topic_endpoint_info_array_t * endpoints_info) const;

rmw_ret_t service_server_is_available(
const char * service_name,
const char * service_type,
const liveliness::TopicInfo & client_topic_info,
bool * is_available) const;

/// Set a qos event callback for an entity from the current session.
Expand Down
5 changes: 3 additions & 2 deletions rmw_zenoh_cpp/src/detail/liveliness_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@

#include "liveliness_utils.hpp"

#include <zenoh.h>

#include <functional>
#include <limits>
#include <optional>
#include <random>
#include <sstream>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <utility>
#include <vector>
Expand All @@ -31,6 +30,8 @@
#include "qos.hpp"
#include "simplified_xxhash3.hpp"

#include "rcpputils/scope_exit.hpp"

#include "rmw/error_handling.h"

namespace rmw_zenoh_cpp
Expand Down
1 change: 1 addition & 0 deletions rmw_zenoh_cpp/src/detail/liveliness_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <memory>
#include <optional>
#include <string>
#include <vector>

#include "rmw/types.h"

Expand Down
Loading

0 comments on commit 26ce44f

Please sign in to comment.