#include #include #include #include "JDetector/JDetector.hh" #include "JDetector/JDetectorToolkit.hh" #include "JDetector/JModuleRouter.hh" #include "JDetector/JModuleStatus.hh" #include "JLang/JVectorize.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Auxiliary program to print module status for a given module identifier. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; string detectorFile; JModuleIdentifier id; string key; int debug; try { JParser<> zap("Auxiliary program to print module status for a given module identifier." "\nInteractive mode in absence of option -M ."); zap['a'] = make_field(detectorFile, "Detector file"); zap['M'] = make_field(id, "module identifier") = JModuleIdentifier(); zap['k'] = make_field(key, "key") = "", get_keys(getModuleStatusBit); zap['d'] = make_field(debug) = 1; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } JDetector detector; try { load(detectorFile, detector); } catch(const JException& error) { FATAL(error); } const JModuleRouter router(detector); if (id != JModuleIdentifier()) { if (router.hasModule(id)) { if (key == "") print(cout, router.getModule(id).getStatus(), putModuleStatusBit); else cout << router.getModule(id).has(getModuleStatusBit(key)); } } else { while (cin >> id && id != JModuleIdentifier()) { if (router.hasModule(id)) { if (key == "") print(cout, router.getModule(id).getStatus(), putModuleStatusBit); else cout << router.getModule(id).has(getModuleStatusBit(key)); } } } }