Elements
5.10
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 <boost/filesystem/path.hpp>
32
33
#include "
ElementsKernel/Export.h
"
34
#include "
ElementsKernel/Main.h
"
35
36
namespace
Elements
{
37
38
// Forward declaration. We don't need the definition right now.
39
enum class
ExitCode
;
40
41
class
ELEMENTS_API
SimpleProgram
{
42
43
public
:
44
45
ELEMENTS_API
ExitCode
run(
int
argc,
char
** argv) noexcept;
46
ELEMENTS_API
const
boost::filesystem::path
& getProgramPath()
const
;
47
ELEMENTS_API
const
boost::filesystem::path
& getProgramName()
const
;
48
49
50
protected
:
51
52
SimpleProgram
() =
default
;
53
virtual
~
SimpleProgram
();
54
55
virtual
ExitCode
main
() = 0;
56
virtual
void
defineOptions() = 0;
57
58
private
:
59
60
void
setup(
int
argc,
char
** argv);
61
62
private
:
63
64
boost::filesystem::path
m_program_name
;
65
boost::filesystem::path
m_program_path
;
66
67
};
68
74
}
// namespace Elements
75
87
#define MAIN(ELEMENTS_PROGRAM) \
88
ELEMENTS_API int main(int argc, char* argv[]) \
89
{ \
90
auto program = ELEMENTS_PROGRAM();\
91
Elements::ExitCode exit_code = program.run(argc, argv); \
92
return static_cast<Elements::ExitCodeType>(exit_code); \
93
}
94
95
#endif // ELEMENTSKERNEL_ELEMENTSKERNEL_SIMPLEPROGRAM_H_
96
Elements::ExitCode
ExitCode
Strongly typed exit numbers.
Definition:
Exit.h:98
Elements::SimpleProgram::m_program_name
boost::filesystem::path m_program_name
Definition:
SimpleProgram.h:64
Elements::SimpleProgram
Definition:
SimpleProgram.h:41
Elements
Definition:
ClassExample.h:38
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.
main
int main(int argc, char *argv[])
Definition:
cutout.c:31
ElementsServices::DataSync::path
boost::filesystem::path path
Definition:
DataSyncUtils.h:38
ELEMENTS_API
#define ELEMENTS_API
Dummy definitions for the backward compatibility mode.
Definition:
Export.h:74
Elements::SimpleProgram::m_program_path
boost::filesystem::path m_program_path
Definition:
SimpleProgram.h:65
Generated by
1.8.14