#ifndef __JDETECTOR__JMODULESTATUS__ #define __JDETECTOR__JMODULESTATUS__ #include #include #include #include "km3net-dataformat/definitions/module_status.hh" #include "JLang/JType.hh" #include "JLang/JVectorize.hh" #include "Jeep/JStatus.hh" /** * \author mdejong */ namespace JDETECTOR {} namespace JPP { using namespace JDETECTOR; } namespace JDETECTOR { using JLANG::JType; using JEEP::JStatus; using JEEP::JPutStatusBit; using JEEP::JGetStatusBit; /** * Auxiliary class to map key to module status bit. */ struct JGetModuleStatusBit : public JGetStatusBit { /** * Default constructor. */ JGetModuleStatusBit() { #define MAKE_ENTRY(A) std::make_pair(#A, A) this->insert(MAKE_ENTRY(MODULE_DISABLE)); this->insert(MAKE_ENTRY(COMPASS_DISABLE)); this->insert(MAKE_ENTRY(HYDROPHONE_DISABLE)); this->insert(MAKE_ENTRY(PIEZO_DISABLE)); this->insert(MAKE_ENTRY(MODULE_OUT_OF_SYNC)); #undef MAKE_ENTRY } }; /** * Type definition to map module status bit to key. */ typedef JPutStatusBit JPutModuleStatusBit; /** * Function object to map key to module status bit. */ static const JGetModuleStatusBit getModuleStatusBit; /** * Function object to map module status bit to key. */ static const JPutModuleStatusBit putModuleStatusBit(getModuleStatusBit); /** * Get module status bits. * * \param type type * \return status bits */ inline std::vector getModuleStatusBits(const JType& type) { return JPP::get_keys(getModuleStatusBit); } /** * Get module status bits. * * \param type type * \return status bits */ inline std::vector getModuleStatusBits(const JType& type) { return JPP::get_keys(putModuleStatusBit); } /** * Get module status bits. * * \return status bits */ template inline std::vector getModuleStatusBits() { return getModuleStatusBits(JType()); } } #endif