#ifndef __JDETECTOR__JPMTSTATUS__ #define __JDETECTOR__JPMTSTATUS__ #include #include #include #include "km3net-dataformat/definitions/pmt_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 PMT status bit. */ struct JGetPMTStatusBit : public JGetStatusBit { /** * Default constructor. */ JGetPMTStatusBit() { #define MAKE_ENTRY(A) std::make_pair(#A, A) this->insert(MAKE_ENTRY(PMT_DISABLE)); this->insert(MAKE_ENTRY(HIGH_RATE_VETO_DISABLE)); this->insert(MAKE_ENTRY(FIFO_FULL_DISABLE)); this->insert(MAKE_ENTRY(UDP_COUNTER_DISABLE)); this->insert(MAKE_ENTRY(UDP_TRAILER_DISABLE)); this->insert(MAKE_ENTRY(OUT_OF_SYNC)); #undef MAKE_ENTRY } }; /** * Type definition to map PMT status bit to key. */ typedef JPutStatusBit JPutPMTStatusBit; /** * Function object to map key to PMT status bit. */ static const JGetPMTStatusBit getPMTStatusBit; /** * Function object to map PMT status bit to key. */ static const JPutPMTStatusBit putPMTStatusBit(getPMTStatusBit); /** * Get PMT status bits. * * \param type type * \return status bits */ inline std::vector getPMTStatusBits(const JType& type) { return JPP::get_keys(getPMTStatusBit); } /** * Get PMT status bits. * * \param type type * \return status bits */ inline std::vector getPMTStatusBits(const JType& type) { return JPP::get_keys(putPMTStatusBit); } /** * Get PMT status bits. * * \return status bits */ template inline std::vector getPMTStatusBits() { return getPMTStatusBits(JType()); } } #endif