Skip to content

Commit

Permalink
Refs #20823: Uncrustify
Browse files Browse the repository at this point in the history
Signed-off-by: elianalf <[email protected]>
  • Loading branch information
elianalf committed Jun 10, 2024
1 parent 9e491c6 commit 0b0f246
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 25 deletions.
98 changes: 78 additions & 20 deletions examples/cpp/content_filter/CLIParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,82 @@ class CLIParser
static void print_help(
uint8_t return_code)
{
std::cout << "Usage: content_filter <entity> [options]" << std::endl;
std::cout << "" << std::endl;
std::cout << "Entities:" << std::endl;
std::cout << " publisher Run a publisher entity" << std::endl;
std::cout << " subscriber Run a subscriber entity" << std::endl;
std::cout << "" << std::endl;
std::cout << "Common options:" << std::endl;
std::cout << " -h, --help Print this help message" << std::endl;
std::cout << "Publisher options:" << std::endl;
std::cout << " -s <num>, --samples <num> Number of samples to send" << std::endl;
std::cout << " (Default: 0 [unlimited])" << std::endl;
std::cout << " -i <num>, --interval <num> Time between samples in milliseconds" << std::endl;
std::cout << " -f <true/false>, --filter <true/false> Apply filter on the writer side" << std::endl;
std::cout << " (Default: true)" << std::endl;
std::cout << "Subscriber options:" << std::endl;
std::cout << " -f <default/custom/none>, --filter <default/custom/none> Kind of Content Filter to use" << std::endl;
std::cout << " (Default: DDS SQL default filter)" << std::endl;
std::cout << " -lb <num>, --lower-bound <num> Lower bound of the data range to filter" << std::endl;
std::cout << " -up <num>, --upper-bound <num> Upper bound of the data range to filter" << std::endl;
std::cout <<
"Usage: content_filter <entity> [options]"
<<
std::endl;
std::cout <<
""
<<
std::endl;
std::cout <<
"Entities:"
<<
std::endl;
std::cout <<
" publisher Run a publisher entity"
<<
std::endl;
std::cout <<
" subscriber Run a subscriber entity"
<<
std::endl;
std::cout <<
""
<<
std::endl;
std::cout <<
"Common options:"
<<
std::endl;
std::cout <<
" -h, --help Print this help message"
<<
std::endl;
std::cout <<
"Publisher options:"
<<
std::endl;
std::cout <<
" -s <num>, --samples <num> Number of samples to send"
<<
std::endl;
std::cout <<
" (Default: 0 [unlimited])"
<<
std::endl;
std::cout <<
" -i <num>, --interval <num> Time between samples in milliseconds"
<<
std::endl;
std::cout <<
" -f <true/false>, --filter <true/false> Apply filter on the writer side"
<<
std::endl;
std::cout <<
" (Default: true)"
<<
std::endl;
std::cout <<
"Subscriber options:"
<<
std::endl;
std::cout <<
" -f <default/custom/none>, --filter <default/custom/none> Kind of Content Filter to use"
<<
std::endl;
std::cout <<
" (Default: DDS SQL default filter)"
<<
std::endl;
std::cout <<
" -lb <num>, --lower-bound <num> Lower bound of the data range to filter"
<<
std::endl;
std::cout <<
" -up <num>, --upper-bound <num> Upper bound of the data range to filter"
<<
std::endl;
std::exit(return_code);
}

Expand Down Expand Up @@ -175,7 +232,8 @@ class CLIParser
}
else if (config.entity == CLIParser::EntityKind::SUBSCRIBER)
{
EPROSIMA_LOG_ERROR(CLI_PARSER, "samples option option can only be used with the Publisher");
EPROSIMA_LOG_ERROR(CLI_PARSER,
"samples option option can only be used with the Publisher");
print_help(EXIT_FAILURE);
}
else
Expand Down
9 changes: 6 additions & 3 deletions examples/cpp/content_filter/PublisherApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ PublisherApp::PublisherApp(
eprosima::fastrtps::rtps::IPLocator::setIPv4(initial_peer, 127, 0, 0, 1);
pqos.wire_protocol().builtin.initialPeersList.push_back(initial_peer);
pqos.transport().use_builtin_transports = false;
std::shared_ptr<eprosima::fastdds::rtps::UDPv4TransportDescriptor> udp_descriptor = std::make_shared<eprosima::fastdds::rtps::UDPv4TransportDescriptor>();
std::shared_ptr<eprosima::fastdds::rtps::UDPv4TransportDescriptor> udp_descriptor =
std::make_shared<eprosima::fastdds::rtps::UDPv4TransportDescriptor>();
pqos.transport().user_transports.push_back(udp_descriptor);
// Create DomainParticipant in domain 0
participant_ = factory->create_participant(0, pqos);
Expand Down Expand Up @@ -107,12 +108,14 @@ PublisherApp::PublisherApp(
// Create the DataWriter
DataWriterQos wqos = DATAWRITER_QOS_DEFAULT;
wqos.data_sharing().off();
if(config.filtering){
if (config.filtering)
{
wqos.writer_resource_limits().reader_filters_allocation.initial = 0;
wqos.writer_resource_limits().reader_filters_allocation.maximum = 10;
wqos.writer_resource_limits().reader_filters_allocation.increment = 1;
}
else {
else
{
wqos.writer_resource_limits().reader_filters_allocation.maximum = 0;
}
writer_ = publisher_->create_datawriter(topic_, wqos, this);
Expand Down
5 changes: 3 additions & 2 deletions examples/cpp/content_filter/SubscriberApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ SubscriberApp::SubscriberApp(
eprosima::fastrtps::rtps::IPLocator::setIPv4(initial_peer, "127.0.0.1");
pqos.wire_protocol().builtin.initialPeersList.push_back(initial_peer);
pqos.transport().use_builtin_transports = false;
std::shared_ptr<eprosima::fastdds::rtps::UDPv4TransportDescriptor> udp_descriptor = std::make_shared<eprosima::fastdds::rtps::UDPv4TransportDescriptor>();
std::shared_ptr<eprosima::fastdds::rtps::UDPv4TransportDescriptor> udp_descriptor =
std::make_shared<eprosima::fastdds::rtps::UDPv4TransportDescriptor>();
pqos.transport().user_transports.push_back(udp_descriptor);
// Create DomainParticipant
participant_ = factory->create_participant(0, pqos);
Expand Down Expand Up @@ -107,7 +108,7 @@ SubscriberApp::SubscriberApp(
// Create the ContentFilteredTopic
std::string expression;
std::vector<std::string> parameters;
if (config.filter_kind == CLIParser::FIlterKind::CUSTOM)
if (config.filter_kind == CLIParser::FIlterKind::CUSTOM)
{
// Custom filter: reject samples where index > parameters[0] and index < parameters[1].
// Custom filter does not use expression. However, an empty expression disables filtering, so some expression
Expand Down

0 comments on commit 0b0f246

Please sign in to comment.