Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Framework/Core/include/Framework/DataSpecUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ struct DataSpecUtils {
/// @return true if the OutputSpec will match at least the provided @a origin.
static bool partialMatch(OutputSpec const& spec, o2::header::DataOrigin const& origin);

/// @return true if the OutputSpec will match at least the provided @a description.
static bool partialMatch(InputSpec const& spec, o2::header::DataDescription const& description);

/// @return true if the OutputSpec will match at least the provided @a description.
static bool partialMatch(OutputSpec const& spec, o2::header::DataDescription const& description);

template <typename T>
static bool match(const T& spec, const o2::header::DataHeader& header)
{
Expand Down
12 changes: 12 additions & 0 deletions Framework/Core/src/DataSpecUtils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,18 @@ bool DataSpecUtils::partialMatch(InputSpec const& input, header::DataOrigin cons
return DataSpecUtils::asConcreteOrigin(input) == origin;
}

bool DataSpecUtils::partialMatch(InputSpec const& input, header::DataDescription const& description)
{
auto dataType = DataSpecUtils::asConcreteDataTypeMatcher(input);
return dataType.description == description;
}

bool DataSpecUtils::partialMatch(OutputSpec const& output, header::DataDescription const& description)
{
auto dataType = DataSpecUtils::asConcreteDataTypeMatcher(output);
return dataType.description == description;
}

ConcreteDataMatcher DataSpecUtils::asConcreteDataMatcher(InputSpec const& spec)
{
return std::get<ConcreteDataMatcher>(spec.matcher);
Expand Down
6 changes: 6 additions & 0 deletions Framework/Core/test/unittest_DataSpecUtils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ BOOST_AUTO_TEST_CASE(PartialMatching)

BOOST_CHECK(DataSpecUtils::partialMatch(fullySpecifiedOutput, header::DataOrigin("FOO")) == false);
BOOST_CHECK(DataSpecUtils::partialMatch(fullySpecifiedInput, header::DataOrigin("FOO")) == false);

BOOST_CHECK(DataSpecUtils::partialMatch(fullySpecifiedOutput, header::DataDescription("TEST")) == false);
BOOST_CHECK(DataSpecUtils::partialMatch(fullySpecifiedInput, header::DataDescription("TSET")) == false);

BOOST_CHECK(DataSpecUtils::partialMatch(fullySpecifiedOutput, header::DataDescription("FOOO")) == true);
BOOST_CHECK(DataSpecUtils::partialMatch(fullySpecifiedInput, header::DataDescription("FOOO")) == true);
}

BOOST_AUTO_TEST_CASE(GetOptionalSubSpecWithMatcher)
Expand Down