/* * OperationsLauncher.cc * * Created on: Feb 2017 * */ #include #include // Common include modules #include "OutputFormatTime.hh" #include "TimeTableCatalogFactory.hh" #include "Application.hh" #include /** * Logger */ log4cxx::LoggerPtr _logger( log4cxx::Logger::getLogger("AMDA-Kernel.TTConversion")); /** * Shows help on std::cout. */ void help() { std::cout << "Use : ttConversion InputFileName InputFileFormat OutputDir OutputFileName OutputFileFormat [OutputTimeFormat]" << std::endl; std::cout << " OutputTimeFormat with values: ISO (default), DD, DOUBLE, SPACES or MS" << std::endl; } /** * Main for ttConversion binary. */ int ttConversion(int argc, char *argv[], AMDA::helpers::Properties& /*properties*/) { // executable options if (argc < 6 || (argc > 1 && strcmp(argv[1], "--help") == 0)) { help(); return -1; } // Default value for time format (Option) AMDA::OutputFormatTime timeFormat = AMDA::OutputFormatTime::FORMAT_OUTPUT_TIME_ISO; if (argc >= 7) { // Map time enum between php and C++ // See Request/TTRequestImpl/TTRequestDataClass.php and AMDA_Kernel/src/Common/OutputFormatTime.hh const string pTimeFormat = argv[6]; if (pTimeFormat.compare("DOY TIME") == 0) timeFormat = AMDA::OutputFormatTime::FORMAT_OUTPUT_TIME_DD; else if (pTimeFormat.compare("DOUBLE") == 0) timeFormat = AMDA::OutputFormatTime::FORMAT_OUTPUT_TIME_DOUBLE; else if (pTimeFormat.compare("SPACES") == 0) timeFormat = AMDA::OutputFormatTime::FORMAT_OUTPUT_TIME_SPACES; else if (pTimeFormat.compare("MS") == 0) timeFormat = AMDA::OutputFormatTime::FORMAT_OUTPUT_TIME_MS; } const string ttFormat = argv[5]; if(ttFormat.compare("SPACE") ==0) timeFormat= AMDA::OutputFormatTime::FORMAT_OUTPUT_TIME_ISO_Z; TimeTableCatalog::TimeTable ttMgr(timeFormat); ttMgr.convert(std::string(argv[1]), std::string(argv[2]), std::string(argv[3]), std::string(argv[4]), std::string(argv[5])); return 0; } /** * Main function */ int main(int argc, char *argv[]) { AMDA::Common::Application lMain; return lMain.main(argc, argv, ttConversion, true); //Skip plugin load }