Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unittest and code cleanup #69

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 4 additions & 28 deletions include/up-transport-zenoh-cpp/ZenohUTransport.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,30 +90,6 @@ struct ZenohUTransport : public UTransport {
using CallableConn = typename UTransport::CallableConn;
using UuriKey = std::string;

struct ListenerKey {
CallableConn listener;
std::string zenoh_key;

ListenerKey(CallableConn listener, const std::string& zenoh_key)
: listener(listener), zenoh_key(zenoh_key) {}

bool operator==(const ListenerKey& other) const {
return listener == other.listener && zenoh_key == other.zenoh_key;
}

bool operator<(const ListenerKey& other) const {
if (listener == other.listener) {
return zenoh_key < other.zenoh_key;
}
return listener < other.listener;
}
};

using RpcCallbackMap = std::map<UuriKey, CallableConn>;
using SubscriberMap = std::map<ListenerKey, zenoh::Subscriber>;
using QueryableMap = std::map<ListenerKey, zenoh::Queryable>;
using QueryMap = std::map<std::string, zenoh::OwnedQueryPtr>;

/// @brief Register listener to be called when UMessage is received
/// for the given URI.
///
Expand Down Expand Up @@ -178,16 +154,16 @@ struct ZenohUTransport : public UTransport {

zenoh::Session session_;

RpcCallbackMap rpc_callback_map_;
std::map<UuriKey, CallableConn> rpc_callback_map_;
std::mutex rpc_callback_map_mutex_;

SubscriberMap subscriber_map_;
std::map<CallableConn, zenoh::Subscriber> subscriber_map_;
std::mutex subscriber_map_mutex_;

QueryableMap queryable_map_;
std::map<CallableConn, zenoh::Queryable> queryable_map_;
std::mutex queryable_map_mutex_;

QueryMap query_map_;
std::map<std::string, zenoh::OwnedQueryPtr> query_map_;
std::mutex query_map_mutex_;
};

Expand Down
Loading