Skip to content

Commit

Permalink
DPL: remove bloat
Browse files Browse the repository at this point in the history
Exposing std::regex not really needed.
  • Loading branch information
ktf committed Jan 8, 2025
1 parent b77f031 commit bc74469
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
12 changes: 5 additions & 7 deletions Framework/Core/include/Framework/DataDescriptorQueryBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
#include <string>
#include <vector>
#include <memory>
#include <regex>

namespace o2
{
namespace framework

namespace o2::framework
{

namespace data_matcher
Expand Down Expand Up @@ -65,9 +63,9 @@ struct DataDescriptorQueryBuilder {
/// deprecated?
static DataDescriptorQuery buildFromExtendedKeepConfig(std::string const& config);
static std::unique_ptr<data_matcher::DataDescriptorMatcher> buildNode(std::string const& nodeString);
static std::smatch getTokens(std::string const& nodeString);
static std::vector<std::string> getTokens(std::string const& nodeString);
};

} // namespace framework
} // namespace o2
} // namespace o2::framework

#endif // o2_framework_DataDescriptorQueryBuilder_H_INCLUDED
15 changes: 10 additions & 5 deletions Framework/Core/src/DataDescriptorQueryBuilder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <optional>
#include <string>
#include <vector>
#include <regex>
#include <iostream>

using namespace o2::framework::data_matcher;
Expand Down Expand Up @@ -447,7 +448,7 @@ DataDescriptorQuery DataDescriptorQueryBuilder::buildFromExtendedKeepConfig(std:
std::unique_ptr<DataDescriptorMatcher> DataDescriptorQueryBuilder::buildNode(std::string const& nodeString)
{

std::smatch m = getTokens(nodeString);
auto m = getTokens(nodeString);

std::unique_ptr<DataDescriptorMatcher> next;
auto newNode = std::make_unique<DataDescriptorMatcher>(
Expand All @@ -461,15 +462,19 @@ std::unique_ptr<DataDescriptorMatcher> DataDescriptorQueryBuilder::buildNode(std
return newNode;
}

std::smatch DataDescriptorQueryBuilder::getTokens(std::string const& nodeString)
std::vector<std::string> 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<std::string> result;
for (size_t i = 0; i < 4; ++i) {
result.push_back(match[i].str());
}
return result;
}

} // namespace o2::framework

0 comments on commit bc74469

Please sign in to comment.