forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqconfig_helpers.h
More file actions
54 lines (48 loc) · 1.33 KB
/
Copy pathqconfig_helpers.h
File metadata and controls
54 lines (48 loc) · 1.33 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
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// 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.
/// \file qconfig_helpers.h
/// \author David Rohr
#ifndef QCONFIG_HELPERS_H
#define QCONFIG_HELPERS_H
#include <string>
#include <sstream>
#define qon_mcat(a, b) a##b
#define qon_mxcat(a, b) qon_mcat(a, b)
#define qon_mcat3(a, b, c) a##b##c
#define qon_mxcat3(a, b, c) qon_mcat3(a, b, c)
#define qon_mstr(a) #a
#define qon_mxstr(a) qon_mstr(a)
namespace qConfig
{
template <class T>
inline std::string print_type(T val)
{
std::ostringstream s;
s << val;
return s.str();
};
template <>
inline std::string print_type<char>(char val)
{
return std::to_string(val);
};
template <>
inline std::string print_type<unsigned char>(unsigned char val)
{
return std::to_string(val);
};
template <>
inline std::string print_type<bool>(bool val)
{
return val ? "true" : "false";
};
} // namespace qConfig
#endif