Skip to content

Commit

Permalink
Fix cpplint warnings (ros2#76)
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Hoinkis <[email protected]>
  • Loading branch information
mossmaurice committed Jan 5, 2023
1 parent 3c278f1 commit 8cd3111
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
15 changes: 10 additions & 5 deletions rmw_iceoryx_cpp/src/internal/iceoryx_topic_names_and_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,14 @@ std::map<std::string, std::string> get_topic_names_and_types()
std::map<std::string, std::string> get_service_names_and_types()
{
std::map<std::string, std::string> names_n_types;
std::map<std::string, std::vector<std::string>> clients_topics; // Currently, no possibility to query for clients..
std::map<std::string, std::vector<std::string>> servers_topics; // Can be discovered via 'ServiceDiscovery'
std::map<std::string, std::vector<std::string>> topic_clients; // Currently, no possibility to query for clients..
std::map<std::string, std::vector<std::string>> topic_servers; // Can be discovered, but missing associated node
// Currently, no possibility to query for clients..
std::map<std::string, std::vector<std::string>> clients_topics;
// Can be discovered via 'ServiceDiscovery'
std::map<std::string, std::vector<std::string>> servers_topics;
// Currently, no possibility to query for clients..
std::map<std::string, std::vector<std::string>> topic_clients;
// Can be discovered, but missing associated node
std::map<std::string, std::vector<std::string>> topic_servers;

std::vector<iox::capro::ServiceDescription> available_servers;

Expand All @@ -167,7 +171,8 @@ std::map<std::string, std::string> get_service_names_and_types()
std::string(server.getEventIDString().c_str()));

names_n_types[std::get<0>(name_and_type)] = std::get<1>(name_and_type);
/// @todo There is no API to find out which 'ServiceDescription' is offered by which node, for now we use 'NodeFoo'..
/// @todo There is no API to find out which 'ServiceDescription' is offered by which node,
/// for now we use 'NodeFoo'..
servers_topics[std::string("NodeFoo")].push_back(
std::get<0>(
name_and_type));
Expand Down
4 changes: 2 additions & 2 deletions rmw_iceoryx_cpp/src/rmw_request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ rmw_take_request(
&iceoryx_server_abstraction->type_supports_,
ros_request);
}
request_header->source_timestamp = 0; // Unsupported until needed
request_header->source_timestamp = 0; // Unsupported until needed
ret = rcutils_system_time_now(&request_header->received_timestamp);
request_header->request_id.sequence_number = iceoryx_request_header->getSequenceId();
request_header->request_id.writer_guid[0] = 42; /// @todo
request_header->request_id.writer_guid[0] = 42; /// @todo

// Hold the loaned request till we send the response in 'rmw_send_response'
iceoryx_server_abstraction->request_payload_ = user_payload;
Expand Down
16 changes: 10 additions & 6 deletions rmw_iceoryx_cpp/src/rmw_response.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ rmw_take_response(
iceoryx_response_payload);
/// @todo check writer guid?
request_header->request_id.sequence_number = iceoryx_response_header->getSequenceId();
request_header->source_timestamp = 0; // Unsupported until needed
request_header->source_timestamp = 0; // Unsupported until needed
ret = rcutils_system_time_now(&request_header->received_timestamp);

if (iceoryx_response_header->getSequenceId() == iceoryx_client_abstraction->sequence_id_ - 1) {
if (iceoryx_response_header->getSequenceId() ==
iceoryx_client_abstraction->sequence_id_ - 1)
{
user_payload = iceoryx_response_payload;
chunk_header = iox::mepoo::ChunkHeader::fromUserPayload(user_payload);
ret = RMW_RET_OK;
Expand Down Expand Up @@ -139,9 +141,10 @@ rmw_send_response(

auto * iceoryx_request_header = iox::popo::RequestHeader::fromPayload(
iceoryx_server_abstraction->request_payload_);
/// @todo Why is it not possible to set the sequence id? Is this automatically done? If so, we need to compare
/// the user-provided sequence id with the one from the 'iceoryx_request_header'
//iceoryx_request_header->setSequenceId(request_header->sequence_number);
/// @todo Why is it not possible to set the sequence id? Is this automatically done? If so,
/// we need to compare the user-provided sequence id with the one from the
/// 'iceoryx_request_header'
// iceoryx_request_header->setSequenceId(request_header->sequence_number);

iceoryx_server->loan(
iceoryx_request_header, iceoryx_server_abstraction->response_size_,
Expand All @@ -158,7 +161,8 @@ rmw_send_response(
&iceoryx_server_abstraction->type_supports_, payload_vector);
memcpy(responsePayload, payload_vector.data(), payload_vector.size());
}
/// @todo Why are the sleep before and after 'send()' needed? rmw_cyclonedds and rmw_fastrtps seem to do something similar in 'rmw_send_response'..
/// @todo Why are the sleeps before and after 'send()' needed?
/// rmw_cyclonedds and rmw_fastrtps seem to do something similar in 'rmw_send_response'..
std::this_thread::sleep_for(std::chrono::milliseconds(100));
iceoryx_server->send(responsePayload).and_then(
[&] {
Expand Down
2 changes: 1 addition & 1 deletion rmw_iceoryx_cpp/src/rmw_service_server_is_available.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "./types/iceoryx_client.hpp"

//#include "iceoryx_posh/runtime/service_discovery.hpp"
// #include "iceoryx_posh/runtime/service_discovery.hpp"

extern "C"
{
Expand Down

0 comments on commit 8cd3111

Please sign in to comment.