Elements
5.12
A C++ base framework for the Euclid Software.
ElementsKernel
ElementsKernel
SimpleProgram.h
Go to the documentation of this file.
1
28
#ifndef ELEMENTSKERNEL_ELEMENTSKERNEL_SIMPLEPROGRAM_H_
29
#define ELEMENTSKERNEL_ELEMENTSKERNEL_SIMPLEPROGRAM_H_
30
31
#include "
ElementsKernel/Export.h
"
32
#include "
ElementsKernel/Main.h
"
33
#include "
ElementsKernel/Path.h
"
34
35
namespace
Elements
{
36
37
// Forward declaration. We don't need the definition right now.
38
enum class
ExitCode
;
39
40
class
ELEMENTS_API
SimpleProgram
{
41
42
public
:
43
44
ELEMENTS_API
ExitCode
run(
int
argc,
char
** argv) noexcept;
45
ELEMENTS_API
const
Path::Item
& getProgramPath()
const
;
46
ELEMENTS_API
const
Path::Item
& getProgramName()
const
;
47
48
49
protected
:
50
51
SimpleProgram
() =
default
;
52
virtual
~
SimpleProgram
();
53
54
virtual
ExitCode
main
() = 0;
55
virtual
void
defineOptions
() = 0;
56
57
private
:
58
59
void
setup(
int
argc,
char
** argv);
60
61
private
:
62
63
Path::Item
m_program_name
;
64
Path::Item
m_program_path
;
65
66
};
67
73
}
// namespace Elements
74
86
#define MAIN(ELEMENTS_PROGRAM) \
87
ELEMENTS_API int main(int argc, char* argv[]) \
88
{ \
89
auto program = ELEMENTS_PROGRAM();\
90
Elements::ExitCode exit_code = program.run(argc, argv); \
91
return static_cast<Elements::ExitCodeType>(exit_code); \
92
}
93
94
#endif // ELEMENTSKERNEL_ELEMENTSKERNEL_SIMPLEPROGRAM_H_
95
Elements::SimpleProgram::main
virtual ExitCode main()=0
Export.h
defines the macros to be used for explicit export of the symbols
Elements::SimpleProgram::SimpleProgram
SimpleProgram()=default
Path.h
provide functions to retrieve resources pointed by environment variables
Elements::Path::Item
boost::filesystem::path Item
Definition:
Path.h:61
Elements::SimpleProgram::m_program_path
Path::Item m_program_path
Definition:
SimpleProgram.h:64
Elements::ExitCode
ExitCode
Strongly typed exit numbers.
Definition:
Exit.h:98
ELEMENTS_API
#define ELEMENTS_API
Dummy definitions for the backward compatibility mode.
Definition:
Export.h:74
Elements::SimpleProgram::defineOptions
virtual void defineOptions()=0
Elements::SimpleProgram
Definition:
SimpleProgram.h:40
Elements::SimpleProgram::m_program_name
Path::Item m_program_name
Definition:
SimpleProgram.h:63
Main.h
Definition of the top macro to create an Elements program.
Elements
Definition:
Auxiliary.h:43
Generated by
1.8.20