ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
results.cpp
1 // #################################################################################################
2 // ALib C++ Library
3 //
4 // Copyright 2013-2023 A-Worx GmbH, Germany
5 // Published under 'Boost Software License' (a free software license, see LICENSE.txt)
6 // #################################################################################################
8 
9 #if !defined(ALIB_DOX)
10 # if !defined (HPP_ALIB_RESULTS_RESULTS)
11 # include "alib/results/results.hpp"
12 # endif
13 # if !defined (HPP_ALIB_RESULTS_ICLONEMESSAGEARGUMENT)
15 # endif
16 # if !defined (HPP_ALIB_BOXING_ENUM)
17 # include "alib/boxing/enum.hpp"
18 # endif
19 # if !defined (HPP_ALIB_FS_MODULES_DISTRIBUTION)
21 # endif
22 # if !defined (HPP_ALIB_RESOURCES_RESOURCES)
24 # endif
25 # if !defined (HPP_ALIB_ENUMS_RECORDBOOTSTRAP)
27 # endif
28 # if !defined (HPP_ALIB_RESULTS_REPORT)
29 # include "alib/results/report.hpp"
30 # endif
31 #endif // !defined(ALIB_DOX)
32 
33 namespace aworx { namespace lib {
34 
36 
37 /**
38  * This \alibmod is very small and might undergo some changes in the future development of the
39  * library.
40  *
41  * Please consult \ref alib_mod_results "ALib Module Results - Programmer's Manual"
42  * for further information.
43  */
44 namespace results {
45 
46 // #################################################################################################
47 // Replacement method for ALib Essential Reports
48 // #################################################################################################
49 #if ALIB_DEBUG
50 #if !defined(ALIB_DOX)
51 namespace {
52 #endif
54 /**
55  * This method is installed with \alib{DBG_SIMPLE_ALIB_MSG_PLUGIN} in method
56  * \alib{Module::bootstrap}.
57  *
58  * The message strings are simply passed to the default \alib{results,Report}.
59  * This way, the essential assert, error and message macros are using the \alib report system
60  * in the moment that the complete %ALib library is in place (instead of only one of the
61  * library's modules.
62  *
63  * @param file Information about the scope of invocation.
64  * @param line Information about the scope of invocation.
65  * @param method Information about the scope of invocation.
66  * @param type The type of message. See \alib{results,Message}.
67  * @param topic The topic of message.
68  * @param qtyMsgs The number of messages in \p{msgs}.
69  * @param msgs A list of strings (this is all that the essential versions of \alib reporting
70  * macros provide).
71  */
72 void debugReportPlugin(const char* file, int line, const char* method,
73  int type, const char* topic, int qtyMsgs, const nchar** msgs)
74 {
75  Message message( file,line,method, Report::Types(type), topic );
76  for (int i= 0; i< qtyMsgs; ++i )
77  message.Add( msgs[i] );
78  Report::GetDefault().DoReport( message );
79 }
81 
82 #if !defined(ALIB_DOX)
83 } // anonymous namespace
84 #endif
85 #endif // ALIB_DEBUG
86 
87 // #################################################################################################
88 // Module class Messages
89 // #################################################################################################
91 : Module( ALIB_VERSION, ALIB_REVISION, "RSLTS" )
92 {
93  ALIB_ASSERT_ERROR( this == &RESULTS, "RESULTS",
94  "Instances of class Results must not be created. Use singleton aworx::lib::RESULTS" )
95 }
96 
97 
98 void Results::bootstrap( BootstrapPhases phase, int, const char**, const wchar_t** )
99 {
100  if( phase == BootstrapPhases::PrepareResources )
101  {
103 
104  ALIB_BOXING_BOOTSTRAP_VTABLE_DBG_REGISTER( vt_alib_exception )
105  ALIB_BOXING_BOOTSTRAP_VTABLE_DBG_REGISTER( vt_alib_report_types )
106 
107 
108  #if ALIB_DEBUG
110  #endif
111 
112 
113 
114 #if !ALIB_RESOURCES_OMIT_DEFAULTS
116 
117  //##################### aworx::lib::results::Exceptions ################################
118  "E<", A_CHAR("results::") ,
119  "E" , A_CHAR("1,ErrorWritingReport,E1") ,
120 
121  "E1", A_CHAR("Error writing ALib report."),
122 
123  //##################################### Various ######################################
124  "ExcFmtExc", A_CHAR("\nAn exception occurred while formatting another (!) exception:\n" ),
125  "RepFmtExc", A_CHAR("\nAn exception occurred while formatting an ALib report (!):\n" ),
126 
127 
128  // end of BootstrapBulk()
129  nullptr );
130 #endif // !ALIB_RESOURCES_OMIT_DEFAULTS
131  }
132 
133  else if( phase == BootstrapPhases::PrepareConfig )
134  {
136  }
137 
138 }
139 
141 {
142  if( phase == ShutdownPhases::Destruct )
143  {
144  #if ALIB_DEBUG
146  #endif
147 
148  if ( Report::defaultReport != nullptr )
149  delete Report::defaultReport;
150 
153  }
154 }
155 
156 
157 }}} // namespace [aworx::lib::results]
158 
159 
160 
161 
162 
aworx::lib::results::Results::Results
Results()
Definition: results.cpp:90
iclonemessageargument.hpp
aworx::lib::Module::ShutdownPhases::Destruct
The main phase of termination that destructs everything.
aworx::lib::Module::resourcePool
resources::ResourcePool * resourcePool
Definition: module.hpp:114
aworx::lib::boxing::Boxes::Add
Boxes & Add()
Definition: boxes.inl:173
aworx::lib::ALibDistribution::CheckDistribution
ALIB_API void CheckDistribution(int alibVersion=ALIB_VERSION, uint64_t compilationFlags=ALIB_COMPILATION_FLAGS)
Definition: distribution.cpp:612
aworx::lib::results::Report::GetDefault
static Report & GetDefault()
Definition: report.hpp:145
aworx::lib::Module::ShutdownPhases
ShutdownPhases
Definition: module.hpp:88
aworx::nchar
lib::characters::nchar nchar
Type alias in namespace aworx.
Definition: characters.hpp:686
resources.hpp
aworx::lib::results::Results::shutdown
virtual void shutdown(ShutdownPhases phase) override
Definition: results.cpp:140
aworx::lib::enums::EnumRecords::Bootstrap
static void Bootstrap(TEnum element, TArgs &&... args) noexcept
aworx::lib::Module::BootstrapPhases
BootstrapPhases
Definition: module.hpp:78
recordbootstrap.hpp
report.hpp
aworx::lib::Module::BootstrapPhases::PrepareResources
aworx::lib::Module::ResourceCategory
NCString ResourceCategory
Definition: module.hpp:172
alib_precompile.hpp
aworx::lib::singletons::Singleton::singleton
static TDerivedClass * singleton
Definition: singleton.hpp:66
ALIB_REVISION
#define ALIB_REVISION
Definition: modules.hpp:21
aworx
Definition: alox/alox.hpp:40
results.hpp
aworx::ALIB
lib::ALibDistribution ALIB
Definition: distribution.cpp:125
aworx::lib::results::Message
Definition: message.hpp:43
aworx::lib::resources::ResourcePool::BootstrapBulk
virtual void BootstrapBulk(const nchar *category,...)=0
A_CHAR
#define A_CHAR(STR)
ALIB_WARNINGS_RESTORE
#define ALIB_WARNINGS_RESTORE
Definition: compilers.hpp:331
ALIB_ASSERT_ERROR
#define ALIB_ASSERT_ERROR(cond,...)
Definition: tools.hpp:185
aworx::lib::results::Report::DoReport
ALIB_API void DoReport(Message &message)
Definition: report.cpp:123
aworx::lib::results::Results::bootstrap
virtual void bootstrap(BootstrapPhases phase, int argc, const char **argv, const wchar_t **wargv) override
Definition: results.cpp:98
ALIB_BOXING_BOOTSTRAP_VTABLE_DBG_REGISTER
#define ALIB_BOXING_BOOTSTRAP_VTABLE_DBG_REGISTER(Identifier)
Definition: vtable.inl:506
aworx::lib::DBG_SIMPLE_ALIB_MSG_PLUGIN
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:106
aworx::lib::results::debugReportPlugin
ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE void debugReportPlugin(const char *file, int line, const char *method, int type, const char *topic, int qtyMsgs, const nchar **msgs)
Definition: results.cpp:72
distribution.hpp
ALIB_VERSION
#define ALIB_VERSION
Definition: modules.hpp:20
aworx::lib::Module::BootstrapPhases::PrepareConfig
enum.hpp
aworx::lib::Module
Definition: module.hpp:74
aworx::lib::results::Report::defaultReport
static ALIB_API Report * defaultReport
Definition: report.hpp:101
aworx::lib::results::Results
Definition: results.hpp:39
aworx::lib::results::Report::Types
Types
Definition: report.hpp:89
ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE
#define ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE
Definition: compilers.hpp:258
aworx::lib::RESULTS
results::Results RESULTS
Definition: results.cpp:35