Flow 1.0.0
Flow project: Full implementation reference.
config_enum_start_hdr.macros.hpp
Go to the documentation of this file.
1/* Flow
2 * Copyright 2023 Akamai Technologies, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the
5 * "License"); you may not use this file except in
6 * compliance with the License. You may obtain a copy
7 * of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in
12 * writing, software distributed under the License is
13 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
14 * CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing
16 * permissions and limitations under the License. */
17
18/// @file
19
20/// @cond
21// -^- Doxygen, please ignore the following. This is wacky macro magic and not a regular `#pragma once` header.
22
23/* This file is to be `#include`d after the following:
24 * #define FLOW_LOG_CFG_COMPONENT_ENUM_CLASS X_log_component
25 * #define FLOW_LOG_CFG_COMPONENT_ENUM_NAME_MAP S_X_LOG_COMPONENT_NAME_MAP
26 * where X is some way to name your flow::log-logging module/project. The other parts of the name as flexible too;
27 * above is a convention at most.
28 *
29 * After `#include`ing this file, declare X_log_component's enum members, typically by `#include`ing a file named
30 * X/.../log_component_enum_declare.macros.hpp, featuring only lines of this format:
31 * FLOW_LOG_CFG_COMPONENT_DEFINE(FIRST_COMPONENT_NAME, 0)
32 * FLOW_LOG_CFG_COMPONENT_DEFINE(SECOND_COMPONENT_NAME, 1)
33 * ...etc....
34 * Requirements/conventions/tips about these names and numbers can be found in the model file which is Flow's own
35 * flow/detail/macros/log_component_enum_declare.macros.hpp.
36 *
37 * After that, `#include` the "end-cap" counterpart to the present file (i.e., config_enum_end_hdr.macros.hpp).
38 *
39 * The above elements must be present in an .hpp included by all logging source files in module/project X.
40 * For example Flow itself has this in common.hpp.
41 *
42 * Lastly, repeat the same procedure, but in a .cpp file (e.g., Flow's own common.cpp), except #include
43 * _cpp counterparts to the present file and config_enum_end_hdr.macros.hpp. That is,
44 * config_enum_{start|end}_cpp.macros.hpp should book-end another
45 * re-`#include`ing of X/.../log_component_enum_declare.macros.hpp. */
46#define FLOW_LOG_CFG_COMPONENT_DEFINE(ARG_name_root, ARG_enum_val) \
47 S_ ## ARG_name_root = ARG_enum_val,
48/* @todo Want to say `::flow::log::Component::enum_raw_t`, but because of C++'s circular-reference nonsense, I
49 * (ygoldfel) had difficulty with it. The fact this is a part of preprocessor-macro voodoo complicates the situation.
50 * A static_assert() in Component code will ensure this doesn't go out-of-sync (IS the same type) which is an OK but
51 * imperfect solution. Probably there's some _fwd.hpp-involving setup possible to be able to use enum_raw_t here.
52 * Anyway, both this and Component are under log/, so it's not so bad. */
53enum class FLOW_LOG_CFG_COMPONENT_ENUM_CLASS : unsigned int
54{
55
56// -v- Doxygen, please stop ignoring.
57/// @endcond