Project
Loading...
Searching...
No Matches
CommonMessageBackendsHelpers.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_COMMONMESSAGEBACKENDSHELPERS_H_
12
#define O2_FRAMEWORK_COMMONMESSAGEBACKENDSHELPERS_H_
13
14
#include "
Framework/RawDeviceService.h
"
15
#include "
Framework/DataProcessor.h
"
16
#include "
Framework/DataSender.h
"
17
#include "
Framework/ProcessingContext.h
"
18
#include "
Framework/EndOfStreamContext.h
"
19
#include "
Framework/FairMQDeviceProxy.h
"
20
#include "
Framework/ServiceRegistry.h
"
21
#include "
Framework/Tracing.h
"
22
23
#include <fairmq/ProgOptions.h>
24
25
namespace
o2::framework
26
{
27
28
template
<
typename
T>
29
struct
CommonMessageBackendsHelpers
{
30
static
ServiceInit
createCallback
()
31
{
32
return
[](
ServiceRegistryRef
services,
DeviceState
&, fair::mq::ProgOptions& options) {
33
auto
& proxy = services.
get
<
FairMQDeviceProxy
>();
34
return
ServiceHandle
{TypeIdHelpers::uniqueId<T>(),
new
T(proxy),
ServiceKind::Stream
};
35
};
36
}
37
38
static
ServiceProcessingCallback
sendCallback
()
39
{
40
return
[](
ProcessingContext
& ctx,
void
* service) {
41
T* context =
reinterpret_cast<
T*
>
(service);
42
DataProcessor::doSend
(ctx.
services
().
get
<
DataSender
>(), *context, ctx.
services
());
43
};
44
}
45
46
static
ServiceProcessingCallback
clearContext
()
47
{
48
return
[](
ProcessingContext
&,
void
* service) {
49
T* context =
reinterpret_cast<
T*
>
(service);
50
context->clear();
51
};
52
}
53
54
static
ServiceEOSCallback
clearContextEOS
()
55
{
56
return
[](
EndOfStreamContext
&,
void
* service) {
57
T* context =
reinterpret_cast<
T*
>
(service);
58
context->clear();
59
};
60
}
61
62
static
ServiceEOSCallback
sendCallbackEOS
()
63
{
64
return
[](
EndOfStreamContext
& ctx,
void
* service) {
65
T* context =
reinterpret_cast<
T*
>
(service);
66
DataProcessor::doSend
(ctx.
services
().
get
<
DataSender
>(), *context, ctx.
services
());
67
};
68
}
69
};
70
}
// namespace o2::framework
71
72
#endif
// O2_FRAMEWORK_COMMONMESSAGEBACKENDSHELPERS_H_
DataProcessor.h
DataSender.h
EndOfStreamContext.h
FairMQDeviceProxy.h
ProcessingContext.h
RawDeviceService.h
ServiceRegistry.h
Tracing.h
o2::framework::DataSender
Allow injecting policies on send.
Definition
DataSender.h:34
o2::framework::EndOfStreamContext
Definition
EndOfStreamContext.h:22
o2::framework::EndOfStreamContext::services
ServiceRegistryRef services()
Definition
EndOfStreamContext.h:30
o2::framework::FairMQDeviceProxy
Definition
FairMQDeviceProxy.h:36
o2::framework::ProcessingContext
Definition
ProcessingContext.h:27
o2::framework::ProcessingContext::services
ServiceRegistryRef services()
The services registry associated with this processing context.
Definition
ProcessingContext.h:39
o2::framework::ServiceRegistryRef
Definition
ServiceRegistryRef.h:21
o2::framework::ServiceRegistryRef::get
T & get() const
Definition
ServiceRegistryRef.h:85
o2::framework
Defining PrimaryVertex explicitly as messageable.
Definition
TFIDInfo.h:20
o2::framework::ServiceInit
ServiceHandle(*)(ServiceRegistryRef, DeviceState &, fair::mq::ProgOptions &) ServiceInit
A callback to create a given Service.
Definition
ServiceSpec.h:48
o2::framework::ServiceKind::Stream
@ Stream
o2::framework::ServiceEOSCallback
void(*)(EndOfStreamContext &, void *) ServiceEOSCallback
A callback which is executed before the end of stream loop.
Definition
ServiceSpec.h:68
o2::framework::ServiceProcessingCallback
void(*)(ProcessingContext &, void *) ServiceProcessingCallback
A callback which is executed before each processing loop.
Definition
ServiceSpec.h:62
o2::framework::CommonMessageBackendsHelpers
Definition
CommonMessageBackendsHelpers.h:29
o2::framework::CommonMessageBackendsHelpers::createCallback
static ServiceInit createCallback()
Definition
CommonMessageBackendsHelpers.h:30
o2::framework::CommonMessageBackendsHelpers::sendCallbackEOS
static ServiceEOSCallback sendCallbackEOS()
Definition
CommonMessageBackendsHelpers.h:62
o2::framework::CommonMessageBackendsHelpers::clearContext
static ServiceProcessingCallback clearContext()
Definition
CommonMessageBackendsHelpers.h:46
o2::framework::CommonMessageBackendsHelpers::sendCallback
static ServiceProcessingCallback sendCallback()
Definition
CommonMessageBackendsHelpers.h:38
o2::framework::CommonMessageBackendsHelpers::clearContextEOS
static ServiceEOSCallback clearContextEOS()
Definition
CommonMessageBackendsHelpers.h:54
o2::framework::DataProcessor::doSend
static void doSend(DataSender &, MessageContext &, ServiceRegistryRef)
Definition
DataProcessor.cxx:38
o2::framework::DeviceState
Running state information of a given device.
Definition
DeviceState.h:34
o2::framework::ServiceHandle
Definition
ServiceHandle.h:43
Framework
Core
src
CommonMessageBackendsHelpers.h
Generated on Tue Feb 25 2025 23:16:39 for Project by
1.9.8