Project
Loading...
Searching...
No Matches
ChannelConfigurationPolicyHelpers.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_CHANNELCONFIGURATIONPOLICYHELPERS_H_
12#define O2_FRAMEWORK_CHANNELCONFIGURATIONPOLICYHELPERS_H_
13
15
16#include <functional>
17
18namespace o2::framework
19{
20
22 int64_t rateLogging;
25 std::string ipcPrefix;
26};
27
30 // TODO: currently we allow matching of the policy only based on
31 // the id of the device. Best would be to be able to use the
32 // DeviceSpec itself to do the matching. This would allow
33 // fancy behaviors like "use shared memory if the device is on the
34 // same node, something else if remote".
35 using PolicyMatcher = std::function<bool(std::string const& producer, std::string const& consumer)>;
36 using OutputChannelModifier = std::function<void(OutputChannelSpec& spec)>;
37 using InputChannelModifier = std::function<void(InputChannelSpec& spec)>;
38
41
42 // Example on how to write an helper which allows matching
43 // based on some DeviceSpec property.
45 static PolicyMatcher matchByProducerName(const char* name);
46 static PolicyMatcher matchByConsumerName(const char* name);
47
48 // Some trivial modifier which can be used by the policy.
65};
66
67} // namespace o2::framework
68
69#endif // O2_FRAMEWORK_CHANNELCONFIGURATIONPOLICY_H_
GLuint const GLchar * name
Definition glcorearb.h:781
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
A set of helpers for common ChannelConfigurationPolicy behaviors.
static OutputChannelModifier replyOutput(FairMQChannelConfigSpec const &spec)
Makes the passed output channel bind and reply.
static PolicyMatcher matchAny
Catch all policy, used by the last rule.
static OutputChannelModifier pushOutput(FairMQChannelConfigSpec const &spec)
Makes the passed output channel bind and push.
std::function< void(InputChannelSpec &spec)> InputChannelModifier
static InputChannelModifier pullInput(FairMQChannelConfigSpec const &spec)
Makes the passed input channel connect and pull.
static OutputChannelModifier pairOutput(FairMQChannelConfigSpec const &spec)
Makes the passed output channel bind and pair.
static InputChannelModifier pairInput(FairMQChannelConfigSpec const &spec)
Makes the passed input channel connect and pair.
static InputChannelModifier reqInput(FairMQChannelConfigSpec const &spec)
Makes the passed input channel connect and request.
std::function< bool(std::string const &producer, std::string const &consumer)> PolicyMatcher
static OutputChannelModifier publishOutput(FairMQChannelConfigSpec const &spec)
Makes the passed output channel bind and subscribe.
std::function< void(OutputChannelSpec &spec)> OutputChannelModifier
static InputChannelModifier subscribeInput(FairMQChannelConfigSpec const &spec)
Makes the passed input channel connect and subscribe.