ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
priority.hpp
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header file is part of module \alib_config of the \aliblong.
4///
5/// \emoji :copyright: 2013-2024 A-Worx GmbH, Germany.
6/// Published under \ref mainpage_license "Boost Software License".
7//==================================================================================================
8#ifndef HPP_ALIB_CONFIG_PRIORITIES
9#define HPP_ALIB_CONFIG_PRIORITIES 1
10#pragma once
12
13ALIB_ASSERT_MODULE(CONFIGURATION)
14
15#include "alib/enums/records.hpp"
17#include <limits>
18
19namespace alib { namespace config {
20
21
22//==================================================================================================
23/// \alib{enums;T_EnumIsArithmetical;Arithmetical enumeration} used to control write access to
24/// configuration variables, depending on the source of assignable values.
25/// @see Chapter \ref alib_config_definition_prios of the Programmer's Manual of camp
26/// \alib_config_nl.
27//==================================================================================================
28enum class Priority : uint16_t
29{
30 /// This priority value denotes that a variable is undefined and has no value set.
31 /// The underlying integral value is \c 0.
32 NONE = 0,
33
34 /// Constant providing a priority which is even lower than default. A use-case for this
35 /// priority are for third party libraries that may preset variables in cases where values are
36 /// estimated or detected instead of defaulted.<br>
37 /// A using code of such library may then overwrite the auto-detection estimates, by setting a
38 /// default value in the configuration.<br>
39 /// This priority is not used internally (by any \alib camp) today.<br>
40 /// The underlying integral value is \c 1,000.
41 AutoDetected = 1000,
42
43 /// Used to store default values, either from (resourced) declarations, hard-coded values,
44 /// or values provided with method \alib{config;Configuration::PresetImportString}.
45 /// The underlying integral value is \c 2,000.
46 DefaultValues = 2000,
47
48 /// This is the default priority when a variable is defined for setting a 'hard-coded' value.
49 /// The underlying integral value is \c 4,000. Hard-coded values have a higher priority
50 /// than default values, but are deemed to get overwritten by any other configuration source.
51 Standard = 4000,
52
53 /// External application configuration sources use this element to define variables
54 /// found. This element is also used with built-in class \alib{config;IniFileFeeder}.
55 /// The underlying integral value is \c 6,000.
56 ConfigFile = 6000,
57
58 /// Used with plug-in \alib{config;EnvironmentVariablesPlugin}.
59 /// The underlying integral value is \c 8,000.
60 Environment = 8000,
61
62 /// Used to store temporary session information. Those are higher than \b Environment but lower
63 /// than \b CLI. This session priority is only a proposal. Implementations might use a
64 /// different value, even for different variables, for example <b>Environment - 1 </b> or
65 /// <b>CLI + 1 </b>. It depends on the use case.<br>
66 /// The underlying integral value is \c 10,000.
67 SessionFile = 10000,
68
69 /// Used with plug-in \alib{config;CLIVariablesPlugin}.
70 /// The underlying integral value is \c 12,000.
71 CLI = 12000,
72
73 /// Used to store generate temporary session information. While usually changes made in
74 /// source code has a low priority, session information is overwritten by running software, no
75 /// matter from which external source an existing values came.
76 /// If a software wants to disallow the change of session information imposed by a library
77 /// or a different software part, still a value can be set to protected.
78 /// The underlying integral value is \c 14,000.
79 Session = 14000,
80
81 /// Used to define variables with protected values. If all code entities apply to the
82 /// \ref alib_config_definition "contract that this camp imposes" in respect to variable
83 /// definitions and priorities, a value set with this priority cannot be manipulated from
84 /// "outside", hence by config files, command line arguments or any custom configuration source
85 /// or plug-in.
86 ///
87 /// The underlying integral value is <c>std::numeric_limits<int>::max()</c>.
88 Protected = (std::numeric_limits<uint16_t>::max)(),
89
90};
91
92//==================================================================================================
93/// \ref alib_enums_records "ALib Enum Record" associated with enumeration \alib{config;Priority}.
94//==================================================================================================
96{
97 /// The precedence of an operator in respect to other binary operators.
99
100 /// Required default constructor leaving the record undefined
101 /// (Requirement is documented with\alib{enums::EnumRecordPrototype}.)
102 ERPriority() noexcept = default;
103
104 /// Implementation of \alib{enums;EnumRecordPrototype::Parse}.
106 void Parse();
107};
108
109} // namespace alib::[config]
110
111/// Type alias in namespace \b alib.
112using Priority= alib::config::Priority;
113
114} // namespace [alib]
115
116// #################################################################################################
117// Macros
118// #################################################################################################
119ALIB_BOXING_VTABLE_DECLARE( alib::config::Priority, vt_config_priorities )
122
123#endif // HPP_ALIB_CONFIG_PRIORITIES
124
#define ALIB_ASSERT_MODULE(modulename)
Definition alib.hpp:223
#define ALIB_ENUMS_ASSIGN_RECORD(TEnum, TRecord)
Definition records.hpp:712
#define ALIB_API
Definition alib.hpp:639
#define ALIB_BOXING_VTABLE_DECLARE(TMapped, Identifier)
Definition vtable.inl:460
#define ALIB_ENUMS_MAKE_ARITHMETICAL(TEnum)
Definition alib.cpp:69
ALib Enum Record associated with enumeration Priority.
Definition priority.hpp:96
int Priority
The precedence of an operator in respect to other binary operators.
Definition priority.hpp:98
ERPriority() noexcept=default
ALIB_API void Parse()
Implementation of EnumRecordPrototype::Parse.