Elements
6.1.2
A C++ base framework for the Euclid Software.
Loading...
Searching...
No Matches
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
ELEMENTS_API
ExitCode
run(
int
argc,
char
** argv)
noexcept
;
44
ELEMENTS_API
const
Path::Item& getProgramPath()
const
;
45
ELEMENTS_API
const
Path::Item& getProgramName()
const
;
46
47
protected
:
48
SimpleProgram
() =
default
;
49
virtual
~SimpleProgram
();
50
51
virtual
ExitCode
main
() = 0;
52
virtual
void
defineOptions
() = 0;
53
54
private
:
55
void
setup(
int
argc,
char
** argv);
56
57
private
:
58
Path::Item
m_program_name
;
59
Path::Item
m_program_path
;
60
};
61
66
}
// namespace Elements
67
79
#define MAIN(ELEMENTS_PROGRAM) \
80
ELEMENTS_API int main(int argc, char* argv[]) { \
81
auto program = ELEMENTS_PROGRAM(); \
82
Elements::ExitCode exit_code = program.run(argc, argv); \
83
return static_cast<Elements::ExitCodeType>(exit_code); \
84
}
85
86
#endif
// ELEMENTSKERNEL_ELEMENTSKERNEL_SIMPLEPROGRAM_H_
87
Export.h
defines the macros to be used for explicit export of the symbols
Main.h
Definition of the top macro to create an Elements program.
Path.h
provide functions to retrieve resources pointed by environment variables
Elements::SimpleProgram
Definition:
SimpleProgram.h:40
Elements::SimpleProgram::SimpleProgram
SimpleProgram()=default
Elements::SimpleProgram::m_program_path
Path::Item m_program_path
Definition:
SimpleProgram.h:59
Elements::SimpleProgram::main
virtual ExitCode main()=0
Elements::SimpleProgram::defineOptions
virtual void defineOptions()=0
Elements::SimpleProgram::m_program_name
Path::Item m_program_name
Definition:
SimpleProgram.h:58
Elements::ExitCode
ExitCode
Strongly typed exit numbers.
Definition:
Exit.h:97
ELEMENTS_API
#define ELEMENTS_API
Dummy definitions for the backward compatibility mode.
Definition:
Export.h:74
Elements
Definition:
callBackExample.h:35
Generated by
1.9.6