Project
Loading...
Searching...
No Matches
qconfig.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
14
15#include "qconfig_general.h"
16
17#if !defined(QCONFIG_HEADER_GUARD_NO_INCLUDE) || defined(QCONFIG_GENRTC)
18
19#if defined(QCONFIG_HEADER_GUARD) && !defined(QCONFIG_GENRTC)
20#define QCONFIG_HEADER_GUARD_NO_INCLUDE
21#else
22#define QCONFIG_HEADER_GUARD
23
24#ifndef BeginNamespace
25#define BeginNamespace(name) \
26 namespace name \
27 {
28#define EndNamespace() }
29#endif
30#if !defined(QCONFIG_GPU)
31#define AddOption(name, type, default, optname, optnameshort, help, ...) type name = default;
32#define AddVariable(name, type, default) type name = default;
33#define _AddOptionArray_INTERNAL_EXPAND(...) __VA_ARGS__
34#define AddOptionArray(name, type, count, default, optname, optnameshort, help, ...) type name[count] = {_AddOptionArray_INTERNAL_EXPAND default};
35#define AddOptionVec(name, type, optname, optnameshort, help, ...) std::vector<type> name;
36#else
37#define AddOption(name, type, default, optname, optnameshort, help, ...) type name;
38#define AddVariable(name, type, default) type name;
39#define AddOptionArray(name, type, count, default, optname, optnameshort, help, ...) type name[count];
40#define AddOptionVec(name, type, optname, optnameshort, help, ...) void* name[sizeof(std::vector<type>) / sizeof(void*)];
41#endif
42#ifdef QCONFIG_GENRTC
43#define AddVariableRTC(name, type, default) \
44 static constexpr type name = default; \
45 type _dummy_##name = default;
46#define AddOptionRTC(name, type, default, optname, optnameshort, help, ...) AddVariableRTC(name, type, default)
47#define _AddOptionArray_INTERNAL_EXPAND(...) __VA_ARGS__
48#define AddOptionArrayRTC(name, type, count, default, optname, optnameshort, help, ...) \
49 static constexpr type name[count] = {_AddOptionArray_INTERNAL_EXPAND default}; \
50 type _dummy_##name[count] = {_AddOptionArray_INTERNAL_EXPAND default};
51#else
52#define AddCustomCPP(...) __VA_ARGS__
53#endif
54#define AddOptionSet(name, type, value, optname, optnameshort, help, ...)
55#define AddSubConfig(name, instance) name instance;
56#if !defined(QCONFIG_GENRTC) && !defined(GPUCA_GPUCODE_DEVICE)
57#define BeginConfig(name, instance) \
58 struct name { \
59 bool operator==(const name&) const = default;
60#else
61#define BeginConfig(name, instance) struct name {
62#endif
63#define BeginSubConfig(name, instance, parent, preoptname, preoptnameshort, descr, ...) BeginConfig(name, instance)
64// clang-format off
65#define EndConfig() \
66 };
67// clang-format on
68
69#endif
70
71#include "qconfig_wrapinclude.h"
72
73#endif // QCONFIG_HEADER_GUARD_NO_INCLUDE