forked from davidrohr/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataSamplingHeader.h
More file actions
71 lines (55 loc) · 2.22 KB
/
DataSamplingHeader.h
File metadata and controls
71 lines (55 loc) · 2.22 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// 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.
#ifndef ALICEO2_DATASAMPLINGHEADER_H
#define ALICEO2_DATASAMPLINGHEADER_H
/// \file DataSamplingHeader.h
/// \brief A declaration of O2 Data Sampling Header
///
/// \author Piotr Konopka, piotr.jan.konopka@cern.ch
/// @brief a header which contains some meta-data generated by Data Sampling
#include "Headers/DataHeader.h"
namespace o2
{
namespace framework
{
struct DataSamplingHeader : public header::BaseHeader {
// static data for this header type/version
static const uint32_t sVersion;
static const o2::header::HeaderType sHeaderType;
static const o2::header::SerializationMethod sSerializationMethod;
static constexpr uint32_t deviceIDTypeSize = 16;
using DeviceIDType = header::Descriptor<deviceIDTypeSize>;
// data sampling header fields
uint64_t sampleTimeUs;
uint32_t totalAcceptedMessages;
uint32_t totalEvaluatedMessages;
DeviceIDType deviceID;
DataSamplingHeader()
: DataSamplingHeader(0, 0, 0, "")
{
}
DataSamplingHeader(uint64_t _sampleTimeUs, uint32_t _totalAcceptedMessages, uint32_t _totalEvaluatedMessages, DeviceIDType _deviceID)
: BaseHeader(sizeof(DataSamplingHeader), sHeaderType, sSerializationMethod, sVersion),
sampleTimeUs(_sampleTimeUs),
totalAcceptedMessages(_totalAcceptedMessages),
totalEvaluatedMessages(_totalEvaluatedMessages),
deviceID(_deviceID)
{
}
DataSamplingHeader(const DataSamplingHeader&) = default;
DataSamplingHeader& operator=(const DataSamplingHeader&) = default;
static const DataSamplingHeader* Get(const BaseHeader* baseHeader)
{
return (baseHeader->description == DataSamplingHeader::sHeaderType) ? static_cast<const DataSamplingHeader*>(baseHeader) : nullptr;
}
};
} // namespace framework
} // namespace o2
#endif //ALICEO2_DATASAMPLINGHEADER_H