Project
Loading...
Searching...
No Matches
DataPointCreator.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/DataPointCreator.h
"
13
14
namespace
15
{
16
o2::dcs::DataPointCompositeObject
createDPCOM(
const
std::string& alias,
const
uint64_t*
val
, uint32_t seconds, uint16_t msec, uint16_t
flags
,
o2::dcs::DeliveryType
dt)
17
{
18
auto
dpid =
o2::dcs::DataPointIdentifier
(alias, dt);
19
auto
dpval =
o2::dcs::DataPointValue
(
20
flags
,
21
msec,
22
seconds,
23
val
,
24
dt);
25
return
o2::dcs::DataPointCompositeObject
(dpid, dpval);
26
}
27
}
// namespace
28
29
namespace
o2::dcs
30
{
31
template
<>
32
DataPointCompositeObject
createDataPointCompositeObject
(
const
std::string& alias,
double
val
, uint32_t seconds, uint16_t msec, uint16_t
flags
)
33
{
34
return
createDPCOM(alias,
reinterpret_cast<
const
uint64_t*
>
(&
val
), seconds, msec,
flags
, DeliveryType::DPVAL_DOUBLE);
35
}
36
37
template
<>
38
DataPointCompositeObject
createDataPointCompositeObject
(
const
std::string& alias,
float
val
, uint32_t seconds, uint16_t msec, uint16_t
flags
)
39
{
40
float
tmp[2];
41
tmp[0] =
val
;
42
tmp[1] = 0;
43
return
createDPCOM(alias,
reinterpret_cast<
const
uint64_t*
>
(&tmp[0]), seconds, msec,
flags
, DeliveryType::DPVAL_FLOAT);
44
}
45
46
template
<>
47
DataPointCompositeObject
createDataPointCompositeObject
(
const
std::string& alias, int32_t
val
, uint32_t seconds, uint16_t msec, uint16_t
flags
)
48
{
49
int64_t tmp{
val
};
50
return
createDPCOM(alias,
reinterpret_cast<
const
uint64_t*
>
(&tmp), seconds, msec,
flags
, DeliveryType::DPVAL_INT);
51
}
52
53
template
<>
54
DataPointCompositeObject
createDataPointCompositeObject
(
const
std::string& alias, uint32_t
val
, uint32_t seconds, uint16_t msec, uint16_t
flags
)
55
{
56
uint64_t tmp{
val
};
57
return
createDPCOM(alias,
reinterpret_cast<
const
uint64_t*
>
(&tmp), seconds, msec,
flags
, DeliveryType::DPVAL_UINT);
58
}
59
60
template
<>
61
DataPointCompositeObject
createDataPointCompositeObject
(
const
std::string& alias,
long
long
val
, uint32_t seconds, uint16_t msec, uint16_t
flags
)
62
{
63
uint64_t tmp{
static_cast<
uint64_t
>
(
val
)};
64
return
createDPCOM(alias,
reinterpret_cast<
const
uint64_t*
>
(&tmp), seconds, msec,
flags
, DeliveryType::DPVAL_UINT);
65
}
66
67
template
<>
68
DataPointCompositeObject
createDataPointCompositeObject
(
const
std::string& alias,
char
val
, uint32_t seconds, uint16_t msec, uint16_t
flags
)
69
{
70
return
createDPCOM(alias,
reinterpret_cast<
const
uint64_t*
>
(&
val
), seconds, msec,
flags
, DeliveryType::DPVAL_CHAR);
71
}
72
73
template
<>
74
DataPointCompositeObject
createDataPointCompositeObject
(
const
std::string& alias,
bool
val
, uint32_t seconds, uint16_t msec, uint16_t
flags
)
75
{
76
uint64_t tmp{
val
};
77
return
createDPCOM(alias,
reinterpret_cast<
const
uint64_t*
>
(&tmp), seconds, msec,
flags
, DeliveryType::DPVAL_BOOL);
78
}
79
80
template
<>
81
DataPointCompositeObject
createDataPointCompositeObject
(
const
std::string& alias, std::string
val
, uint32_t seconds, uint16_t msec, uint16_t
flags
)
82
{
83
constexpr
int
N{56};
84
char
str
[N];
85
strncpy(
str
,
val
.c_str(), N);
86
return
createDPCOM(alias,
reinterpret_cast<
const
uint64_t*
>
(&
str
[0]), seconds, msec,
flags
, DeliveryType::DPVAL_STRING);
87
}
88
89
}
// namespace o2::dcs
DataPointCreator.h
o2::dcs::DataPointIdentifier
Definition
DataPointIdentifier.h:43
val
GLuint GLfloat * val
Definition
glcorearb.h:1582
flags
GLbitfield flags
Definition
glcorearb.h:1570
o2::dcs
Definition
DCSConfigObject.h:26
o2::dcs::createDataPointCompositeObject
o2::dcs::DataPointCompositeObject createDataPointCompositeObject(const std::string &alias, T val, uint32_t seconds, uint16_t msec, uint16_t flags=0)
o2::dcs::DeliveryType
DeliveryType
Definition
DeliveryType.h:45
o2::dcs::DataPointCompositeObject
Definition
DataPointCompositeObject.h:42
o2::dcs::DataPointValue
Definition
DataPointValue.h:48
str
const std::string str
Definition
test_ransEncodeDecode.cxx:37
Detectors
DCS
src
DataPointCreator.cxx
Generated on Tue Feb 25 2025 17:02:56 for Project by
1.9.8