Project
Loading...
Searching...
No Matches
CompletionPolicyHelpers.h
Go to the documentation of this file.
1// Copyright 2019-2026 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_COMPLETIONPOLICYHELPERS_H_
12#define O2_FRAMEWORK_COMPLETIONPOLICYHELPERS_H_
13
16#include "Headers/DataHeader.h"
17
18#include <functional>
19#include <string>
20#include <type_traits>
21
22namespace o2::framework
23{
24
30 static CompletionPolicy consumeWhenAll(CompletionPolicy::Matcher matcher = [](auto const&) -> bool { return true; })
31 {
32 return consumeWhenAll("consume-all", matcher);
33 }
34
38 static CompletionPolicy consumeWhenAllOrdered(CompletionPolicy::Matcher matcher = [](auto const&) -> bool { return true; })
39 {
40 return consumeWhenAllOrdered("consume-all-ordered", matcher);
41 }
42 static CompletionPolicy consumeWhenAllOrdered(std::string matchName);
43
46
49
51 static CompletionPolicy consumeWhenAny(CompletionPolicy::Matcher matcher = [](auto const&) -> bool { return true; })
52 {
53 return consumeWhenAny("consume-any", matcher);
54 }
55 static CompletionPolicy consumeWhenAny(std::string matchName);
56
57 // Consume all the data captured until the oldest possible timeframe
58 // in input indicates that nothing else can be added to this timeslice.
59 // Useful in case of wildcards which multiplex multiple subspecs on the
60 // same input.
62
66 static CompletionPolicy consumeWhenAnyWithAllConditions(CompletionPolicy::Matcher matcher = [](auto const&) -> bool { return true; })
67 {
68 return consumeWhenAnyWithAllConditions("consume-any-all-conditions", matcher);
69 }
70 static CompletionPolicy consumeWhenAnyWithAllConditions(std::string matchName);
71
76
81 static CompletionPolicy processWhenAny(CompletionPolicy::Matcher matcher = [](auto const&) -> bool { return true; })
82 {
83 return processWhenAny("process-any", matcher);
84 }
88 static CompletionPolicy defineByNameOrigin(std::string const& name, std::string const& origin, CompletionPolicy::CompletionOp op);
90 template <typename T, typename U>
91 static auto getHeader(U const& input)
92 {
93 // DataHeader interface requires to specify header pointer type, need to check if the template parameter
94 // is already pointer type, and add pointer if not
95 using return_type = typename std::conditional<std::is_pointer<T>::value, T, typename std::add_pointer<T>::type>::type;
96 return o2::header::get<return_type>(input.header);
97 }
98};
99
100} // namespace o2::framework
101
102#endif // O2_FRAMEWORK_COMPLETIONPOLICYHELPERS_H_
header::DataOrigin origin
uint32_t op
GLuint const GLchar * name
Definition glcorearb.h:781
GLint GLint GLsizei GLint GLenum GLenum type
Definition glcorearb.h:275
Defining PrimaryVertex explicitly as messageable.
Helper class which holds commonly used policies.
static CompletionPolicy consumeWhenPastOldestPossibleTimeframe(const char *name, CompletionPolicy::Matcher matcher)
static CompletionPolicy processWhenAny(const char *name, CompletionPolicy::Matcher matcher)
static CompletionPolicy consumeWhenAny(CompletionPolicy::Matcher matcher=[](auto const &) -> bool { return true;})
Default matcher applies for all devices.
static CompletionPolicy consumeWhenAllOrdered(const char *name, CompletionPolicy::Matcher matcher)
as consumeWhenAll, but ensures that records are processed with incremental timeSlice (DataHeader::sta...
static CompletionPolicy defineByName(std::string const &name, CompletionPolicy::CompletionOp op)
static CompletionPolicy consumeExistingWhenAny(const char *name, CompletionPolicy::Matcher matcher)
static CompletionPolicy consumeWhenAll(const char *name, CompletionPolicy::Matcher matcher)
Default Completion policy. When all the parts of a record have arrived, consume them.
static CompletionPolicy consumeWhenAnyWithAllConditions(const char *name, CompletionPolicy::Matcher matcher)
When any of the parts of the record have been received, consume them.
static CompletionPolicy consumeWhenAll(CompletionPolicy::Matcher matcher=[](auto const &) -> bool { return true;})
Default matcher applies for all devices.
static CompletionPolicy consumeWhenAnyWithAllConditions(CompletionPolicy::Matcher matcher=[](auto const &) -> bool { return true;})
Default matcher applies for all devices.
static CompletionPolicy consumeWhenAnyZeroCount(const char *name, CompletionPolicy::Matcher matcher)
When any of the parts which has arrived has a refcount of 1.
static CompletionPolicy defineByNameOrigin(std::string const &name, std::string const &origin, CompletionPolicy::CompletionOp op)
static CompletionPolicy consumeWhenAny(const char *name, CompletionPolicy::Matcher matcher)
When any of the parts of the record have been received, consume them.
static CompletionPolicy consumeWhenAllOrdered(CompletionPolicy::Matcher matcher=[](auto const &) -> bool { return true;})
Default matcher applies for all devices.
static CompletionPolicy processWhenAny(CompletionPolicy::Matcher matcher=[](auto const &) -> bool { return true;})
Default matcher applies for all devices.
static auto getHeader(U const &input)
Get a specific header from the input.
CompletionOp
Action to take with the InputRecord:
std::function< bool(DeviceSpec const &device)> Matcher