#ifndef __JDB_JSELECTORSUPPORTKIT__ #define __JDB_JSELECTORSUPPORTKIT__ #include #include "JLang/JConversion.hh" #include "JDB/JSelector.hh" #include "JDB/JDBTypes.hh" /** * \author mdejong */ namespace JDATABASE {}; namespace JPP { using namespace JDATABASE; } namespace JDATABASE { using JLANG::JConversion; /** * Template definition for getting table specific selector.\n * Note that the template argument * T refers to the targeted table and * JTable_t to the actual table.\n * This allows to use pointers to data members for column names rather than text strings. */ template::is_same> struct getSelector; /** * Template specialisation for getting table specific selector. */ template struct getSelector : public JSelector { /** * Get selector for the given table based on the location identifier. * * \param locID location identifier * \return selector */ getSelector(const JDBString& locID) { this->add(&T::LOCATIONID, locID); } /** * Get selector for the given table based on the login name. * * \param login login string */ getSelector(const std::string& login) { this->add(&T::LOGIN, login); } }; /** * Template specialisation for getting table specific selector. */ template struct getSelector : public JSelector { /** * Get selector for the given table based on the serial number. * * \param id serial number */ getSelector(const int id) { this->add(&T::SERIALNUMBER, id); } /** * Get selector for the given table based on the object identifier. * * \param detid detector identifier * \return selector */ getSelector(const std::string& detid) { this->add(&T::OID, detid); } }; /** * Template specialisation for getting table specific selector. */ template struct getSelector : public JSelector { /** * Get selector for the given table based on the detector serial number. * * \param id detector serial number */ getSelector(const int id) { this->add(&T::DETID, id); } /** * Get selector for the given table based on the detector serial number and run number. * * \param id detector serial number * \param run run number * \return selector */ getSelector(const int id, const int run) { this->add(&T::DETID, id); this->add(&T::RUN, run); } /** * Get selector for the given table based on the detector serial number and run number. * * \param id detector serial number * \param minrun minimal run number * \param maxrun maximal run number * \return selector */ getSelector(const int id, const int minrun, const int maxrun) { this->add(&T::DETID, id); this->add(&T::RUN, minrun, Selector::RelOp::GreaterEqual); this->add(&T::RUN, maxrun, Selector::RelOp::LessEqual); } }; /** * Template specialisation for getting table specific selector. */ template struct getSelector : public JSelector { /** * Get selector for the given table based on the detector identifier and a run range. * * \param detid detector identifier * \param minrun minimal run number * \param maxrun maximal run number */ getSelector(const std::string& detid, const int minrun, const int maxrun) { this->add(&T::DETID, detid); this->add("MINRUN", minrun); this->add("MAXRUN", maxrun); } }; /** * Template specialisation for getting table specific selector. */ template struct getSelector : public JSelector { /** * Get selector for the given table based on the sub-system identifier. * * \param ssid ssid */ getSelector(const std::string& ssid) { this->add(&T::SUBSYSTEMID, ssid); } }; /** * Template specialisation for getting table specific selector. */ template struct getSelector : public JSelector { /** * Get selector for the given table based on the detector identifier and a run range. * * \param detid detector identifier * \param minrun minimal run number * \param maxrun maximal run number */ getSelector(const std::string& detid, const int minrun, const int maxrun) { this->add(&T::DETID, detid); this->add("MINRUN", minrun); this->add("MAXRUN", maxrun); } }; /** * Template specialisation for getting table specific selector. */ template struct getSelector : public JSelector { /** * Get selector for the given table based on the detector identifier. * * \param detoid detector identifier */ getSelector(const std::string& detoid) { this->add(&T::DETOID, detoid); } }; /** * Template specialisation for getting table specific selector. */ template struct getSelector : public JSelector { /** * Get selector for the given table based on the serial number. * * \param id serial number */ getSelector(const int id) { this->add(&T::DETID, id); } /** * Get selector for the given table based on the detector identifier and a run range. * * \param detoid detector identifier */ getSelector(const std::string& detoid) { this->add(&T::DETOID, detoid); } }; /** * Template specialisation for getting table specific selector. */ template struct getSelector : public JSelector { /** * Get selector for the given table based on the detector identifier and a run range. * * \param detid detector identifier * \param minrun minimal run number * \param maxrun maximal run number */ getSelector(const std::string& detid, const int minrun, const int maxrun) { this->add(&T::DETID, detid); this->add("MINRUN", minrun); this->add("MAXRUN", maxrun); } }; /** * Template specialisation for getting table specific selector. */ template struct getSelector : public getSelector { /** * Get selector for the given table based on the detector identifier and a run range. * * \param detid detector identifier * \param minrun minimal run number * \param maxrun maximal run number */ getSelector(const std::string& detid, const int minrun, const int maxrun) : getSelector(detid, minrun, maxrun) {} }; /** * Template specialisation for getting table specific selector. */ template struct getSelector : public JSelector { /** * Get selector for the given table based on the detector and run-setup identifier. * * \param detid detector identifier * \param rs_oid runsetup identifier */ getSelector(const std::string& detid, const std::string& rs_oid) { this->add(&T::DETID, detid); this->add(&T::RS_OID, rs_oid); } }; /** * Template specialisation for getting table specific selector. */ template struct getSelector : public JSelector { /** * Get selector for the given table based on the detector and run number. * * \param detoid detector identifier * \param cg_name cg_name */ getSelector(const std::string& detoid, const std::string& cg_name) { this->add(&T::DETOID, detoid); this->add(&T::CG_NAME, cg_name); } }; /** * Template specialisation for getting table specific selector. */ template struct getSelector : public JSelector { /** * Get selector for the given table based on the detector and run number. * * \param detoid detector identifier * \param run run number */ getSelector(const std::string& detoid, const int run) { this->add(&T::DETOID, detoid); this->add(&T::RUN, run); } }; /** * Template specialisation for getting table specific selector. */ template struct getSelector : public JSelector { /** * Get selector for the given table based on the detector identifier. * * \param detid detector identifier */ getSelector(const int detid) { this->add(&T::DETID, detid); } }; /** * Template specialisation for getting table specific selector. */ template struct getSelector : public JSelector { /** * Get selector for the given table. */ getSelector() { this->add(&T::CLBID, -1, Selector::RelOp::Different); } }; /** * Template specialisation for getting table specific selector. */ template struct getSelector : public JSelector { /** * Get selector for the given table based on the detector identifier. * * \param pbs %PBS */ getSelector(const JPBS_t pbs) { this->add(&T::PBS, pbs); } }; /** * Template specialisation for getting table specific selector. */ template struct getSelector : public JSelector { /** * Get selector for the given table based on the detector identifier and a run range. * * \param detid detector identifier * \param minrun minimal run number * \param maxrun maximal run number */ getSelector(const int detid, const int minrun, const int maxrun) { this->add(&T::DETID, detid); this->add("MINRUN", minrun); this->add("MAXRUN", maxrun); } }; /** * Template specialisation for getting table specific selector. */ template struct getSelector : public JSelector { /** * Get selector for the given table based on the detector and run number. * * \param detoid detector identifier */ getSelector(const std::string& detoid) { this->add(&T::DETOID, detoid); } }; /** * Template specialisation for getting table specific selector. */ template struct getSelector : public JSelector { /** * Get selector for the given table based on the detector and run number. * * \param detoid detector identifier * \param operation operation identifier */ getSelector(const std::string& detoid, const std::string& operation) { this->add(&T::DetOID, detoid); this->add(&T::OperationId, operation); } }; /** * Template specialisation for getting table specific selector. */ template struct getSelector : public JSelector { /** * Get selector for the given table based on the detector and run number. * * \param detoid detector identifier * \param run run number */ getSelector(const std::string& detoid, const int run) { this->add(&T::DetectorId, detoid); this->add(&T::Run, run); } /** * Get selector for the given table based on the detector and run number. * * \param detoid detector identifier * \param run run number * \param ranking ranking */ getSelector(const std::string& detoid, const int run, const int ranking) { this->add(&T::DetectorId, detoid); this->add(&T::Run, run); this->add(&T::Ranking, ranking); } }; } #endif