ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib.hpp
Go to the documentation of this file.
1/** ************************************************************************************************
2 * \file
3 * This header file is part of the \aliblong.
4 *
5 * \emoji :copyright: 2013-2024 A-Worx GmbH, Germany.
6 * Published under \ref mainpage_license "Boost Software License".
7 *
8 * This header does not belong to a module of \alib, but is
9 * included in any \alibdist.
10 * Its purposes are:
11 * - To identify given \ref GrpALibPreproSymbols related to module selection and enable
12 * corresponding symbols (that may be not given) of dependent modules.
13 * - Provide functions \alib{Bootstrap} and \alib{Shutdown} which select the right bootstrapping
14 * and shutdown methods, depending on the \alibdist_nl.
15 *
16 * \note
17 * This header is not shown in inclusion graphs of this documentation, as it is always
18 * included directly or indirectly.
19 **************************************************************************************************/
20#ifndef HPP_ALIB
21#define HPP_ALIB 1
22
23#define ALIB_VERSION 2402
24#define ALIB_REVISION 1
25
26#if !defined(ALIB_DOX)
27
28// #################################################################################################
29// No module selection symbol given but threads? -> choose ALL
30// #################################################################################################
31#if !defined( ALIB_ALOX ) \
32 && !defined( ALIB_BITBUFFER ) \
33 && !defined( ALIB_BOXING ) \
34 && !defined( ALIB_CHARACTERS ) \
35 && !defined( ALIB_CLI ) \
36 && !defined( ALIB_CONFIGURATION) \
37 && !defined( ALIB_ENUMS ) \
38 && !defined( ALIB_EXPRESSIONS ) \
39 && !defined( ALIB_FILES ) \
40 && !defined( ALIB_MONOMEM ) \
41 && !defined( ALIB_SINGLETONS ) \
42 && !defined( ALIB_STRINGS ) \
43 && !defined( ALIB_CAMP ) \
44 && !defined( ALIB_TIME ) \
45 && !defined( ALIB_THREADS )
46# define ALIB_ALOX 1
47# define ALIB_EXPRESSIONS 1
48# define ALIB_CLI 1
49# define ALIB_FILES 1
50# define ALIB_THREADS 1
51# define ALIB_BITBUFFER 1
52#endif
53
54#if !defined(ALIB_ALOX )
55# define ALIB_ALOX 0
56#endif
57#if !defined(ALIB_BITBUFFER )
58# define ALIB_BITBUFFER 0
59#endif
60#if !defined(ALIB_BOXING )
61# define ALIB_BOXING 0
62#endif
63#if !defined(ALIB_CLI )
64# define ALIB_CLI 0
65#endif
66#if !defined(ALIB_CHARACTERS )
67# define ALIB_CHARACTERS 0
68#endif
69#if !defined(ALIB_CONFIGURATION)
70# define ALIB_CONFIGURATION 0
71#endif
72#if !defined(ALIB_ENUMS )
73# define ALIB_ENUMS 0
74#endif
75#if !defined(ALIB_EXPRESSIONS )
76# define ALIB_EXPRESSIONS 0
77#endif
78#if !defined(ALIB_FILES )
79# define ALIB_FILES 0
80#endif
81#if !defined(ALIB_MONOMEM )
82# define ALIB_MONOMEM 0
83#endif
84#if !defined(ALIB_SINGLETONS )
85# define ALIB_SINGLETONS 0
86#endif
87#if !defined(ALIB_STRINGS )
88# define ALIB_STRINGS 0
89#endif
90#if !defined(ALIB_CAMP )
91# define ALIB_CAMP 0
92#endif
93#if !defined(ALIB_TIME )
94# define ALIB_TIME 0
95#endif
96#if !defined( ALIB_THREADS )
97# define ALIB_THREADS 0
98#endif
99
100
101// #################################################################################################
102// Resolve module dependencies
103// #################################################################################################
104#if ALIB_ALOX
105# undef ALIB_CONFIGURATION
106# define ALIB_CONFIGURATION 1
107#endif
108#if ALIB_CLI
109# undef ALIB_CAMP
110# define ALIB_CAMP 1
111#endif
112#if ALIB_CONFIGURATION
113# undef ALIB_CAMP
114# define ALIB_CAMP 1
115#endif
116#if ALIB_EXPRESSIONS
117# undef ALIB_CAMP
118# define ALIB_CAMP 1
119#endif
120#if ALIB_FILES
121# undef ALIB_CAMP
122# define ALIB_CAMP 1
123#endif
124#if ALIB_CAMP
125# undef ALIB_STRINGS
126# define ALIB_STRINGS 1
127# undef ALIB_BOXING
128# define ALIB_BOXING 1
129# undef ALIB_ENUMS
130# define ALIB_ENUMS 1
131# undef ALIB_TIME
132# define ALIB_TIME 1
133# undef ALIB_MONOMEM
134# define ALIB_MONOMEM 1
135#endif
136#if ALIB_BITBUFFER
137# undef ALIB_MONOMEM
138# define ALIB_MONOMEM 1
139# undef ALIB_ENUMS
140# define ALIB_ENUMS 1
141#endif
142#if ALIB_ENUMS
143# undef ALIB_STRINGS
144# define ALIB_STRINGS 1
145# undef ALIB_SINGLETONS
146# define ALIB_SINGLETONS 1
147#endif
148#if ALIB_THREADS
149# undef ALIB_STRINGS
150# define ALIB_STRINGS 1
151#endif
152#if ALIB_STRINGS
153# undef ALIB_CHARACTERS
154# define ALIB_CHARACTERS 1
155#endif
156#if ALIB_BOXING
157# undef ALIB_SINGLETONS
158# define ALIB_SINGLETONS 1
159# undef ALIB_CHARACTERS
160# define ALIB_CHARACTERS 1
161#endif
162
163// #################################################################################################
164// if !defined(ALIB_DOX)
165// #################################################################################################
166#else
167#define ALIB_ALOX 1
168#define ALIB_BITBUFFER 1
169#define ALIB_BOXING 1
170#define ALIB_CAMP 1
171#define ALIB_CHARACTERS 1
172#define ALIB_CLI 1
173#define ALIB_CONFIGURATION 1
174#define ALIB_ENUMS 1
175#define ALIB_EXPRESSIONS 1
176#define ALIB_FILES 1
177#define ALIB_MONOMEM 1
178#define ALIB_SINGLETONS 1
179#define ALIB_STRINGS 1
180#define ALIB_THREADS 1
181#define ALIB_TIME 1
182
183#endif //!defined(ALIB_DOX)
184
185// #################################################################################################
186// Macros for checking availability of modules
187// #################################################################################################
188#define ALIB_DOCUMENTATION_URL "https://alib.dev/"
189
190#define ALIB_ASSERT_MODULE(modulename) \
191static_assert( ALIB_ ## modulename, \
192 "This module is not included in the ALib distribution/built. " \
193 "See " ALIB_DOCUMENTATION_URL "alib_manual.html for more information" ); \
194
195// #################################################################################################
196// Macros to sect code (without using #if/#endif)
197// #################################################################################################
198#if ALIB_ALOX
199# define ALIB_IF_ALOX(...) __VA_ARGS__
200# define ALIB_IFN_ALOX(...)
201#else
202# define ALIB_IF_ALOX(...)
203# define ALIB_IFN_ALOX(...) __VA_ARGS__
204#endif
205
206#if ALIB_BITBUFFER
207# define ALIB_IF_BITBUFFER(...) __VA_ARGS__
208# define ALIB_IFN_BITBUFFER(...)
209#else
210# define ALIB_IF_BITBUFFER(...)
211# define ALIB_IFN_BITBUFFER(...) __VA_ARGS__
212#endif
213
214#if ALIB_BOXING
215# define ALIB_IF_BOXING(...) __VA_ARGS__
216# define ALIB_IFN_BOXING(...)
217#else
218# define ALIB_IF_BOXING(...)
219# define ALIB_IFN_BOXING(...) __VA_ARGS__
220#endif
221
222#if ALIB_CHARACTERS
223# define ALIB_IF_CHARACTERS(...) __VA_ARGS__
224# define ALIB_IFN_CHARACTERS(...)
225#else
226# define ALIB_IF_CHARACTERS(...)
227# define ALIB_IFN_CHARACTERS(...) __VA_ARGS__
228#endif
229
230#if ALIB_CLI
231# define ALIB_IF_CLI(...) __VA_ARGS__
232# define ALIB_IFN_CLI(...)
233#else
234# define ALIB_IF_CLI(...)
235# define ALIB_IFN_CLI(...) __VA_ARGS__
236#endif
237
238#if ALIB_CONFIGURATION
239# define ALIB_IF_CONFIGURATION(...) __VA_ARGS__
240# define ALIB_IFN_CONFIGURATION(...)
241#else
242# define ALIB_IF_CONFIGURATION(...)
243# define ALIB_IFN_CONFIGURATION(...) __VA_ARGS__
244#endif
245
246#if ALIB_ENUMS
247# define ALIB_IF_ENUMS(...) __VA_ARGS__
248# define ALIB_IFN_ENUMS(...)
249#else
250# define ALIB_IF_ENUMS(...)
251# define ALIB_IFN_ENUMS(...) __VA_ARGS__
252#endif
253
254#if ALIB_EXPRESSIONS
255# define ALIB_IF_EXPRESSIONS(...) __VA_ARGS__
256# define ALIB_IFN_EXPRESSIONS(...)
257#else
258# define ALIB_IF_EXPRESSIONS(...)
259# define ALIB_IFN_EXPRESSIONS(...) __VA_ARGS__
260#endif
261
262#if ALIB_FILES
263# define ALIB_IF_FILES(...) __VA_ARGS__
264# define ALIB_IFN_FILES(...)
265#else
266# define ALIB_IF_FILES(...)
267# define ALIB_IFN_FILES(...) __VA_ARGS__
268#endif
269
270#if ALIB_MONOMEM
271# define ALIB_IF_MONOMEM(...) __VA_ARGS__
272# define ALIB_IFN_MONOMEM(...)
273#else
274# define ALIB_IF_MONOMEM(...)
275# define ALIB_IFN_MONOMEM(...) __VA_ARGS__
276#endif
277
278#if ALIB_SINGLETONS
279# define ALIB_IF_SINGLETONS(...) __VA_ARGS__
280# define ALIB_IFN_SINGLETONS(...)
281#else
282# define ALIB_IF_SINGLETONS(...)
283# define ALIB_IFN_SINGLETONS(...) __VA_ARGS__
284#endif
285
286#if ALIB_STRINGS
287# define ALIB_IF_STRINGS(...) __VA_ARGS__
288# define ALIB_IFN_STRINGS(...)
289#else
290# define ALIB_IF_STRINGS(...)
291# define ALIB_IFN_STRINGS(...) __VA_ARGS__
292#endif
293
294#if ALIB_CAMP
295# define ALIB_IF_CAMP(...) __VA_ARGS__
296# define ALIB_IFN_CAMP(...)
297#else
298# define ALIB_IF_CAMP(...)
299# define ALIB_IFN_CAMP(...) __VA_ARGS__
300#endif
301
302#if ALIB_THREADS
303# define ALIB_IF_THREADS(...) __VA_ARGS__
304# define ALIB_IFN_THREADS(...)
305#else
306# define ALIB_IF_THREADS(...)
307# define ALIB_IFN_THREADS(...) __VA_ARGS__
308#endif
309
310#if ALIB_TIME
311# define ALIB_IF_TIME(...) __VA_ARGS__
312# define ALIB_IFN_TIME(...)
313#else
314# define ALIB_IF_TIME(...)
315# define ALIB_IFN_TIME(...) __VA_ARGS__
316#endif
317
318// #################################################################################################
319// ALib Feature detection
320// (Note: this has to be done outside of the module code, because the features are used with
321// the compilation verification flags below)
322// #################################################################################################
323
324// ALIB_FEAT_SINGLETON_MAPPED
325#if !defined(ALIB_FEAT_SINGLETON_MAPPED)
326# if defined(_WIN32)
327# define ALIB_FEAT_SINGLETON_MAPPED 1
328# else
329# define ALIB_FEAT_SINGLETON_MAPPED 0
330# endif
331#endif
332
333// ALIB_CHARACTERS_WIDE, ALIB_SIZEOF_WCHAR_T
334#if defined(__WCHAR_MAX__)
335 #if __WCHAR_MAX__ == 0x7FFFFFFF \
336 || __WCHAR_MAX__ == 0xFFFFFFFF
337 #define ALIB_SIZEOF_WCHAR_T 4
338 #else
339 #define ALIB_SIZEOF_WCHAR_T 2
340 #endif
341#elif defined(_MSC_VER)
342 #define ALIB_SIZEOF_WCHAR_T 2
343#else
344# define ALIB_SIZEOF_WCHAR_T 4 // guessing, will be checked below
345#endif
346
347static_assert( sizeof(wchar_t) == ALIB_SIZEOF_WCHAR_T, "Error: Platform not supported" );
348
349#if !defined(ALIB_CHARACTERS_WIDE)
350# if defined(_MSC_VER)
351# define ALIB_CHARACTERS_WIDE 1
352# else
353# define ALIB_CHARACTERS_WIDE 0
354# endif
355#endif
356
357#if !defined(ALIB_CHARACTERS_SIZEOF_WCHAR)
358# define ALIB_CHARACTERS_SIZEOF_WCHAR ALIB_SIZEOF_WCHAR_T
359#elif (ALIB_CHARACTERS_SIZEOF_WCHAR != 2) && (ALIB_CHARACTERS_SIZEOF_WCHAR != 4 )
360# error "Illegal value for symbol ALIB_CHARACTERS_SIZEOF_WCHAR given. Allowed is 2 or 4."
361#endif
362
363// ALIB_FEAT_BOXING_BIJECTIVE_INTEGRALS
364// ALIB_FEAT_BOXING_BIJECTIVE_CHARACTERS
365// ALIB_FEAT_BOXING_BIJECTIVE_FLOATS
366// ALIB_DEBUG_BOXING
367#if !defined(ALIB_FEAT_BOXING_BIJECTIVE_INTEGRALS)
368# define ALIB_FEAT_BOXING_BIJECTIVE_INTEGRALS 0
369#endif
370
371#if !defined(ALIB_FEAT_BOXING_BIJECTIVE_CHARACTERS)
372# define ALIB_FEAT_BOXING_BIJECTIVE_CHARACTERS 0
373#endif
374
375#if !defined(ALIB_FEAT_BOXING_BIJECTIVE_FLOATS)
376# define ALIB_FEAT_BOXING_BIJECTIVE_FLOATS 0
377#endif
378
379#if !defined(ALIB_DEBUG_BOXING)
380# define ALIB_DEBUG_BOXING 0
381#elif !ALIB_DEBUG && ALIB_DEBUG_BOXING
382# undef ALIB_DEBUG_BOXING
383# define ALIB_DEBUG_BOXING 0
384# pragma message "Symbol ALIB_DEBUG_BOXING set (from outside!) while ALIB_DEBUG is not. The symbol got disabled."
385#endif
386
387// ALIB_DEBUG_STRINGS
388#if !defined(ALIB_DEBUG_STRINGS)
389# define ALIB_DEBUG_STRINGS 0
390#elif !ALIB_DEBUG && ALIB_DEBUG_STRINGS
391# undef ALIB_DEBUG_STRINGS
392# define ALIB_DEBUG_STRINGS 0
393# pragma message "Symbol ALIB_DEBUG_STRINGS set (from outside!) while ALIB_DEBUG is not. The symbol got disabled."
394#endif
395
396// ALIB_DEBUG_MONOMEM
397#if !defined(ALIB_DEBUG_MONOMEM)
398# define ALIB_DEBUG_MONOMEM 0
399#elif !ALIB_DEBUG && ALIB_DEBUG_MONOMEM
400# undef ALIB_DEBUG_MONOMEM
401# define ALIB_DEBUG_MONOMEM 0
402# pragma message "Symbol ALIB_DEBUG_MONOMEM set (from outside!) while ALIB_DEBUG is not. The symbol got disabled."
403#endif
404
405// ALIB_DEBUG_RESOURCES
406#if !defined(ALIB_DEBUG_RESOURCES)
407# define ALIB_DEBUG_RESOURCES 0
408#elif !ALIB_DEBUG && ALIB_DEBUG_RESOURCES
409# undef ALIB_DEBUG_RESOURCES
410# define ALIB_DEBUG_RESOURCES 0
411# pragma message "Symbol ALIB_DEBUG_RESOURCES set (from outside!) while ALIB_DEBUG is not. The symbol got disabled."
412#endif
413
414// ALOX_DBG_LOG, ALOX_REL_LOG, ALOX_DBG_LOG_CI, ALOX_REL_LOG_CI
415#if !defined(ALOX_DBG_LOG)
416# define ALOX_DBG_LOG ALIB_DEBUG
417#endif
418#if !defined(ALOX_DBG_LOG_CI)
419# define ALOX_DBG_LOG_CI ALIB_DEBUG
420#endif
421
422#if !defined(ALOX_REL_LOG)
423# define ALOX_REL_LOG 1
424#endif
425#if !defined(ALOX_REL_LOG_CI)
426# define ALOX_REL_LOG_CI 0
427#endif
428
429// #################################################################################################
430// Compiler detection and specifics
431// #################################################################################################
432#if !defined(ALIB_DOX)
433 #define DOX_MARKER( marker )
434#endif
435
436
437// GCC Compiler detection
438#if defined(__clang__)
439#elif defined(__INTEL_COMPILER) //never tested
440#elif defined(_MSC_VER)
441#elif defined(__GNUC__)
442# define ALIB_GCC 1
443#endif
444
445
446
447// Debug or release compilation
448#if !defined(ALIB_DEBUG)
449# if !defined(NDEBUG) || defined(_DEBUG) || defined(DEBUG)
450# define ALIB_DEBUG 1
451# else
452# define ALIB_DEBUG 0
453# endif
454#endif
455
456#if ALIB_DEBUG
457 #define ALIB_DBG(...) __VA_ARGS__
458 #define ALIB_REL(...)
459 #define ALIB_REL_DBG(releaseCode, ...) __VA_ARGS__
460#else
461 #define ALIB_DBG(...)
462 #define ALIB_REL(...) __VA_ARGS__
463 #define ALIB_REL_DBG(releaseCode, ...) releaseCode
464#endif
465
466
467// --- C++ standard: set ALIB_CPP_STANDARD ---
468
469// deduce && disallow < 17
470#if defined ( _MSC_VER )
471# if _MSC_VER < 1928 // VS 2019 == VC16.8 == _MSC_VER 1928 -> C++17
472# error "ALib needs C++ standard 17. Microsoft compiler < v16.8 not supported. Compilation aborted"
473# endif
474# if defined(_MSVC_LANG)
475# if _MSVC_LANG < 201703L
476# error "ALib needs C++ standard 17. Wrong compilation settings given."
477# elif _MSVC_LANG == 201703L
478# define ALIB_INTERNAL_DEDUCED_CPPVER 17
479# elif _MSVC_LANG == 202002L
480# define ALIB_INTERNAL_DEDUCED_CPPVER 20
481# elif _MSVC_LANG > 202002L
482# define ALIB_INTERNAL_DEDUCED_CPPVER 23
483# endif
484# endif
485
486
487#elif defined(__cplusplus)
488# if __cplusplus < 201703L
489# error "ALib needs C++ 17. Compilation aborted"
490# else
491# define ALIB_INTERNAL_DEDUCED_CPPVER 17
492# endif
493# if __cplusplus == 202002L
494# undef ALIB_INTERNAL_DEDUCED_CPPVER
495# define ALIB_INTERNAL_DEDUCED_CPPVER 20
496# endif
497# if __cplusplus > 202002L
498# undef ALIB_INTERNAL_DEDUCED_CPPVER
499# define ALIB_INTERNAL_DEDUCED_CPPVER 23
500# endif
501#endif
502
503// check whether detected, given or given falsely
504#if !defined(ALIB_CPP_STANDARD)
505# if defined(ALIB_INTERNAL_DEDUCED_CPPVER)
506# define ALIB_CPP_STANDARD ALIB_INTERNAL_DEDUCED_CPPVER
507# else
508# error "Unknown compiler/toolchain. Can't deduce ALIB_CPP_STANDARD. Please provide this symbol 'manually' to the compiler."
509# endif
510#else
511# if defined(ALIB_INTERNAL_DEDUCED_CPPVER)
512# if (ALIB_CPP_STANDARD != ALIB_INTERNAL_DEDUCED_CPPVER)
513# error "ALIB_CPP_STANDARD was explicitly passed to the compiler, but does not match the language standard deduced by ALib."
514# endif
515# elif ALIB_CPP_STANDARD != 17 && ALIB_CPP_STANDARD != 20 && ALIB_CPP_STANDARD != 23
516# error "ALIB_CPP_STANDARD must be set to 17, 20 or 23."
517# endif
518#endif
519
520// final internal check
521#if ALIB_CPP_STANDARD != 17 && ALIB_CPP_STANDARD != 20 && ALIB_CPP_STANDARD != 23
522# error "Error in header. This must never happen."
523#endif
524
525// Inline code selection dependent on C++ Version
526#if ALIB_CPP_STANDARD >= 23
527# define ALIB_CPP_23(...) __VA_ARGS__
528# define ALIB_CPP_BEFORE_23(...)
529#else
530# define ALIB_CPP_23(...)
531# define ALIB_CPP_BEFORE_23(...) __VA_ARGS__
532#endif
533
534
535// Windows DLL Import/Export
536#if defined( _MSC_VER ) && !defined( ALIB_API_NO_DLL )
537 #ifdef ALIB_API_IS_DLL
538 #define ALIB_API __declspec(dllexport)
539 #else
540 #define ALIB_API __declspec(dllimport)
541 #endif
542#else
543 #define ALIB_API
544#endif
545
546
547// annotations
548#if defined( _MSC_VER )
549# define ALIB_FORCE_INLINE __forceinline
550#else
551# define ALIB_FORCE_INLINE __attribute__((always_inline)) inline
552#endif
553#define ALIB_NO_RETURN [[ noreturn ]]
554
555
556// Warnings
557#if defined(ALIB_GCC)
558
559 #define ALIB_WARNINGS_UNINITIALIZED_OFF \
560 _Pragma("GCC diagnostic push") \
561 _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") \
562
563 #define ALIB_WARNINGS_ALLOW_NULL_POINTER_PASSING \
564 _Pragma("GCC diagnostic push") \
565 _Pragma("GCC diagnostic ignored \"-Wnonnull\"") \
566
567 #define ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE \
568 _Pragma("GCC diagnostic push") \
569
570 #define ALIB_WARNINGS_ALLOW_MACRO_REDEFINITION \
571 _Pragma("GCC diagnostic push") \
572
573 #define ALIB_WARNINGS_ALLOW_UNSAFE_FUNCTION_OR_VARIABLE \
574 _Pragma("GCC diagnostic push") \
575
576 #define ALIB_WARNINGS_MACRO_NOT_USED_OFF \
577 _Pragma("GCC diagnostic push") \
578
579 #define ALIB_WARNINGS_RESERVED_MACRO_NAME_OFF \
580 _Pragma("GCC diagnostic push") \
581
582 #define ALIB_WARNINGS_OVERLOAD_VIRTUAL_OFF \
583 _Pragma("GCC diagnostic push") \
584
585 #define ALIB_WARNINGS_ALLOW_SPARSE_ENUM_SWITCH \
586 _Pragma("GCC diagnostic push") \
587 _Pragma("GCC diagnostic ignored \"-Wswitch\"") \
588
589 #define ALIB_WARNINGS_ALLOW_BITWISE_SWITCH \
590 _Pragma("GCC diagnostic push") \
591 _Pragma("GCC diagnostic ignored \"-Wswitch\"") \
592
593 #define ALIB_WARNINGS_ALLOW_SHIFT_COUNT_OVERFLOW \
594 _Pragma("GCC diagnostic push") \
595 _Pragma("GCC diagnostic ignored \"-Wshift-count-overflow\"") \
596
597 #define ALIB_WARNINGS_IGNORE_UNUSED_PARAMETER \
598 _Pragma("GCC diagnostic push") \
599 _Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") \
600
601 #define ALIB_WARNINGS_IGNORE_UNUSED_MACRO \
602 _Pragma("GCC diagnostic push") \
603 _Pragma("GCC diagnostic ignored \"-Wunused-macros\"") \
604
605 #define ALIB_WARNINGS_IGNORE_FUNCTION_TEMPLATE \
606 _Pragma("GCC diagnostic push") \
607
608 #define ALIB_WARNINGS_IGNORE_NOTHING_RETURNED \
609 _Pragma("GCC diagnostic push") \
610 _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \
611
612 #define ALIB_WARNINGS_IGNORE_INTEGRAL_CONSTANT_OVERFLOW \
613 _Pragma("GCC diagnostic push") \
614
615 #define ALIB_WARNINGS_IGNORE_RESERVED_IDENTIFIER \
616 _Pragma("GCC diagnostic push") \
617
618 #define ALIB_WARNINGS_IGNORE_DOCS \
619 _Pragma("GCC diagnostic push") \
620
621 #define ALIB_WARNINGS_IGNORE_INTEGER_OVERFLOW \
622 _Pragma("GCC diagnostic push") \
623 _Pragma("GCC diagnostic ignored \"-Wshift-count-overflow\"") \
624
625 #define ALIB_WARNINGS_RESTORE \
626 _Pragma("GCC diagnostic pop")
627
628 #if __GNUC__ < 7
629 #define ALIB_FALLTHROUGH
630 #else
631 #define ALIB_FALLTHROUGH [[gnu::fallthrough]];
632 #endif
633
634#elif defined(__clang__)
635
636 #define ALIB_WARNINGS_UNINITIALIZED_OFF \
637 _Pragma("clang diagnostic push") \
638 _Pragma("clang diagnostic ignored \"-Wuninitialized\"") \
639 _Pragma("clang diagnostic ignored \"-Wconditional-uninitialized\"") \
640
641 #define ALIB_WARNINGS_ALLOW_NULL_POINTER_PASSING \
642 _Pragma("clang diagnostic push") \
643
644 #define ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE \
645 _Pragma("clang diagnostic push") \
646 _Pragma("clang diagnostic ignored \"-Wunsafe-buffer-usage\"") \
647
648 #define ALIB_WARNINGS_OVERLOAD_VIRTUAL_OFF \
649 _Pragma("clang diagnostic push") \
650 _Pragma("clang diagnostic ignored \"-Woverloaded-virtual\"") \
651
652 #define ALIB_WARNINGS_ALLOW_MACRO_REDEFINITION \
653 _Pragma("clang diagnostic push") \
654 _Pragma("clang diagnostic ignored \"-Wmacro-redefined\"") \
655
656 #define ALIB_WARNINGS_ALLOW_UNSAFE_FUNCTION_OR_VARIABLE \
657 _Pragma("clang diagnostic push") \
658 _Pragma("clang diagnostic ignored \"-Wunused-macros\"") \
659
660
661 #define ALIB_WARNINGS_MACRO_NOT_USED_OFF \
662 _Pragma("clang diagnostic push") \
663 _Pragma("clang diagnostic ignored \"-Wunused-macros\"") \
664
665 #define ALIB_WARNINGS_RESERVED_MACRO_NAME_OFF \
666 _Pragma("clang diagnostic push") \
667 _Pragma("clang diagnostic ignored \"-Wreserved-macro-identifier\"") \
668
669 #define ALIB_WARNINGS_ALLOW_SPARSE_ENUM_SWITCH \
670 _Pragma("clang diagnostic push") \
671 _Pragma("clang diagnostic ignored \"-Wswitch\"") \
672 _Pragma("clang diagnostic ignored \"-Wswitch-enum\"") \
673
674 #define ALIB_WARNINGS_ALLOW_BITWISE_SWITCH \
675 _Pragma("clang diagnostic push") \
676 _Pragma("clang diagnostic ignored \"-Wswitch\"") \
677 _Pragma("clang diagnostic ignored \"-Wcovered-switch-default\"") \
678
679 #define ALIB_WARNINGS_ALLOW_SHIFT_COUNT_OVERFLOW \
680 _Pragma("clang diagnostic push") \
681 _Pragma("clang diagnostic ignored \"-Wshift-count-overflow\"") \
682
683 #define ALIB_WARNINGS_IGNORE_UNUSED_PARAMETER \
684 _Pragma("clang diagnostic push") \
685 _Pragma("clang diagnostic ignored \"-Wunused-parameter\"") \
686
687 #define ALIB_WARNINGS_IGNORE_UNUSED_MACRO \
688 _Pragma("clang diagnostic push") \
689 _Pragma("clang diagnostic ignored \"-Wunused-macros\"") \
690
691 #define ALIB_WARNINGS_IGNORE_FUNCTION_TEMPLATE \
692 _Pragma("clang diagnostic push") \
693 _Pragma("clang diagnostic ignored \"-Wunused-template\"") \
694
695 #define ALIB_WARNINGS_IGNORE_NOTHING_RETURNED \
696 _Pragma("clang diagnostic push") \
697 _Pragma("clang diagnostic ignored \"-Wreturn-type\"") \
698
699 #define ALIB_WARNINGS_IGNORE_INTEGRAL_CONSTANT_OVERFLOW \
700 _Pragma("clang diagnostic push") \
701
702 #define ALIB_WARNINGS_IGNORE_DOCS \
703 _Pragma("clang diagnostic push") \
704 _Pragma("clang diagnostic ignored \"-Wdocumentation\"") \
705
706 #define ALIB_WARNINGS_IGNORE_RESERVED_IDENTIFIER \
707 _Pragma("clang diagnostic push") \
708 _Pragma("clang diagnostic ignored \"-Wreserved-identifier\"") \
709
710 #define ALIB_WARNINGS_IGNORE_INTEGER_OVERFLOW \
711 _Pragma("clang diagnostic push") \
712 _Pragma("clang diagnostic ignored \"-Winteger-overflow\"") \
713
714
715 #define ALIB_WARNINGS_RESTORE \
716 _Pragma("clang diagnostic pop") \
717
718 #define ALIB_FALLTHROUGH [[clang::fallthrough]];
719
720
721#elif defined(_MSC_VER)
722 #define ALIB_WARNINGS_UNINITIALIZED_OFF \
723 __pragma(warning( push )) \
724 __pragma(warning( disable : 4701 )) \
725
726 #define ALIB_WARNINGS_ALLOW_NULL_POINTER_PASSING \
727 __pragma(warning( push )) \
728
729 #define ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE \
730 __pragma(warning( push )) \
731
732 #define ALIB_WARNINGS_MACRO_NOT_USED_OFF \
733 __pragma(warning( push )) \
734
735 #define ALIB_WARNINGS_RESERVED_MACRO_NAME_OFF \
736 __pragma(warning( push )) \
737
738 #define ALIB_WARNINGS_OVERLOAD_VIRTUAL_OFF \
739 __pragma(warning( push )) \
740
741 #define ALIB_WARNINGS_ALLOW_SPARSE_ENUM_SWITCH \
742 __pragma(warning( push )) \
743
744 #define ALIB_WARNINGS_ALLOW_SPARSE_ENUM_SWITCH \
745 __pragma(warning( push )) \
746
747 #define ALIB_WARNINGS_ALLOW_MACRO_REDEFINITION \
748 __pragma(warning( push )) \
749 __pragma(warning( disable : 4005 )) \
750
751 #define ALIB_WARNINGS_ALLOW_UNSAFE_FUNCTION_OR_VARIABLE \
752 __pragma(warning( push )) \
753 __pragma(warning( disable : 4996 )) \
754
755 #define ALIB_WARNINGS_ALLOW_BITWISE_SWITCH \
756 __pragma(warning( push )) \
757
758 #define ALIB_WARNINGS_ALLOW_SHIFT_COUNT_OVERFLOW \
759 __pragma(warning( push )) \
760
761 #define ALIB_WARNINGS_IGNORE_UNUSED_PARAMETER \
762 __pragma(warning( push )) \
763
764 #define ALIB_WARNINGS_IGNORE_UNUSED_MACRO \
765 __pragma(warning( push )) \
766
767 #define ALIB_WARNINGS_IGNORE_FUNCTION_TEMPLATE \
768 __pragma(warning( push )) \
769
770 #define ALIB_WARNINGS_IGNORE_NOTHING_RETURNED \
771 __pragma(warning( push )) \
772 __pragma(warning( disable : 4715 )) \
773
774 #define ALIB_WARNINGS_IGNORE_INTEGRAL_CONSTANT_OVERFLOW \
775 __pragma(warning( push )) \
776 __pragma(warning( disable : 4305 )) \
777 __pragma(warning( disable : 4307 )) \
778 __pragma(warning( disable : 4309 )) \
779 __pragma(warning( disable : 4310 )) \
780 __pragma(warning( disable : 4293 )) \
781
782 #define ALIB_WARNINGS_IGNORE_INTEGER_OVERFLOW \
783 __pragma(warning( push )) \
784 __pragma(warning( disable : 4293 )) \
785
786 #define ALIB_WARNINGS_IGNORE_DOCS \
787 __pragma(warning( push )) \
788
789 #define ALIB_WARNINGS_RESTORE \
790 __pragma(warning( pop )) \
791
792 #define ALIB_FALLTHROUGH
793
794#else
795 #define ALIB_WARNINGS_RESTORE
796 #define ALIB_FALLTHROUGH
797#endif
798
799// #################################################################################################
800// Preprocessor tools
801// #################################################################################################
802#if defined(ALIB_DOX)
803# define ALIB_NSTRINGIFY(a)
804# define ALIB_STRINGIFY(a)
805#else
806# define ALIB_STRINGIFY_X(a) A_CHAR( #a )
807# define ALIB_STRINGIFY(a) ALIB_STRINGIFY_X(a)
808# define ALIB_NSTRINGIFY_X(a) #a
809# define ALIB_NSTRINGIFY(a) ALIB_NSTRINGIFY_X(a)
810#endif
811
812#define ALIB_CONCAT(a,b) a ## b
813
814#if defined(__clang__)
815# define ALIB_IDENTIFIER(prefix) ALIB_WARNINGS_IGNORE_RESERVED_IDENTIFIER \
816 ALIB_CONCAT(prefix, __LINE__) \
817 ALIB_WARNINGS_RESTORE
818#else
819# define ALIB_IDENTIFIER(prefix) ALIB_CONCAT(prefix, __LINE__)
820#endif
821
822#define ALIB_EMPTY
823
824
825#define ALIB_COMMA ,
826#if ALIB_DEBUG
827# define ALIB_COMMA_DBG ,
828#else
829# define ALIB_COMMA_DBG
830#endif
831
832
833// Macros for passing source code information
834#if defined( __GNUC__ )
835# define ALIB_CALLER __FILE__, __LINE__, __func__
836 //#define ALIB_CALLER __FILE__, __LINE__, __PRETTY_FUNCTION__
837#elif defined ( _MSC_VER )
838# define ALIB_CALLER __FILE__, __LINE__, __FUNCTION__
839 //#define ALIB_CALLER __FILE__, __LINE__, __FUNCSIG__
840#else
841# pragma message ("Unknown Platform in file: " __FILE__ )
842#endif
843
844#if ALIB_DEBUG
845 #define ALIB_CALLER_PRUNED ALIB_CALLER
846 #define ALIB_CALLER_NULLED ALIB_CALLER
847#else
848 #define ALIB_CALLER_PRUNED
849 #define ALIB_CALLER_NULLED nullptr, 0, nullptr
850#endif
851
852
853// Macros for doing "nicer" static_assert messages
854#define ALIB_STATIC_ASSERT( CondVariable, Cond, Message ) \
855{ constexpr bool CondVariable= Cond; \
856 static_assert( CondVariable, Message ); } \
857
858#define ALIB_STATIC_DENY( CondVariable, Cond, Message ) \
859{ constexpr bool CondVariable= !(Cond); \
860 static_assert( CondVariable, Message ); } \
861
862/** ************************************************************************************************
863 * Used with macro \ref ALIB_ASSERT_GLOBAL_NAMESPACE for testing.
864 **************************************************************************************************/
865struct ALibTestGlobalNamespace;
866#define ALIB_ASSERT_GLOBAL_NAMESPACE \
867struct ALibTestGlobalNamespace; \
868static_assert(std::is_same<ALibTestGlobalNamespace, ::ALibTestGlobalNamespace>::value, \
869 "This is not the global namespace!");
870
871// #################################################################################################
872// Copies of command line arguments of the process
873// #################################################################################################
874namespace alib {
875 /** The number of command line arguments. Defaults to \c 0.
876 * \note An application is responsible for setting this global variable in its <c>main()</c>
877 * function, in case the value is needed somewhere. */
878 ALIB_API extern int ArgC;
879
880 /** List of command line arguments if given as single byte character strings.
881 * \note An application is responsible for setting this global variable in its <c>main()</c>
882 * function, in case the value is needed somewhere. */
883 ALIB_API extern const char** ArgVN;
884
885 /** List of command line arguments if given as multi-byte character strings.
886 * \note An application is responsible for setting this global variable in its <c>main()</c>
887 * function, in case the value is needed somewhere. */
888 ALIB_API extern const wchar_t** ArgVW;
889}
890
891// #################################################################################################
892// Debug Messages and Assertions
893// #################################################################################################
894#if ALIB_DEBUG
895# if !defined (_ASSERT_H) && !defined(assert)
896# include <assert.h>
897# endif
898
899namespace alib::lang {
900
901/**
902 * Some \alib modules do not (must not) rely on \alib{lang;Report} /
903 * \alib{lang;ReportWriter} mechanics. Therefore, this simple method is
904 * used for error handling in those portions of \alib that are exposed in such modules.<br>
905 * This method first checks if static function pointer \alib{lang::DBG_SIMPLE_ALIB_MSG_PLUGIN} is set
906 * and if yes, passes the parameters to this method and exits.
907 * If module \alib_basecamp is included in the \alibdist, method \alib{lang::basecamp;BaseCamp::bootstrap}
908 * sets this plug-in function to a custom one which passes the message(s) to a proper
909 * \alib{lang;Report;ALib Report}.
910 *
911 * Otherwise the method just writes to the standard output stream and then, if \p{type} equals
912 * \c 0, invokes <c>assert(0)</c>.
913 *
914 * @param file The source file of the message invocation.
915 * @param line The line number within \p{file}.
916 * @param method The method invoking this function.
917 * @param type The type of the message. The default implementation does not use this, other
918 * than invoking <c>assert(0)</c> in the case this parameter equals \c 0.
919 * @param topic The topic of the message.
920 * @param msg1 The first message string.
921 * @param msg2 Optional 2nd message string.
922 * @param msg3 Optional 3rd message string.
923 * @param msg4 Optional 4th message string.
924 * @param msg5 Optional 5th message string.
925 *
926 */
928extern void DbgSimpleALibMsg( const char* file, int line, const char* method,
929 int type,
930 const char* topic,
931 const char* msg1= nullptr,
932 const char* msg2= nullptr,
933 const char* msg3= nullptr,
934 const char* msg4= nullptr,
935 const char* msg5= nullptr );
936
937/**
938 * Overloaded version of
939 * \ref DbgSimpleALibMsg(const char*,int,const char*,int,const char*,const char*,const char*,const char*,const char*,const char*) "DbgSimpleALibMsg"
940 * which accepts one integral value and writes \p{msg} and \p{intValue} in sequence.
941 *
942 * @param file The source file of the message invocation.
943 * @param line The line number within \p{file}.
944 * @param method The method invoking this function.
945 * @param type The type of the message. The default implementation does not use this, other
946 * than invoking <c>assert(0)</c> in the case this parameter equals \c 0.
947 * @param topic The topic of the report.
948 * @param msg The message string.
949 * @param intValue An integer parameter (optional due to overload).
950 *
951 */
953extern void DbgSimpleALibMsg( const char* file, int line, const char* method,
954 int type,
955 const char* topic,
956 const char* msg,
957 const int intValue );
958
959/**
960 * This function pointer defaults to \c nullptr and may be set to replace function
961 * #DbgSimpleALibMsg.
962 * With the use of \alib_basecamp, the module's bootstrap code (precisely method
963 * \alib{lang::basecamp;BaseCamp::bootstrap}) sets this pointer to a small method which creates an
964 * \alib{lang;Report} on the default \alib{lang;ReportWriter}.
965 *
966 * - \p{file}: Information about the scope of invocation.
967 * - \p{line}: Information about the scope of invocation.
968 * - \p{method}: Information about the scope of invocation.
969 * - \p{type}: The type of the message. As a convention, 0 is severe error, others are warning levels.
970 * - \p{qtyMsgs}: The number of messages passed.
971 * - \p{msgs}: The message strings.
972 */
973extern void (*DBG_SIMPLE_ALIB_MSG_PLUGIN)( const char* file, int line, const char* method,
974 int type , const char* topic,
975 int qtyMsgs, const char** msgs );
976
977
978} // namespace [alib::lang]
979
980#define ALIB_ERROR(...) { alib::lang::DbgSimpleALibMsg( ALIB_CALLER_PRUNED, 0, __VA_ARGS__); }
981#define ALIB_WARNING(...) { alib::lang::DbgSimpleALibMsg( ALIB_CALLER_PRUNED, 1, __VA_ARGS__); }
982#define ALIB_MESSAGE(...) { alib::lang::DbgSimpleALibMsg( ALIB_CALLER_PRUNED, 2, __VA_ARGS__); }
983#define ALIB_ASSERT(cond) { if(!(cond)) ALIB_ERROR( "Assertion Failed" ); }
984#define ALIB_ASSERT_ERROR(cond, ...) { if(!(cond)) ALIB_ERROR( __VA_ARGS__ ); }
985#define ALIB_ASSERT_WARNING(cond, ...) { if(!(cond)) ALIB_WARNING( __VA_ARGS__ ); }
986#define ALIB_ASSERT_MESSAGE(cond, ...) { if(!(cond)) ALIB_MESSAGE( __VA_ARGS__ ); }
987
988#else // ALIB_DEBUG
989 #define ALIB_ERROR(...) {}
990 #define ALIB_WARNING(...) {}
991 #define ALIB_MESSAGE(...) {}
992 #define ALIB_ASSERT(cond) {}
993 #define ALIB_ASSERT_ERROR(cond, ...) {}
994 #define ALIB_ASSERT_WARNING(cond, ...) {}
995 #define ALIB_ASSERT_MESSAGE(cond, ...) {}
996#endif
997
998#if ALIB_DEBUG
999 #define ALIB_ASSERT_RESULT_EQUALS( func, value ) { auto result= func; assert(result == value); ((void) result); }
1000 #define ALIB_ASSERT_RESULT_NOT_EQUALS( func, value ) { auto result= func; assert(result != value); ((void) result); }
1001 #define ALIB_ASSERT_RESULT_GREATER_THAN(func, value ) { auto result= func; assert(result > value); ((void) result); }
1002 #define ALIB_ASSERT_RESULT_LESS_THAN( func, value ) { auto result= func; assert(result < value); ((void) result); }
1003#else
1004 #define ALIB_ASSERT_RESULT_EQUALS( func, value ) { func; }
1005 #define ALIB_ASSERT_RESULT_NOT_EQUALS( func, value ) { func; }
1006 #define ALIB_ASSERT_RESULT_GREATER_THAN(func, value ) { func; }
1007 #define ALIB_ASSERT_RESULT_LESS_THAN( func, value ) { func; }
1008#endif
1009
1010// #################################################################################################
1011// Other ALib Features
1012// #################################################################################################
1013// Avoid analyzer (valgrind) warnings
1014#if !defined(ALIB_AVOID_ANALYZER_WARNINGS )
1015# define ALIB_AVOID_ANALYZER_WARNINGS 1
1016#endif
1017
1018// 3rd party libraries included in the build
1019#if !defined(ALIB_EXT_LIB_THREADS_AVAILABLE)
1020# define ALIB_EXT_LIB_THREADS_AVAILABLE 0
1021#endif
1022#if !defined(ALIB_FEAT_BOOST_REGEX)
1023# define ALIB_FEAT_BOOST_REGEX 0
1024#endif
1025
1026
1027// If module Threads is not available we have to define the locking macros. This allows
1028// to reduce the effort of testing for thread availability of those modules which are
1029// tolerant to work in thread-unsafe mode.
1030// On the same token, this allows a debug-check to assert that no two threads use the library.
1031#if ALIB_DEBUG && !ALIB_THREADS && ALIB_EXT_LIB_THREADS_AVAILABLE
1032 namespace alib { ALIB_API void DbgCheckSingleThreaded(); }
1033#else
1034 namespace alib { inline void DbgCheckSingleThreaded() {} } // optimized out
1035#endif // !ALIB_THREADS
1036
1037#if !ALIB_THREADS
1038# if ALIB_DEBUG
1039# define ALIB_LOCK { alib::DbgCheckSingleThreaded(); }
1040# define ALIB_LOCK_WITH(VOID) { alib::DbgCheckSingleThreaded(); }
1041# else
1042# define ALIB_LOCK { }
1043# define ALIB_LOCK_WITH(VOID) { }
1044# endif
1045#endif // !ALIB_THREADS
1046
1047
1048// #################################################################################################
1049// Bootstrapping & Shutdown
1050// #################################################################################################
1051
1052// #################################################################################################
1053// Compilation flags
1054// Create a bitset from the ALib compilation features.
1055// For this, we ensure that the individual headers tested are included
1056// #################################################################################################
1057
1058namespace alib {
1059 /** This is a simple copyable set of bits comprising the compilation flags.
1060 * @see Used with methods \alib{Bootstrap} which calls \alib{AssertALibVersionAndFlags}. */
1062 {
1063 unsigned char bits[4]; ///< The Flags.
1064 };
1065}
1066
1067#if !defined(ALIB_DOX)
1068# define ALIB_COMPILATION_FLAGS \
1069 (1<<0) * ALIB_DEBUG \
1070 + (1<<1) * ALIB_MONOMEM \
1071 + (1<<2) * ALIB_SINGLETONS \
1072 + (1<<3) * ALIB_CHARACTERS \
1073 + (1<<4) * ALIB_ENUMS \
1074 + (1<<5) * ALIB_TIME \
1075 + (1<<6) * ALIB_BOXING \
1076 + (1<<7) * ALIB_STRINGS \
1077 , \
1078 + (1<<0) * ALIB_BITBUFFER \
1079 + (1<<1) * ALIB_THREADS \
1080 + (1<<2) * ALIB_CAMP \
1081 + (1<<3) * ALIB_ALOX \
1082 + (1<<4) * ALIB_CLI \
1083 + (1<<5) * ALIB_CONFIGURATION \
1084 + (1<<6) * ALIB_EXPRESSIONS \
1085 + (1<<7) * ALIB_FILES \
1086, \
1087 + (1<<0) * ALIB_FEAT_SINGLETON_MAPPED \
1088 + (1<<1) * ALIB_CHARACTERS_WIDE \
1089 + (1<<2) * (ALIB_CHARACTERS_SIZEOF_WCHAR == 4 ? 1 : 0) \
1090 + (1<<3) * ALIB_FEAT_BOXING_BIJECTIVE_INTEGRALS \
1091 + (1<<4) * ALIB_FEAT_BOXING_BIJECTIVE_CHARACTERS \
1092 + (1<<5) * ALIB_FEAT_BOXING_BIJECTIVE_FLOATS \
1093 + (1<<6) * ALIB_DEBUG_BOXING \
1094 + (1<<7) * ALIB_DEBUG_STRINGS \
1095 , \
1096 + (1<<0) * ALIB_DEBUG_MONOMEM \
1097 + (1<<1) * ALIB_DEBUG_RESOURCES \
1098 + (1<<2) * ALOX_DBG_LOG \
1099 + (1<<3) * ALOX_DBG_LOG_CI \
1100 + (1<<4) * ALOX_REL_LOG \
1101 + (1<<5) * ALOX_REL_LOG_CI
1102#endif //ALIB_DOX
1103
1104
1105namespace alib {
1106
1107/** State of initialization of the \alibmods that do not dispose over a \alib{lang::Camp}.
1108 * instance. */
1109extern bool NonCampModulesInitialized;
1110
1111/**
1112 * Performs standard bootstrapping of \alib. All details are explained
1113 * in chapter \ref alib_manual_bootstrapping of the \ref alib_manual.
1114 *
1115 * \note In addition, function \ref alib::AssertALibVersionAndFlags is invoked.
1116 * For this, the parameters of this function must not be given, but left to their
1117 * default values, which are read from corresponding preprocessor symbols.<br>
1118 * For more information on this topic, see chapter
1119 * \ref alib_manual_bootstrapping_assertcomp of the \ref alib_manual.
1120 *
1121 * @param alibVersion The \alib version required.
1122 * Defaults to \ref ALIB_VERSION and \b must not be passed.
1123 * @param alibRevision The \alib sub-version required.
1124 * Defaults to \ref ALIB_REVISION and \b must not be passed.
1125 * @param compilationFlags The flags as defined in invoking compilation unit.
1126 * Defaults to
1127 * \doxlinkproblem{group__GrpALibPreproMacros.html;gaac71b6511690f5af0abf5213b0434111;ALIB_COMPILATION_FLAGS;ALIB_COMPILATION_FLAGS}
1128 * and \b must not be passed.
1129 */
1130ALIB_API void Bootstrap(int alibVersion = ALIB_VERSION,
1131 int alibRevision = ALIB_REVISION,
1132 TCompilationFlags compilationFlags = TCompilationFlags{ALIB_COMPILATION_FLAGS});
1133
1134/**
1135 * Terminates \alib. All details are explained
1136 * in chapter \ref alib_manual_bootstrapping of the \ref alib_manual.
1137 */
1138ALIB_API void Shutdown();
1139
1140
1141/**
1142 * This is a struct composing an entry in #CompilationFlagMeanings.
1143 */
1145{
1146 int Flag; ///< The bit number in the bitset.
1147 const char* Name; ///< The human readable meaning of the bit.
1148};
1149
1150/**
1151 * This is for the creation of output on information about the bits found in
1152 * field #CompilationFlags.
1153 * Declared public to allow exposure, e.g. in verbose logging.
1154 * \see Method #AssertALibVersionAndFlags for more information.
1155 */
1156extern ALIB_API
1158
1159
1160/**
1161 * The module version. Standard \alib versioning scheme is YYMM (as integer number)
1162 * of the module release date.
1163 * Besides this version number, field #Revision indicates if this is a revised version
1164 * of a former release.
1165 */
1166extern ALIB_API
1167int Version;
1168
1169/**
1170 * The revision number of this release. Usually a module is initially released as
1171 * revision \e 0. Pure bug-fix releases that do not change the interface of \alib
1172 * are holding the same #Version but an increased number in this field.
1173 */
1174extern ALIB_API
1175unsigned char Revision;
1176
1177/**
1178 * These flags are used internally to detect incompatibilities when linking \alib to binaries that
1179 * use different compilation flags. Declared public to allow exposure, e.g. in verbose logging.
1180 * \see Function #AssertALibVersionAndFlags, which is invoked by overloaded functions
1181 * #Bootstrap.
1182 */
1183extern ALIB_API
1185
1186
1187
1188/** ****************************************************************************************
1189 * Compares a given set of compilation flags with the ones set in the \alib library.
1190 * If a mismatch is found, the configuration mismatch is written to <c>std::cerr</c>
1191 * and <c>exit(255)</c> is performed.
1192 *
1193 * This function called in all variants of function \ref alib::Bootstrap.
1194 * If a using application wants to act different on such a mismatch, an own check of
1195 * fields \ref alib::Version, \ref alib::Revision and \ref alib::CompilationFlags against
1196 * preprocessor symbols \ref ALIB_VERSION, \ref ALIB_REVISION and
1197 * \doxlinkproblem{group__GrpALibPreproMacros.html;gaac71b6511690f5af0abf5213b0434111;ALIB_COMPILATION_FLAGS;ALIB_COMPILATION_FLAGS}
1198 * has to be performed \e prior to calling \b Bootstrap.
1199 *
1200 * \attention A mismatch in \alib library version and compilation flags, may lead to very
1201 * dubious misbehavior which is almost impossible to debug. This is true for any
1202 * C/C++ software/library mismatch.
1203 *
1204 * @param alibVersion The \alib version required.
1205 * Defaults to \ref ALIB_VERSION and \b must not be passed when invoking
1206 * this function.
1207 * @param alibRevision The \alib sub-version required.
1208 * Defaults to \ref ALIB_REVISION and \b must not be passed when invoking
1209 * this function.
1210 * @param compilationFlags The flags as defined in invoking compilation unit.
1211 * Defaults to \c ALIB_COMPILATION_FLAGS and \b must not be given.
1212 *
1213 ******************************************************************************************/
1215void AssertALibVersionAndFlags( int alibVersion = ALIB_VERSION,
1216 int alibRevision = ALIB_REVISION,
1217 TCompilationFlags compilationFlags= TCompilationFlags{ALIB_COMPILATION_FLAGS} );
1218
1219
1220} // namespace [alib]
1221
1222
1223#endif // HPP_ALIB
#define ALIB_REVISION
Definition alib.hpp:24
#define ALIB_VERSION
Definition alib.hpp:23
#define ALIB_SIZEOF_WCHAR_T
Definition alib.hpp:337
#define ALIB_API
Definition alib.hpp:538
void(* DBG_SIMPLE_ALIB_MSG_PLUGIN)(const char *file, int line, const char *method, int type, const char *topic, int qtyMsgs, const char **msgs)
Definition alib.cpp:268
ALIB_API void DbgSimpleALibMsg(const char *file, int line, const char *method, int type, const char *topic, const char *msg1=nullptr, const char *msg2=nullptr, const char *msg3=nullptr, const char *msg4=nullptr, const char *msg5=nullptr)
Definition alib.cpp:57
ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE void AssertALibVersionAndFlags(int alibVersion, int alibRevision, TCompilationFlags compilationFlags)
Definition alib.cpp:140
const char ** ArgVN
Definition alib.cpp:60
unsigned char Revision
Definition alib.cpp:66
int ArgC
Definition alib.cpp:59
void DbgCheckSingleThreaded()
Definition alib.cpp:226
bool NonCampModulesInitialized
Definition alib.cpp:63
ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE TCompilationFlags CompilationFlags
Definition alib.cpp:68
const wchar_t ** ArgVW
Definition alib.cpp:61
int Version
Definition alib.cpp:65
ALIB_WARNINGS_RESTORE void Bootstrap(int alibVersion, int alibRevision, TCompilationFlags compilationFlags)
Definition alib.cpp:72
CompilationFlagMeaningsEntry CompilationFlagMeanings[30]
Definition alib.cpp:105
void Shutdown()
Definition alib.cpp:94
const char * Name
The human readable meaning of the bit.
Definition alib.hpp:1147
int Flag
The bit number in the bitset.
Definition alib.hpp:1146
unsigned char bits[4]
The Flags.
Definition alib.hpp:1063