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
21
namespace
o2::framework
22
{
23
24
//__________________________________________________________________________________________________
29
30
//__________________________________________________________________________________________________
43
struct
DataProcessingHeader
:
public
header::BaseHeader
{
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
71
StartTime
startTime
;
72
76
Duration
duration
;
77
78
CreationTime
creation
;
79
80
//___NEVER MODIFY THE ABOVE
81
//___NEW STUFF GOES BELOW
82
83
//___the functions:
84
DataProcessingHeader
()
85
:
DataProcessingHeader
(0, 0)
86
{
87
}
88
89
DataProcessingHeader
(
StartTime
s)
90
:
DataProcessingHeader
(s, 0)
91
{
92
}
93
94
DataProcessingHeader
(
StartTime
s,
Duration
d)
95
:
BaseHeader
(sizeof(
DataProcessingHeader
),
sHeaderType
, header::gSerializationMethodNone,
sVersion
),
96
startTime
(s),
97
duration
(d),
98
creation
(
getCreationTime
())
99
{
100
}
101
102
DataProcessingHeader
(
StartTime
s,
Duration
d,
CreationTime
t)
103
:
BaseHeader
(sizeof(
DataProcessingHeader
),
sHeaderType
, header::gSerializationMethodNone,
sVersion
),
104
startTime
(s),
105
duration
(d),
106
creation
(t)
107
{
108
}
109
110
DataProcessingHeader
(
const
DataProcessingHeader
&) =
default
;
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_
DataHeader.h
o2::framework
Defining PrimaryVertex explicitly as messageable.
Definition
TFIDInfo.h:20
o2::framework::DataProcessingHeader
Definition
DataProcessingHeader.h:43
o2::framework::DataProcessingHeader::CreationTime
uint64_t CreationTime
Definition
DataProcessingHeader.h:66
o2::framework::DataProcessingHeader::duration
Duration duration
Definition
DataProcessingHeader.h:76
o2::framework::DataProcessingHeader::getCreationTime
static uint64_t getCreationTime()
Definition
DataProcessingHeader.h:54
o2::framework::DataProcessingHeader::KEEP_AT_EOS_FLAG
static constexpr int32_t KEEP_AT_EOS_FLAG
Definition
DataProcessingHeader.h:46
o2::framework::DataProcessingHeader::StartTime
uint64_t StartTime
Definition
DataProcessingHeader.h:64
o2::framework::DataProcessingHeader::DataProcessingHeader
DataProcessingHeader()
Definition
DataProcessingHeader.h:84
o2::framework::DataProcessingHeader::DataProcessingHeader
DataProcessingHeader(StartTime s)
Definition
DataProcessingHeader.h:89
o2::framework::DataProcessingHeader::startTime
StartTime startTime
Definition
DataProcessingHeader.h:71
o2::framework::DataProcessingHeader::Duration
uint64_t Duration
Definition
DataProcessingHeader.h:65
o2::framework::DataProcessingHeader::sVersion
static const uint32_t sVersion
Definition
DataProcessingHeader.h:61
o2::framework::DataProcessingHeader::creation
CreationTime creation
Definition
DataProcessingHeader.h:78
o2::framework::DataProcessingHeader::DataProcessingHeader
DataProcessingHeader(StartTime s, Duration d)
Definition
DataProcessingHeader.h:94
o2::framework::DataProcessingHeader::DUMMY_CREATION_TIME_OFFSET
static constexpr uint64_t DUMMY_CREATION_TIME_OFFSET
Definition
DataProcessingHeader.h:44
o2::framework::DataProcessingHeader::DataProcessingHeader
DataProcessingHeader(StartTime s, Duration d, CreationTime t)
Definition
DataProcessingHeader.h:102
o2::framework::DataProcessingHeader::sHeaderType
static constexpr const o2::header::HeaderType sHeaderType
Definition
DataProcessingHeader.h:60
o2::framework::DataProcessingHeader::Get
static const DataProcessingHeader * Get(const BaseHeader *baseHeader)
Definition
DataProcessingHeader.h:111
o2::framework::DataProcessingHeader::DataProcessingHeader
DataProcessingHeader(const DataProcessingHeader &)=default
o2::header::BaseHeader
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::BaseHeader::description
o2::header::HeaderType description
header type description, set by derived header
Definition
DataHeader.h:385
o2::header::Descriptor< gSizeHeaderDescriptionString >
Framework
Core
include
Framework
DataProcessingHeader.h
Generated on Tue Feb 25 2025 17:03:20 for Project by
1.9.8