Skip to content

Commit

Permalink
Refs #21095: Linter all except from types
Browse files Browse the repository at this point in the history
Signed-off-by: Mario Dominguez <[email protected]>
  • Loading branch information
Mario-DL committed Jun 7, 2024
1 parent 1c69fbe commit a251a3e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
19 changes: 10 additions & 9 deletions examples/cpp/discovery_server/CLIParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,21 @@ class CLIParser

//! Publisher client configuration structure
struct client_publisher_config : public common_config,
public pubsub_config
public pubsub_config
{
uint16_t interval{100};
};

//! Subscriber client configuration structure
struct client_subscriber_config : public common_config,
public pubsub_config
public pubsub_config
{
};

//! Server configuration structure
//! A server can, in turn, act as a client
struct server_config : public common_config,
public client_config
public client_config
{
bool is_also_client{false};
uint16_t listening_port{16166};
Expand All @@ -106,16 +106,16 @@ class CLIParser
client_subscriber_config sub_config;
server_config srv_config;

friend std::ostream& operator<< (
std::ostream& os,
const ds_example_config& config)
friend std::ostream& operator << (
std::ostream& os,
const ds_example_config& config)
{
os << "Entity: " << parse_entity_kind(config.entity) << std::endl;
os << "Common options:" << std::endl;
os << " Transport: " << static_cast<int>(config.pub_config.transport_kind) << std::endl;

if (config.entity != CLIParser::EntityKind::SERVER ||
(config.entity == CLIParser::EntityKind::SERVER && config.srv_config.is_also_client))
(config.entity == CLIParser::EntityKind::SERVER && config.srv_config.is_also_client))
{
os << "Client options:" << std::endl;
os << " Connection address: " << config.pub_config.connection_address << std::endl;
Expand Down Expand Up @@ -147,6 +147,7 @@ class CLIParser

return os;
}

};

/**
Expand Down Expand Up @@ -442,7 +443,7 @@ class CLIParser
else
{
if (config.entity == CLIParser::EntityKind::CLIENT_PUBLISHER ||
config.entity == CLIParser::EntityKind::CLIENT_SUBSCRIBER)
config.entity == CLIParser::EntityKind::CLIENT_SUBSCRIBER)
{
config.pub_config.samples = static_cast<uint16_t>(input);
config.sub_config.samples = static_cast<uint16_t>(input);
Expand Down Expand Up @@ -492,7 +493,7 @@ class CLIParser
{
int input = std::stoi(argv[i]);
if (input < std::numeric_limits<std::uint16_t>::min() ||
input > std::numeric_limits<std::uint16_t>::max())
input > std::numeric_limits<std::uint16_t>::max())
{
throw std::out_of_range("interval argument out of range");
}
Expand Down
16 changes: 9 additions & 7 deletions examples/cpp/discovery_server/ServerApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,12 @@ void ServerApp::run()
{
bool timeout = false;
cv_.wait_for(period_lock, std::chrono::seconds(timeout_), [&]()
{
timeout = ((std::chrono::steady_clock::now() - start_time_) >= std::chrono::milliseconds(timeout_ * 1000));
return is_stopped() || timeout;
});
{
timeout =
((std::chrono::steady_clock::now() - start_time_) >=
std::chrono::milliseconds(timeout_ * 1000));
return is_stopped() || timeout;
});

if (timeout)
{
Expand All @@ -260,9 +262,9 @@ void ServerApp::run()
else
{
cv_.wait(period_lock, [&]()
{
return is_stopped();
});
{
return is_stopped();
});
}
}
}
Expand Down

0 comments on commit a251a3e

Please sign in to comment.