Project
Loading...
Searching...
No Matches
CompletionPolicy.h
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#ifndef O2_FRAMEWORK_COMPLETIONPOLICY_H_
12#define O2_FRAMEWORK_COMPLETIONPOLICY_H_
13
14#include "Framework/DataRef.h"
15#include "Framework/InputSpec.h"
17
18#include <functional>
19#include <string>
20#include <utility>
21#include <vector>
22
23namespace o2::framework
24{
25
26struct DeviceSpec;
27struct InputRecord;
28struct InputSpan;
29class DataRelayer;
30
36 enum struct CompletionOp {
40 Consume,
43 Process,
47 Wait,
50 Discard,
62 Retry,
63 };
64
66 enum struct CompletionOrder {
67 Any,
69 Slot
70 };
71
72 using Matcher = std::function<bool(DeviceSpec const& device)>;
74 using CallbackFull = std::function<CompletionOp(InputSpan const&, std::vector<InputSpec> const&, ServiceRegistryRef&)>;
75 using CallbackConfigureRelayer = std::function<void(DataRelayer&)>;
76
81 CompletionPolicy(std::string _name, Matcher _matcher, CallbackFull _callback, bool _balanceChannels = true)
82 : name(std::move(_name)), matcher(std::move(_matcher)), callbackFull{std::move(_callback)}, balanceChannels{_balanceChannels} {}
83
85 std::string name = "";
88 Matcher matcher = nullptr;
99 bool balanceChannels = true;
100
102
104 static std::vector<CompletionPolicy> createDefaultPolicies();
105};
106
107std::ostream& operator<<(std::ostream& oss, CompletionPolicy::CompletionOp const& val);
108
109} // namespace o2::framework
110
111#endif // O2_FRAMEWORK_COMPLETIONPOLICY_H_
GLuint const GLchar * name
Definition glcorearb.h:781
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLuint GLfloat * val
Definition glcorearb.h:1582
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::ostream & operator<<(std::ostream &s, ChannelType const &type)
Stream operators so that we can use ChannelType with Boost.Test.
Defining DataPointCompositeObject explicitly as copiable.
CompletionPolicy(std::string _name, Matcher _matcher, CallbackFull _callback, bool _balanceChannels=true)
Constructor for emplace_back.
static std::vector< CompletionPolicy > createDefaultPolicies()
Helper to create the default configuration.
CompletionOrder
Order in which the completed slots must be consumed.
CompletionOp
Action to take with the InputRecord:
@ Retry
Like Wait but mark the cacheline as dirty.
CallbackConfigureRelayer configureRelayer
std::function< CompletionOp(InputSpan const &, std::vector< InputSpec > const &, ServiceRegistryRef &)> CallbackFull
std::function< void(DataRelayer &)> CallbackConfigureRelayer
CallbackFull callbackFull
Actual policy which decides what to do with a partial InputRecord, extended version.
std::function< bool(DeviceSpec const &device)> Matcher