forked from mcoquet642/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataSamplingReadoutAdapter.cxx
More file actions
45 lines (37 loc) · 1.68 KB
/
DataSamplingReadoutAdapter.cxx
File metadata and controls
45 lines (37 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#include "Framework/DataSamplingReadoutAdapter.h"
#include "Framework/DataProcessingHeader.h"
#include "Headers/DataHeader.h"
#include "Framework/DataSpecUtils.h"
#include <Common/DataBlock.h>
namespace o2::framework
{
using DataHeader = o2::header::DataHeader;
InjectorFunction dataSamplingReadoutAdapter(OutputSpec const& spec)
{
return [spec](FairMQDevice& device, FairMQParts& parts, int index) {
for (size_t i = 0; i < parts.Size() / 2; ++i) {
auto dbh = reinterpret_cast<DataBlockHeaderBase*>(parts.At(2 * i)->GetData());
assert(dbh->dataSize == parts.At(2 * i + 1)->GetSize());
DataHeader dh;
ConcreteDataTypeMatcher dataType = DataSpecUtils::asConcreteDataTypeMatcher(spec);
dh.dataOrigin = dataType.origin;
dh.dataDescription = dataType.description;
dh.subSpecification = DataSpecUtils::getOptionalSubSpec(spec).value_or(dbh->linkId);
dh.payloadSize = dbh->dataSize;
dh.payloadSerializationMethod = o2::header::gSerializationMethodNone;
DataProcessingHeader dph{dbh->blockId, 0};
o2::header::Stack headerStack{dh, dph};
broadcastMessage(device, std::move(headerStack), std::move(parts.At(2 * i + 1)), index);
}
};
}
} // namespace o2::framework