Elements  6.2
A C++ base framework for the Euclid Software.
ElementsExamples/src/program/CCfits.cpp

This is an example of how to use the Auxiliary::getPath function.

#include <map> // for map
#include <string> // for string
#include <CCfits/CCfits> // header file to test
#include "ElementsKernel/ProgramHeaders.h" // for including all Program/related headers
#include "ElementsKernel/Unused.h" // for ELEMENTS_UNUSED
using std::map;
namespace Elements {
namespace Examples {
class CCfits : public Program {
public:
ExitCode mainMethod(ELEMENTS_UNUSED map<string, VariableValue>& args) override {
auto log = Logging::getLogger("CCfits");
string test_upper_string{"THATSTRING"};
log.info() << "This is the test upper string: " << test_upper_string;
string test_lower_string = ::CCfits::FITSUtil::lowerCase(test_upper_string);
log.info() << "This is the test lower string: " << test_lower_string;
log.info() << "done with test program! ";
auto fits_file_path = Auxiliary::getPath("ElementsExamples/phz_cat.fits");
log.info() << "Opening the file " << fits_file_path.string();
::CCfits::FITS fits_file(fits_file_path.string());
::CCfits::ExtHDU& extension = fits_file.extension(1);
log.info() << "Extension comments: " << extension.getComments();
return ExitCode::OK;
}
};
} // namespace Examples
} // namespace Elements
Elements::ExitCode::OK
@ OK
Everything is OK.
std::string
STL class.
Elements::Program::ExitCode
Elements::ExitCode ExitCode
Definition: Program.h:67
Elements::Examples::CCfits::mainMethod
ExitCode mainMethod(ELEMENTS_UNUSED map< string, VariableValue > &args) override
Definition: CCfits.cpp:39
Elements::Examples::CCfits
Definition: CCfits.cpp:36
std::map
STL class.
ProgramHeaders.h
Elements::Examples::log
auto log
Definition: BackTrace.cpp:36
Elements::Logging::getLogger
static Logging getLogger(const std::string &name="")
Definition: Logging.cpp:63
MAIN_FOR
#define MAIN_FOR(ELEMENTS_PROGRAM_NAME)
Definition: Main.h:113
Auxiliary.h
provide functions to retrieve auxiliary files
Unused.h
Macro to silence unused variables warnings from the compiler.
Elements::Kernel::Auxiliary::getPath
ELEMENTS_API Path::Item getPath(const T &file_name, bool raise_exception=true)
alias for the getAuxiliaryPath function
ELEMENTS_UNUSED
#define ELEMENTS_UNUSED
Definition: Unused.h:39
Elements
Definition: callBackExample.h:35