Skip to content

Commit

Permalink
Use compact mode by default
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Sanchez-Mateos <[email protected]>
  • Loading branch information
rsanchez15 committed Oct 10, 2024
1 parent d69fca4 commit 7bae0e2
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 79 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Nightly test workflow for DDS Record & Replay
name: nightly

on:
schedule:
- cron: '0 5 * * *'

jobs:

reusable_tests_v2:
name: reusable_tests_v2
uses: ./.github/workflows/reusable-workflow.yml
with:
custom_version_build: 'v2'
dependencies_artifact_postfix: '_nightly'
ref: '0.x'
secrets: inherit

reusable_tests_v3:
name: reusable_tests_v3
uses: ./.github/workflows/reusable-workflow.yml
with:
custom_version_build: 'v3'
dependencies_artifact_postfix: '_nightly'
ref: 'main'
secrets: inherit
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,9 @@ struct ModelParser
const ddspipe::core::types::Guid& guid) noexcept;

FASTDDSSPY_PARTICIPANTS_DllAPI
static std::set<eprosima::ddspipe::core::types::DdsTopic> get_topics(
const SpyModel& model) noexcept;
FASTDDSSPY_PARTICIPANTS_DllAPI
static std::set<eprosima::ddspipe::core::types::DdsTopic> get_topics(
const SpyModel& model,
const ddspipe::core::types::WildcardDdsFilterTopic& filter_topic) noexcept;
const ddspipe::core::types::WildcardDdsFilterTopic& filter_topic = ddspipe::core::types::WildcardDdsFilterTopic()) noexcept;

FASTDDSSPY_PARTICIPANTS_DllAPI
static SimpleTopicData simple_topic_data(
Expand All @@ -81,14 +78,12 @@ struct ModelParser

FASTDDSSPY_PARTICIPANTS_DllAPI
static std::vector<SimpleTopicData> topics(
const SpyModel& model) noexcept;
FASTDDSSPY_PARTICIPANTS_DllAPI
static std::vector<ComplexTopicData> topics_verbose(
const SpyModel& model) noexcept;
const SpyModel& model,
const ddspipe::core::types::WildcardDdsFilterTopic& filter_topic = ddspipe::core::types::WildcardDdsFilterTopic()) noexcept;
FASTDDSSPY_PARTICIPANTS_DllAPI
static std::vector<ComplexTopicData> topics_verbose(
const SpyModel& model,
const ddspipe::core::types::WildcardDdsFilterTopic& filter_topic) noexcept;
const ddspipe::core::types::WildcardDdsFilterTopic& filter_topic = ddspipe::core::types::WildcardDdsFilterTopic()) noexcept;
};

} /* namespace participants */
Expand Down
43 changes: 5 additions & 38 deletions fastddsspy_participants/src/cpp/visualization/ModelParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,29 +291,9 @@ ComplexEndpointData ModelParser::readers(
return result;
}

/*
* This is an auxiliary function that is used to get topics endpoint database
*/
std::set<eprosima::ddspipe::core::types::DdsTopic> ModelParser::get_topics(
const SpyModel& model) noexcept
{
std::set<eprosima::ddspipe::core::types::DdsTopic> result;
for (const auto& endpoint : model.endpoint_database_)
{
if (endpoint.second.active)
{
result.insert(endpoint.second.topic);
}
}
return result;
}

/*
* This is an auxiliary function that is used to get topics endpoint database that match with a regex topic_name
*/
std::set<eprosima::ddspipe::core::types::DdsTopic> ModelParser::get_topics(
const SpyModel& model,
const ddspipe::core::types::WildcardDdsFilterTopic& filter_topic) noexcept
const ddspipe::core::types::WildcardDdsFilterTopic& filter_topic /* = WildcardDdsFilterTopic() */) noexcept
{
std::set<eprosima::ddspipe::core::types::DdsTopic> result;
for (const auto& endpoint : model.endpoint_database_)
Expand Down Expand Up @@ -391,11 +371,12 @@ ComplexTopicData ModelParser::complex_topic_data(
}

std::vector<SimpleTopicData> ModelParser::topics(
const SpyModel& model) noexcept
const SpyModel& model,
const ddspipe::core::types::WildcardDdsFilterTopic& filter_topic /* = WildcardDdsFilterTopic() */) noexcept
{
std::vector<SimpleTopicData> result;

std::set<eprosima::ddspipe::core::types::DdsTopic> endpoints_topics = get_topics(model);
std::set<eprosima::ddspipe::core::types::DdsTopic> endpoints_topics = get_topics(model, filter_topic);
for (const auto& topic : endpoints_topics)
{
result.push_back(simple_topic_data(model, topic));
Expand All @@ -404,23 +385,9 @@ std::vector<SimpleTopicData> ModelParser::topics(
return result;
}

std::vector<ComplexTopicData> ModelParser::topics_verbose(
const SpyModel& model) noexcept
{
std::vector<ComplexTopicData> result;

std::set<eprosima::ddspipe::core::types::DdsTopic> endpoints_topics = get_topics(model);
for (const auto& topic : endpoints_topics)
{
result.push_back(complex_topic_data(model, topic));
}

return result;
}

std::vector<ComplexTopicData> ModelParser::topics_verbose(
const SpyModel& model,
const ddspipe::core::types::WildcardDdsFilterTopic& filter_topic) noexcept
const ddspipe::core::types::WildcardDdsFilterTopic& filter_topic /* = WildcardDdsFilterTopic() */) noexcept
{
std::vector<ComplexTopicData> result;

Expand Down
2 changes: 1 addition & 1 deletion fastddsspy_tool/src/cpp/tool/Command.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ eProsima_ENUMERATION_BUILDER(
{ CommandValue::datawriter COMMA {"datawriter" COMMA "datawriters" COMMA "w" COMMA "W" COMMA "writer" COMMA "writers" COMMA "publication" COMMA "publications"}} COMMA
{ CommandValue::datareader COMMA {"datareader" COMMA "datareaders" COMMA "r" COMMA "R" COMMA "reader" COMMA "readers" COMMA "subscription" COMMA "subscriptions"}} COMMA
{ CommandValue::topic COMMA {"topic" COMMA "topics" COMMA "t" COMMA "T"}} COMMA
{ CommandValue::print COMMA {"print" COMMA "show" COMMA "s" COMMA "S"}} COMMA
{ CommandValue::print COMMA {"echo" COMMA "print" COMMA "show" COMMA "s" COMMA "S"}} COMMA
}
);

Expand Down
101 changes: 72 additions & 29 deletions fastddsspy_tool/src/cpp/tool/Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,6 @@ void Controller::data_stream_callback_verbose_(
view_.show("---\n");
}

bool Controller::compact_argument_(
const std::string& argument) const noexcept
{
return (
(argument == "compact")
|| (argument == "c")
|| (argument == "-c")
|| (argument == "--c")
|| (argument == "C"));
}

bool Controller::verbose_argument_(
const std::string& argument) const noexcept
{
Expand All @@ -216,6 +205,16 @@ bool Controller::verbose_argument_(
|| (argument == "V"));
}

bool Controller::verbose_verbose_argument_(
const std::string& argument) const noexcept
{
return (
(argument == "verbose2")
|| (argument == "vv")
|| (argument == "--vv")
|| (argument == "VV"));
}

bool Controller::all_argument_(
const std::string& argument) const noexcept
{
Expand Down Expand Up @@ -299,37 +298,81 @@ void Controller::topics_command_(
if (arguments.size() == 1)
{
// all participants simple
ddspipe::yaml::set(yml, participants::ModelParser::topics(*model_), false);
ddspipe::yaml::set(yml, participants::ModelParser::topics(*model_), true);
}
else
else if (arguments.size() >= 2)
{
const std::string& option = arguments[1];
const std::string& arg_1 = arguments[1];

if (compact_argument_(option))
if (verbose_argument_(arg_1))
{
// Handle 'topics compact'
ddspipe::yaml::set(yml, participants::ModelParser::topics(*model_), true);
// Handle 'topics verbose'
ddspipe::yaml::set(yml, participants::ModelParser::topics(*model_), false);
}
else if (verbose_argument_(option))
else if (verbose_verbose_argument_(arg_1))
{
// Handle 'topics verbose'
// Handle 'topics verbose2'
ddspipe::yaml::set(yml, participants::ModelParser::topics_verbose(*model_));
}
else
{
// Handle 'topics <name>'
ddspipe::core::types::WildcardDdsFilterTopic filter_topic;
filter_topic.topic_name = option;
auto data = participants::ModelParser::topics_verbose(*model_, filter_topic);
if (data.empty())
filter_topic.topic_name = arg_1;

if (arguments.size() == 3)
{
view_.show_error(STR_ENTRY
<< "<"
<< arguments[1]
<< "> topic does not exist in the DDS network.");
return;
const std::string& arg_2 = arguments[2];

if (verbose_argument_(arg_2))
{
// Handle 'topics <name> verbose'
auto data = participants::ModelParser::topics(*model_, filter_topic);

if (data.empty())
{
view_.show_error(STR_ENTRY
<< "<"
<< arguments[1]
<< "> does not match any topic in the DDS network.");
return;
}

ddspipe::yaml::set(yml, data, false);
}
else if (verbose_verbose_argument_(arg_2))
{
// Handle 'topics <name> verbose2'
auto data = participants::ModelParser::topics_verbose(*model_, filter_topic);

if (data.empty())
{
view_.show_error(STR_ENTRY
<< "<"
<< arguments[1]
<< "> does not match any topic in the DDS network.");
return;
}

ddspipe::yaml::set_collection(yml, data);
}
}
ddspipe::yaml::set_collection(yml, data);
else
{
// Handle 'topics <name>'
auto data = participants::ModelParser::topics(*model_, filter_topic);

if (data.empty())
{
view_.show_error(STR_ENTRY
<< "<"
<< arguments[1]
<< "> does not match any topic in the DDS network.");
return;
}

ddspipe::yaml::set(yml, data, true);
}

}
}

Expand Down
4 changes: 2 additions & 2 deletions fastddsspy_tool/src/cpp/tool/Controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ class Controller

/////////////////////
// PARSE ARGUMENTS
bool compact_argument_(
bool verbose_argument_(
const std::string& argument) const noexcept;

bool verbose_argument_(
bool verbose_verbose_argument_(
const std::string& argument) const noexcept;

bool all_argument_(
Expand Down

0 comments on commit 7bae0e2

Please sign in to comment.