ALib C++ Framework
by
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
aloxcamp.inl
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header-file is part of module \alib_alox of the \aliblong.
4///
5/// \emoji :copyright: 2013-2025 A-Worx GmbH, Germany.
6/// Published under #"mainpage_license".
7//==================================================================================================
8ALIB_EXPORT namespace alib { namespace lox {
9
10//==================================================================================================
11/// Configuration variables uses by ALox.
12/// \note
13/// As required by module \alib_variables, this enumerations is equipped with
14/// #"alib_enums_records;ALib Enum Records" of type #"Declaration" and resourced
15/// with this module \alib_alox_nl.<br>
16/// Hence, all variable categories, names, default values and such can be modified
17/// by modifying the resource data of the singleton of class #"Basecamp".
18//==================================================================================================
19enum class Variables
20{
21 /// Denotes configuration variable #"alxcvALOX_NO_IDE_LOGGER" used by #"Log::AddDebugLogger;2".
23
24 /// Denotes configuration variable #"alxcvALOX_CONSOLE_TYPE" used by #"Lox::CreateConsoleLogger;2".
26
27 /// Denotes configuration variable #"alxcvALOX_LOGGERNAME_VERBOSITY_WITH_LOXNAME".
29
30 /// Denotes configuration variable #"alxcvALOX_GLOBAL_SOURCE_PATH_TRIM_RULES".
32
33 /// Denotes configuration variable #"alxcvALOX_LOXNAME_SOURCE_PATH_TRIM_RULES" used by class #"Lox".
35
36 /// Denotes configuration variable #"alxcvALOX_LOXNAME_DOMAIN_SUBSTITUTION" used by class #"Lox".
38
39 /// Denotes configuration variable #"alxcvALOX_LOXNAME_PREFIXES" used by class #"Lox".
41
42 /// Denotes configuration variable #"alxcvALOX_LOXNAME_DUMP_STATE_ON_EXIT" used by class #"Lox".
44
45 /// Denotes configuration variable #"alxcvALOX_LOGGERNAME_AUTO_SIZES" used by class #"TextLogger".
47
48 /// Denotes configuration variable #"alxcvALOX_LOGGERNAME_FORMAT" used by class #"TextLogger".
49 FORMAT = 21,
50
51 /// Denotes configuration variable #"alxcvALOX_LOGGERNAME_FORMAT_DATE_TIME" used by class #"TextLogger".
53
54 /// Denotes configuration variable #"alxcvALOX_LOGGERNAME_FORMAT_MULTILINE" used by class #"TextLogger".
56
57 /// Denotes configuration variable #"alxcvALOX_LOGGERNAME_FORMAT_TIME_DIFF" used by class #"TextLogger".
59
60 /// Denotes configuration variable #"alxcvALOX_LOGGERNAME_FORMAT_OTHER" used by class #"TextLogger".
62
63 /// Denotes configuration variable #"alxcvALOX_LOGGERNAME_REPLACEMENTS" used by class #"TextLogger".
65
66 /// Denotes configuration variable #"alxcvALOX_CONSOLE_LIGHT_COLORS" used by colorful specializations of class #"TextLogger".
68
69 #if defined(_WIN32)
70 /// Denotes configuration variable #"alxcvALOX_CODEPAGE" used by the class #"WindowsConsoleLogger".
72 #endif
73};
74
75//==================================================================================================
76/// Variable data struct, defining the verbosities of the domains of a \e Logger in a \e Lox.
77/// This struct is used with the #"alib_mod_variables;configuration variable" named
78/// #"alxcvALOX_LOGGERNAME_VERBOSITY_WITH_LOXNAME".
79///
80/// Note that during the run of software, the verbosity values are stored differently and this
81/// variable type is only for importing and exporting such values to external systems.
82//==================================================================================================
83struct CVVerbosities : protected StringVectorPA
84{
85 /// Determines whether only the minimum necessary domain tree is written when the verbosities
86 /// are exported. If \c true, redundant verbosity information is given, even if Subdomains
87 /// have the same value.
88 bool ExportAll =false;
89
90 /// Determines whether changes should be written back to configuration sources, if possible.
91 /// @see Methods #"Logger::SetVerbosityExport;*", #"Variable::IsWriteBack;*",
92 /// and the virtual method used to implement this feature: #"VMeta::isWriteBack;*".
93 bool WriteBack =false;
94
95 /// Constructor.
96 /// @param pAllocator The allocator to use.
98 : StringVectorPA(pAllocator) {}
99
100 /// Destructor. Frees all allocated strings.
102
104 using StringVectorPA::begin;
105 using StringVectorPA::end;
107
108 /// @return \c true if this vector is empty, \c false otherwise.
109 bool IsEmpty() { return empty(); }
110
111 /// Frees all allocated strings and clears vector.
112 void Clear() {
113 for ( auto it = begin() ; it != end() ; ++it )
114 it->Free( GetAllocator() );
115 clear();
116 }
117};
118
119//==================================================================================================
120/// This is the camp class for \alox logging library residing in namespace #"alib::lox".
121///
122/// This is a strict singleton class. The only instance is found with the namespace variable
123/// #"alib::ALOX".
124//==================================================================================================
125class ALoxCamp : public camp::Camp
126{
127 public:
128 /// Constructor.<br>
129 /// While this is public, it must not be invoked as this is a strict singleton type.
130 /// (See notes in #"alib_camp_camp").
131 ALoxCamp();
132
133 // Public fields
134 public:
135
136 #if defined(_WIN32)
137 /// Attributes of corresponding configuration variable #"alxcvALOX_CODEPAGE"
138 /// used by class #"WindowsConsoleLogger".
140 #endif
141
142 /// Resets this object. Concretely, the following steps are performed:
143 /// - If the debug lox singleton exists, it is deleted.
144 /// - It is asserted that no other lox object is registered.
145 /// - The \alox path of the configuration is deleted.
146 ///
147 /// \attention
148 /// This method was introduced to support resetting \alox in the unit tests.
149 /// In real applications, this method should NOT be used.
150 /// Side effects might appear using this method and it is not tested otherwise than
151 /// used in tests!
152 ALIB_DLL void Reset();
153
154 // Internals
155 protected:
156 /// Implementation of #"Camp::Bootstrap;*".
157 void Bootstrap() override;
158
159 /// Implementation of #"Camp::Shutdown;*".
160 /// @param phase The shutdown phase to perform.
161 void Shutdown( ShutdownPhases phase ) override;
162
163};// class ALoxCamp
164
165} // namespace alib[::lox]
166
167/// The singleton instance of \alibcamp class #"ALoxCamp".
169
170} // namespace [alib]
171
174
175//##################################################################################################
176// AppendableTraits<Scope> / AppendableTraits<Verbosity>
177//##################################################################################################
178#if !DOXYGEN
179ALIB_EXPORT namespace alib::strings {
180
181template<> struct AppendableTraits<Scope,nchar, lang::HeapAllocator>
182{
184 void operator()( TAString<nchar, lang::HeapAllocator>& target, const Scope src );
185};
186
187template<> struct AppendableTraits<Pair<Verbosity, Priority>,nchar, lang::HeapAllocator>
188{
190 void operator()( TAString<nchar, lang::HeapAllocator>& target, const Pair<Verbosity, Priority>& src );
191};
192
193} // namespace [alib::strings]
194
196struct VMeta_CVVerbosities : public VMeta
197{
198 ALIB_DLL String typeName () const override { return A_CHAR("ALOXV"); }
199ALIB_DBG(ALIB_DLL const std::type_info& dbgTypeID() override { return typeid(alib::lox::CVVerbosities); } )
200 ALIB_DLL void construct(VDATA* obj, PoolAllocator& pool) override { new (obj) alib::lox::CVVerbosities(pool); }
201 ALIB_DLL void destruct (VDATA* obj, PoolAllocator&) override { reinterpret_cast<alib::lox::CVVerbosities*>(obj)->~CVVerbosities(); }
202 ALIB_DLL size_t size () override { static_assert(alignof(alib::lox::CVVerbosities) <= alib::PoolAllocator::MAX_ALIGNMENT); return (std::max)( sizeof(alib::lox::CVVerbosities), sizeof(void*) ); }
203 ALIB_DLL void imPort (VDATA*, Configuration&, const StringEscaper&, const String&) override;
204 ALIB_DLL void exPort (VDATA*, Configuration&, const StringEscaper&, AString&) override;
205 ALIB_DLL bool isWriteBack(VDATA* obj) const override { return reinterpret_cast<alib::lox::CVVerbosities*>(obj)->WriteBack; }
206};}
207#endif // !DOXYGEN
#define ALIB_DLL
Definition alib.inl:573
#define A_CHAR(STR)
Definition alib.inl:1325
#define ALIB_EXPORT
Definition alib.inl:562
#define ALIB_DBG(...)
Definition alib.inl:931
#define ALIB_RESOURCED_IN_CAMP(T, Camp, ResName)
void Bootstrap() override
Implementation of #"Camp::Bootstrap;*".
Definition aloxcamp.cpp:104
static variables::Declaration CODEPAGE
Definition aloxcamp.inl:139
integer Add(const strings::TString< character > &src)
#define ALIB_ENUMS_ASSIGN_RECORD(TEnum, TRecord)
void typeName(const detail::VTable *vtable, AString &result)
@ FORMAT_TIME_DIFF
Denotes configuration variable #"alxcvALOX_LOGGERNAME_FORMAT_TIME_DIFF" used by class #"TextLogger".
Definition aloxcamp.inl:58
@ CONSOLE_LIGHT_COLORS
Denotes configuration variable #"alxcvALOX_CONSOLE_LIGHT_COLORS" used by colorful specializations of ...
Definition aloxcamp.inl:67
@ CONSOLE_TYPE
Denotes configuration variable #"alxcvALOX_CONSOLE_TYPE" used by #"Lox::CreateConsoleLogger;2".
Definition aloxcamp.inl:25
@ VERBOSITY
Denotes configuration variable #"alxcvALOX_LOGGERNAME_VERBOSITY_WITH_LOXNAME".
Definition aloxcamp.inl:28
@ FORMAT
Denotes configuration variable #"alxcvALOX_LOGGERNAME_FORMAT" used by class #"TextLogger".
Definition aloxcamp.inl:49
@ DOMAIN_SUBSTITUTION
Denotes configuration variable #"alxcvALOX_LOXNAME_DOMAIN_SUBSTITUTION" used by class #"Lox".
Definition aloxcamp.inl:37
@ CODEPAGE
Denotes configuration variable #"alxcvALOX_CODEPAGE" used by the class #"WindowsConsoleLogger".
Definition aloxcamp.inl:71
@ REPLACEMENTS
Denotes configuration variable #"alxcvALOX_LOGGERNAME_REPLACEMENTS" used by class #"TextLogger".
Definition aloxcamp.inl:64
@ DUMP_STATE_ON_EXIT
Denotes configuration variable #"alxcvALOX_LOXNAME_DUMP_STATE_ON_EXIT" used by class #"Lox".
Definition aloxcamp.inl:43
@ FORMAT_DATE_TIME
Denotes configuration variable #"alxcvALOX_LOGGERNAME_FORMAT_DATE_TIME" used by class #"TextLogger".
Definition aloxcamp.inl:52
@ FORMAT_MULTILINE
Denotes configuration variable #"alxcvALOX_LOGGERNAME_FORMAT_MULTILINE" used by class #"TextLogger".
Definition aloxcamp.inl:55
@ SPTR_GLOBAL
Denotes configuration variable #"alxcvALOX_GLOBAL_SOURCE_PATH_TRIM_RULES".
Definition aloxcamp.inl:31
@ FORMAT_OTHER
Denotes configuration variable #"alxcvALOX_LOGGERNAME_FORMAT_OTHER" used by class #"TextLogger".
Definition aloxcamp.inl:61
@ SPTR_LOX
Denotes configuration variable #"alxcvALOX_LOXNAME_SOURCE_PATH_TRIM_RULES" used by class #"Lox".
Definition aloxcamp.inl:34
@ PREFIXES
Denotes configuration variable #"alxcvALOX_LOXNAME_PREFIXES" used by class #"Lox".
Definition aloxcamp.inl:40
@ NO_IDE_LOGGER
Denotes configuration variable #"alxcvALOX_NO_IDE_LOGGER" used by #"Log::AddDebugLogger;2".
Definition aloxcamp.inl:22
@ AUTO_SIZES
Denotes configuration variable #"alxcvALOX_LOGGERNAME_AUTO_SIZES" used by class #"TextLogger".
Definition aloxcamp.inl:46
lox::Verbosity Verbosity
Type alias in namespace alib.
alib::variables::Priority Priority
Type alias in namespace alib.
lang::HeapAllocator HeapAllocator
Type alias in namespace alib.
lox::ALoxCamp ALOX
The singleton instance of ALib Camp class #"ALoxCamp".
Definition aloxcamp.cpp:54
ShutdownPhases
Termination levels usable with #"alib_mod_bs_camps;Bootstrapping ALib Camps".
Definition camp.inl:42
strings::util::TStringVector< character, PoolAllocator > StringVectorPA
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
Definition string.inl:2172
boxing::Pair< T, U > Pair
Type alias in namespace alib.
characters::nchar nchar
Type alias in namespace alib.
void Shutdown()
lox::Scope Scope
Type alias in namespace alib.
void Clear()
Frees all allocated strings and clears vector.
Definition aloxcamp.inl:112
CVVerbosities(AllocatorType &pAllocator)
Definition aloxcamp.inl:97
~CVVerbosities()
Destructor. Frees all allocated strings.
Definition aloxcamp.inl:101
void operator()(TAString< TChar > &target, const TAppendable &src)