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

This is an example of how to use the getAuxiliaryPath function.

#include <map> // for map
#include <string> // for string
#include <boost/program_options.hpp> // for program options from configuration file of command line arguments
#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;
using boost::program_options::variable_value;
namespace Elements {
namespace Examples {
class CCfitsExample: public Program {
public:
ExitCode mainMethod(ELEMENTS_UNUSED map<string, variable_value>& args) override {
auto log = Logging::getLogger("CCfitsExample");
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 = getAuxiliaryPath("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.
Elements::Examples::CCfitsExample::mainMethod
ExitCode mainMethod(ELEMENTS_UNUSED map< string, variable_value > &args) override
Definition: CCfitsExample.cpp:42
std::string
STL class.
Elements::getAuxiliaryPath
ELEMENTS_API boost::filesystem::path getAuxiliaryPath(const T &file_name, bool raise_exception=true)
Elements::ExitCode
ExitCode
Strongly typed exit numbers.
Definition: Exit.h:98
std::map
STL class.
ProgramHeaders.h
Elements::Examples::log
auto log
Definition: BackTraceExample.cpp:38
Elements::Logging::getLogger
static Logging getLogger(const std::string &name="")
Definition: Logging.cpp:63
Elements::Examples::CCfitsExample
Definition: CCfitsExample.cpp:38
MAIN_FOR
#define MAIN_FOR(ELEMENTS_PROGRAM_NAME)
Definition: Main.h:117
Auxiliary.h
provide functions to retrieve auxiliary files
Unused.h
Macro to silence unused variables warnings from the compiler.
ELEMENTS_UNUSED
#define ELEMENTS_UNUSED
Definition: Unused.h:39
Elements
Definition: ClassExample.h:38