Elements
5.10
A C++ base framework for the Euclid Software.
ElementsExamples/src/program/AnotherSimpleProgramExample.cpp
This is an example of how to use the SimpleProgram class.
#include <iostream>
#include "
ElementsKernel/SimpleProgram.h
"
#include "
ElementsKernel/Exit.h
"
// For ExitCode
#include "
ElementsKernel/Exception.h
"
// For Exception
namespace
Elements
{
namespace
Examples {
class
AnotherSimpleProgramExample:
public
SimpleProgram {
public
:
void
defineOptions
()
override
{
}
ExitCode
main
()
override
{
std::cout
<<
"Program name: "
<<
getProgramName
() <<
std::endl
;
std::cout
<<
"Program path: "
<<
getProgramPath
() <<
std::endl
;
throw
Exception(
"This is an example exception."
);
return
ExitCode::OK
;
}
};
}
// namespace Examples
}
// namespace Elements
MAIN
(
Elements::Examples::AnotherSimpleProgramExample
)
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
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
Generated by
1.8.18