Project
Loading...
Searching...
No Matches
DataProcessingHeader.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_DATAPROCESSINGHEADER_H_
12#define O2_FRAMEWORK_DATAPROCESSINGHEADER_H_
13
14#include "Headers/DataHeader.h"
15
16#include <cstdint>
17#include <memory>
18#include <cassert>
19#include <chrono>
20
21namespace o2::framework
22{
23
24//__________________________________________________________________________________________________
29
30//__________________________________________________________________________________________________
44 static constexpr uint64_t DUMMY_CREATION_TIME_OFFSET = 0x8000000000000000;
45 // The following flags are used to indicate the behavior of the data processing
46 static constexpr int32_t KEEP_AT_EOS_FLAG = 1;
47
54 static uint64_t getCreationTime()
55 {
56 auto now = std::chrono::steady_clock::now();
57 return ((uint64_t)std::chrono::duration<double, std::milli>(now.time_since_epoch()).count()) | DUMMY_CREATION_TIME_OFFSET;
58 }
59 // Required to do the lookup
60 constexpr static const o2::header::HeaderType sHeaderType = "DataFlow";
61 static const uint32_t sVersion = 1;
62
63 // allows DataHeader::SubSpecificationType to be used as generic type in the code
64 using StartTime = uint64_t;
65 using Duration = uint64_t;
66 using CreationTime = uint64_t;
67
72
77
79
80 //___NEVER MODIFY THE ABOVE
81 //___NEW STUFF GOES BELOW
82
83 //___the functions:
88
93
95 : BaseHeader(sizeof(DataProcessingHeader), sHeaderType, header::gSerializationMethodNone, sVersion),
96 startTime(s),
97 duration(d),
99 {
100 }
101
103 : BaseHeader(sizeof(DataProcessingHeader), sHeaderType, header::gSerializationMethodNone, sVersion),
104 startTime(s),
105 duration(d),
106 creation(t)
107 {
108 }
109
111 static const DataProcessingHeader* Get(const BaseHeader* baseHeader)
112 {
113 return (baseHeader->description == DataProcessingHeader::sHeaderType) ? static_cast<const DataProcessingHeader*>(baseHeader) : nullptr;
114 }
115};
116
117} // namespace o2::framework
118
119#endif // O2_FRAMEWORK_DATAPROCESSINGHEADER_H_
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
static constexpr int32_t KEEP_AT_EOS_FLAG
DataProcessingHeader(StartTime s, Duration d)
static constexpr uint64_t DUMMY_CREATION_TIME_OFFSET
DataProcessingHeader(StartTime s, Duration d, CreationTime t)
static constexpr const o2::header::HeaderType sHeaderType
static const DataProcessingHeader * Get(const BaseHeader *baseHeader)
DataProcessingHeader(const DataProcessingHeader &)=default
the base header struct Every header type must begin (i.e. derive) with this. Don't use this struct di...
Definition DataHeader.h:351
o2::header::HeaderType description
header type description, set by derived header
Definition DataHeader.h:385