Elements
5.10
A C++ base framework for the Euclid Software.
ElementsExamples
src
program
BackTraceExample.cpp
Go to the documentation of this file.
1
21
#include <map>
// for map
22
#include <string>
// for string
23
#include <boost/program_options.hpp>
// for program options from configuration file of command line arguments
24
#include <stdexcept>
// for standard exceptions
25
26
#include "
ElementsExamples/crashingFunction.h
"
// for crashingFunction
27
28
#include "
ElementsKernel/ProgramHeaders.h
"
// for including all Program/related headers
29
#include "
ElementsKernel/Unused.h
"
// for ELEMENTS_UNUSED
30
31
using
std::map
;
32
using
std::string
;
33
using
boost::program_options::variable_value;
34
35
namespace
Elements
{
36
namespace
Examples {
37
38
auto
log
=
Logging::getLogger
(
"BackTraceExample"
);
39
40
void
secondLevelFunction
() {
41
log
.info() <<
"Entering Second Level Function"
;
42
crashingFunction
();
43
}
44
45
void
firstLevelFunction
() {
46
log
.info() <<
"Entering First Level Function"
;
47
secondLevelFunction
();
48
}
49
50
class
BackTraceExample
:
public
Program
{
51
52
public
:
53
54
ExitCode
mainMethod
(
ELEMENTS_UNUSED
map<string, variable_value>
& args)
override
{
55
56
firstLevelFunction
();
57
58
log
.info() <<
"done with test program! "
;
59
60
return
ExitCode::OK
;
61
62
}
63
64
};
65
66
}
// namespace Examples
67
}
// namespace Elements
68
69
74
MAIN_FOR
(
Elements::Examples::BackTraceExample
)
Elements::ExitCode::OK
@ OK
Everything is OK.
std::string
STL class.
Elements::Examples::crashingFunction
ELEMENTS_API void crashingFunction()
Definition:
crashingFunction.cpp:31
Elements::Examples::BackTraceExample
Definition:
BackTraceExample.cpp:50
Elements::ExitCode
ExitCode
Strongly typed exit numbers.
Definition:
Exit.h:98
crashingFunction.h
Elements::Examples::BackTraceExample::mainMethod
ExitCode mainMethod(ELEMENTS_UNUSED map< string, variable_value > &args) override
Definition:
BackTraceExample.cpp:54
std::map
STL class.
ProgramHeaders.h
Elements::Examples::log
auto log
Definition:
BackTraceExample.cpp:38
Elements::Logging::getLogger
static Logging getLogger(const std::string &name="")
Definition:
Logging.cpp:63
Elements::Program
Abstract class for all Elements programs.
Definition:
Program.h:51
MAIN_FOR
#define MAIN_FOR(ELEMENTS_PROGRAM_NAME)
Definition:
Main.h:117
Elements::Examples::firstLevelFunction
void firstLevelFunction()
Definition:
BackTraceExample.cpp:45
Unused.h
Macro to silence unused variables warnings from the compiler.
Elements::Examples::secondLevelFunction
void secondLevelFunction()
Definition:
BackTraceExample.cpp:40
ELEMENTS_UNUSED
#define ELEMENTS_UNUSED
Definition:
Unused.h:39
Elements
Definition:
ClassExample.h:38
Generated by
1.8.18