From bc74469db770faaf5f77e9a6fb63620414b92bcf Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Wed, 8 Jan 2025 09:44:15 +0100 Subject: [PATCH] DPL: remove bloat Exposing std::regex not really needed. --- .../Framework/DataDescriptorQueryBuilder.h | 12 +++++------- Framework/Core/src/DataDescriptorQueryBuilder.cxx | 15 ++++++++++----- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Framework/Core/include/Framework/DataDescriptorQueryBuilder.h b/Framework/Core/include/Framework/DataDescriptorQueryBuilder.h index f920583b3e08e..cd32b57dfbcbc 100644 --- a/Framework/Core/include/Framework/DataDescriptorQueryBuilder.h +++ b/Framework/Core/include/Framework/DataDescriptorQueryBuilder.h @@ -16,11 +16,9 @@ #include #include #include -#include -namespace o2 -{ -namespace framework + +namespace o2::framework { namespace data_matcher @@ -65,9 +63,9 @@ struct DataDescriptorQueryBuilder { /// deprecated? static DataDescriptorQuery buildFromExtendedKeepConfig(std::string const& config); static std::unique_ptr buildNode(std::string const& nodeString); - static std::smatch getTokens(std::string const& nodeString); + static std::vector getTokens(std::string const& nodeString); }; -} // namespace framework -} // namespace o2 +} // namespace o2::framework + #endif // o2_framework_DataDescriptorQueryBuilder_H_INCLUDED diff --git a/Framework/Core/src/DataDescriptorQueryBuilder.cxx b/Framework/Core/src/DataDescriptorQueryBuilder.cxx index 8b0c239699cc9..480072ecc700a 100644 --- a/Framework/Core/src/DataDescriptorQueryBuilder.cxx +++ b/Framework/Core/src/DataDescriptorQueryBuilder.cxx @@ -17,6 +17,7 @@ #include #include #include +#include #include using namespace o2::framework::data_matcher; @@ -447,7 +448,7 @@ DataDescriptorQuery DataDescriptorQueryBuilder::buildFromExtendedKeepConfig(std: std::unique_ptr DataDescriptorQueryBuilder::buildNode(std::string const& nodeString) { - std::smatch m = getTokens(nodeString); + auto m = getTokens(nodeString); std::unique_ptr next; auto newNode = std::make_unique( @@ -461,15 +462,19 @@ std::unique_ptr DataDescriptorQueryBuilder::buildNode(std return newNode; } -std::smatch DataDescriptorQueryBuilder::getTokens(std::string const& nodeString) +std::vector DataDescriptorQueryBuilder::getTokens(std::string const& nodeString) { static const std::regex specTokenRE(R"re((\w{1,4})/(\w{1,16})/(\d*))re"); - std::smatch m; + std::smatch match; - std::regex_match(nodeString, m, specTokenRE); + std::regex_match(nodeString, match, specTokenRE); - return m; + std::vector result; + for (size_t i = 0; i < 4; ++i) { + result.push_back(match[i].str()); + } + return result; } } // namespace o2::framework