Project
Loading...
Searching...
No Matches
DataSpecViews.h
Go to the documentation of this file.
1// Copyright 2019-2025 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#ifndef O2_FRAMEWORK_DATASPECVIEWS_H_
12#define O2_FRAMEWORK_DATASPECVIEWS_H_
13
15#include <ranges>
16
18{
19static auto partial_match_filter(auto what)
20{
21 return std::views::filter([what](auto const& t) -> bool { return DataSpecUtils::partialMatch(t, what); });
22}
23
24static auto exclude_by_name(std::string name)
25{
26 return std::views::filter([name](auto const& t) -> bool { return t.name != name; });
27}
28
29static auto filter_not_matching(auto const& provided)
30{
31 return std::views::filter([&provided](auto const& input) { return std::none_of(provided.begin(), provided.end(), [&input](auto const& output) { return DataSpecUtils::match(input, output); }); });
32}
33
34} // namespace o2::framework::views
35//
37{
38template <class Container>
39struct append_to {
40 Container& c;
41 // ends the pipeline, returns the container
42 template <std::ranges::input_range R>
43 friend Container& operator|(R&& r, append_to self)
44 {
45 std::ranges::copy(r, std::back_inserter(self.c));
46 return self.c;
47 }
48};
49
50template <class Container>
52 Container& c;
53 // ends the pipeline, returns the container
54 template <std::ranges::input_range R>
55 friend Container& operator|(R&& r, update_input_list self)
56 {
57 for (auto& item : r) {
58 auto copy = item;
59 DataSpecUtils::updateInputList(self.c, std::move(copy));
60 }
61 return self.c;
62 }
63};
64
65} // namespace o2::framework::sinks
66
67#endif // O2_FRAMEWORK_DATASPECVIEWS_H_
void output(const std::map< std::string, ChannelStat > &channels)
Definition rawdump.cxx:197
GLuint const GLchar * name
Definition glcorearb.h:781
GLboolean r
Definition glcorearb.h:1233
static bool partialMatch(InputSpec const &spec, o2::header::DataOrigin const &origin)
static void updateInputList(std::vector< InputSpec > &list, InputSpec &&input)
Updates list of InputSpecs by merging metadata.
friend Container & operator|(R &&r, append_to self)
friend Container & operator|(R &&r, update_input_list self)