Elements
5.10
A C++ base framework for the Euclid Software.
ElementsExamples
src
program
SimpleProgramExample.cpp
Go to the documentation of this file.
1
22
#include <iostream>
// for cout, endl
23
#include <map>
// for map
24
#include <string>
// for string
25
26
#include "
ElementsKernel/Sleep.h
"
// for nanoSleep
27
#include "
ElementsKernel/ProgramHeaders.h
"
28
#include "
ElementsKernel/Unused.h
"
29
30
namespace
po = boost::program_options;
31
32
using
std::map
;
33
using
std::string
;
34
35
using
boost::program_options::variable_value;
36
37
namespace
Elements
{
38
namespace
Examples {
39
40
49
class
SimpleProgramExample
:
public
Program
{
50
51
public
:
52
64
ExitCode
mainMethod
(
ELEMENTS_UNUSED
map<string, variable_value>
& args)
override
{
65
66
// Get logger and log the entry into the mainMethod
67
auto
log
=
Logging::getLogger
();
68
69
log
.info(
"This Works"
);
70
71
Elements::nanoSleep
(4);
72
73
std::cout
<<
"This Works too!"
<<
std::endl
;
74
75
return
ExitCode::OK
;
76
77
}
78
79
};
80
81
}
// namespace Examples
82
}
// namespace Elements
83
84
MAIN_FOR
(
Elements::Examples::SimpleProgramExample
)
Sleep.h
Elements::ExitCode::OK
@ OK
Everything is OK.
std::string
STL class.
Elements::ExitCode
ExitCode
Strongly typed exit numbers.
Definition:
Exit.h:98
std::cout
Elements::nanoSleep
ELEMENTS_API void nanoSleep(std::int64_t nsec)
Small variation on the sleep function for nanoseconds sleep.
Definition:
Sleep.cpp:40
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::Examples::SimpleProgramExample
Example of an Elements program.
Definition:
SimpleProgramExample.cpp:49
std::endl
T endl(T... args)
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::SimpleProgramExample::mainMethod
ExitCode mainMethod(ELEMENTS_UNUSED map< string, variable_value > &args) override
The "main" method.
Definition:
SimpleProgramExample.cpp:64
Unused.h
Macro to silence unused variables warnings from the compiler.
ELEMENTS_UNUSED
#define ELEMENTS_UNUSED
Definition:
Unused.h:39
Elements
Definition:
ClassExample.h:38
Generated by
1.8.18