Elements  5.10
A C++ base framework for the Euclid Software.
AnotherSimpleProgramExample.cpp
Go to the documentation of this file.
1 
22 #include <iostream>
23 
25 #include "ElementsKernel/Exit.h" // For ExitCode
26 #include "ElementsKernel/Exception.h" // For Exception
27 
28 namespace Elements {
29 namespace Examples {
30 
31 
41 
42 public:
43 
44  void defineOptions() override {
45 
46  }
47 
59  ExitCode main() override {
60 
61  std::cout << "Program name: " << getProgramName() << std::endl;
62  std::cout << "Program path: " << getProgramPath() << std::endl;
63 
64  throw Exception("This is an example exception.");
65 
66  return ExitCode::OK;
67 
68  }
69 
70 };
71 
72 } // namespace Examples
73 } // namespace Elements
74 
Elements::ExitCode::OK
@ OK
Everything is OK.
Elements::SimpleProgram::getProgramName
ELEMENTS_API const boost::filesystem::path & getProgramName() const
Definition: SimpleProgram.cpp:75
Elements::Examples::AnotherSimpleProgramExample
Example of an Elements program.
Definition: AnotherSimpleProgramExample.cpp:40
SimpleProgram.h
Elements::Examples::AnotherSimpleProgramExample::main
ExitCode main() override
The "main" method.
Definition: AnotherSimpleProgramExample.cpp:59
Exit.h
define a list of standard exit codes for executables
Elements::ExitCode
ExitCode
Strongly typed exit numbers.
Definition: Exit.h:98
Elements::Examples::AnotherSimpleProgramExample::defineOptions
void defineOptions() override
Definition: AnotherSimpleProgramExample.cpp:44
Exception.h
defines the base Elements exception class
std::cout
Elements::Exception
Elements base exception class.
Definition: Exception.h:46
Elements::SimpleProgram
Definition: SimpleProgram.h:41
std::endl
T endl(T... args)
Elements::SimpleProgram::getProgramPath
ELEMENTS_API const boost::filesystem::path & getProgramPath() const
Definition: SimpleProgram.cpp:71
MAIN
#define MAIN(ELEMENTS_PROGRAM)
Definition: SimpleProgram.h:87
Elements
Definition: ClassExample.h:38