Project
Loading...
Searching...
No Matches
DataRelayerHelpers.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#include "DataRelayerHelpers.h"
15#include <stdexcept>
16
17using namespace o2::framework::data_matcher;
18
19namespace o2::framework
20{
21
22namespace
23{
24DataDescriptorMatcher fromConcreteMatcher(ConcreteDataMatcher const& matcher)
25{
27 DataDescriptorMatcher::Op::And,
29 std::make_unique<DataDescriptorMatcher>(
30 DataDescriptorMatcher::Op::And,
31 OriginValueMatcher{matcher.origin.as<std::string>()},
32 std::make_unique<DataDescriptorMatcher>(
33 DataDescriptorMatcher::Op::And,
34 DescriptionValueMatcher{matcher.description.as<std::string>()},
35 std::make_unique<DataDescriptorMatcher>(
36 DataDescriptorMatcher::Op::Just,
38}
39} // namespace
40
41std::vector<size_t>
42 DataRelayerHelpers::createDistinctRouteIndex(std::vector<InputRoute> const& routes)
43{
44 std::vector<size_t> result;
45 for (size_t ri = 0; ri < routes.size(); ++ri) {
46 auto& route = routes[ri];
47 if (route.timeslice == 0) {
48 result.push_back(ri);
49 }
50 }
51 return result;
52}
53
55std::vector<DataDescriptorMatcher>
56 DataRelayerHelpers::createInputMatchers(std::vector<InputRoute> const& routes)
57{
58 std::vector<DataDescriptorMatcher> result;
59
60 for (auto& route : routes) {
61 if (auto pval = std::get_if<ConcreteDataMatcher>(&route.matcher.matcher)) {
62 result.emplace_back(fromConcreteMatcher(*pval));
63 } else if (auto matcher = std::get_if<DataDescriptorMatcher>(&route.matcher.matcher)) {
64 result.push_back(*matcher);
65 } else {
66 throw std::runtime_error("Unsupported InputSpec type");
67 }
68 }
69
70 return result;
71}
72
73} // namespace o2::framework
Something which can be matched against a header::DataDescription.
Something which can be matched against a header::DataOrigin.
Matcher on actual time, as reported in the DataProcessingHeader.
Something which can be matched against a header::SubSpecificationType.
GLuint64EXT * result
Definition glcorearb.h:5662
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
header::DataHeader::SubSpecificationType subSpec
static std::vector< data_matcher::DataDescriptorMatcher > createInputMatchers(std::vector< InputRoute > const &)
This converts from InputRoute to the associated DataDescriptorMatcher.
static std::vector< size_t > createDistinctRouteIndex(std::vector< InputRoute > const &)
A typesafe reference to an element of the context.
std::enable_if_t< std::is_same< T, std::string >::value==true, T > as() const
get the descriptor as std::string
Definition DataHeader.h:301