Project
Loading...
Searching...
No Matches
DataPointCompositeObject.cxx
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
12
#include "
DetectorsDCS/DataPointCompositeObject.h
"
13
#include "
DetectorsDCS/GenericFunctions.h
"
14
15
using namespace
o2::dcs
;
16
17
ClassImp
(
DataPointCompositeObject
);
18
19
namespace
o2::dcs
20
{
21
template
<
typename
T, o2::dcs::DeliveryType dt>
22
T
getValueImpl
(
const
DataPointCompositeObject
& dpcom)
23
{
24
union
Converter {
25
uint64_t raw_data;
26
T t_value;
27
};
28
if
(dpcom.
id
.
get_type
() != dt) {
29
throw
std::runtime_error(
"DPCOM is of unexpected type "
+
o2::dcs::show
(dpcom.
id
.
get_type
()) +
" instead of the requested "
+
o2::dcs::show
(dt));
30
}
31
Converter converter;
32
converter.raw_data = dpcom.
data
.
payload_pt1
;
33
return
converter.t_value;
34
}
35
36
// only specialize the getValue function for the types we support :
37
//
38
// - double
39
// - float
40
// - uint32_t
41
// - int32_t
42
// - char
43
// - bool
44
//
45
// - string
46
47
template
<>
48
double
getValue
(
const
DataPointCompositeObject
& dpcom)
49
{
50
return
getValueImpl<double, DeliveryType::DPVAL_DOUBLE>(dpcom);
51
}
52
53
template
<>
54
float
getValue
(
const
DataPointCompositeObject
& dpcom)
55
{
56
return
getValueImpl<float, DeliveryType::DPVAL_FLOAT>(dpcom);
57
}
58
59
template
<>
60
uint32_t
getValue
(
const
DataPointCompositeObject
& dpcom)
61
{
62
return
getValueImpl<uint32_t, DeliveryType::DPVAL_UINT>(dpcom);
63
}
64
65
template
<>
66
int32_t
getValue
(
const
DataPointCompositeObject
& dpcom)
67
{
68
return
getValueImpl<int32_t, DeliveryType::DPVAL_INT>(dpcom);
69
}
70
71
template
<>
72
char
getValue
(
const
DataPointCompositeObject
& dpcom)
73
{
74
return
getValueImpl<char, DeliveryType::DPVAL_CHAR>(dpcom);
75
}
76
77
template
<>
78
bool
getValue
(
const
DataPointCompositeObject
& dpcom)
79
{
80
return
getValueImpl<bool, DeliveryType::DPVAL_BOOL>(dpcom);
81
}
82
83
template
<>
84
std::string
getValue
(
const
DataPointCompositeObject
& dpcom)
85
{
86
if
(dpcom.
id
.
get_type
() != o2::dcs::DeliveryType::DPVAL_STRING) {
87
throw
std::runtime_error(
"DPCOM is of unexpected type "
+
o2::dcs::show
(dpcom.
id
.
get_type
()));
88
}
89
return
std::string((
char
*)&dpcom.
data
.
payload_pt1
);
90
}
91
92
}
// namespace o2::dcs
ClassImp
ClassImp(DataPointCompositeObject)
DataPointCompositeObject.h
GenericFunctions.h
o2::dcs::DataPointIdentifier::get_type
DeliveryType get_type() const noexcept
Definition
DataPointIdentifier.h:170
o2::dcs
Definition
DCSConfigObject.h:26
o2::dcs::getValue
T getValue(const DataPointCompositeObject &dpcom)
o2::dcs::show
std::string show(const DeliveryType type)
Definition
DeliveryType.h:224
o2::dcs::getValueImpl
T getValueImpl(const DataPointCompositeObject &dpcom)
Definition
DataPointCompositeObject.cxx:22
o2::dcs::DataPointCompositeObject
Definition
DataPointCompositeObject.h:40
o2::dcs::DataPointCompositeObject::data
DataPointValue data
Definition
DataPointCompositeObject.h:58
o2::dcs::DataPointCompositeObject::id
DataPointIdentifier id
Definition
DataPointCompositeObject.h:48
o2::dcs::DataPointValue::payload_pt1
uint64_t payload_pt1
Definition
DataPointValue.h:266
Detectors
DCS
src
DataPointCompositeObject.cxx
Generated on Fri Apr 17 2026 12:54:39 for Project by
1.9.8