Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:20

0001 #ifndef CondCore_CondDB_KeyListProxy_h
0002 #define CondCore_CondDB_KeyListProxy_h
0003 
0004 #include "CondCore/CondDB/interface/PayloadProxy.h"
0005 #include "CondCore/CondDB/interface/KeyList.h"
0006 #include <memory>
0007 #include <vector>
0008 #include <string>
0009 
0010 namespace cond {
0011 
0012   struct Iov_t;
0013 
0014   namespace persistency {
0015 
0016     class Session;
0017 
0018     template <>
0019     class PayloadProxy<cond::persistency::KeyList> : public PayloadProxy<std::vector<cond::Time_t>> {
0020     public:
0021       typedef std::vector<cond::Time_t> DataT;
0022       typedef PayloadProxy<DataT> super;
0023 
0024       explicit PayloadProxy(Iov_t const* mostRecentCurrentIov,
0025                             Session const* mostRecentSession,
0026                             std::shared_ptr<std::vector<Iov_t>> const* mostRecentRequests,
0027                             const char* source = nullptr)
0028           : super(mostRecentCurrentIov, mostRecentSession, mostRecentRequests, source), m_keyList() {
0029         if (source)
0030           m_name = source;
0031       }
0032 
0033       ~PayloadProxy() override {}
0034 
0035       void initKeyList(PayloadProxy const& originalPayloadProxy) { m_keyList.init(originalPayloadProxy.m_keyList); }
0036 
0037       // dereference (does not load)
0038       const KeyList& operator()() const { return m_keyList; }
0039 
0040       void loadMore(CondGetter const& getter) override { m_keyList.init(getter.get(m_name)); }
0041 
0042     protected:
0043       void loadPayload() override {
0044         super::loadPayload();
0045         m_keyList.setKeys(super::operator()());
0046       }
0047 
0048     private:
0049       std::string m_name;
0050       KeyList m_keyList;
0051     };
0052   }  // namespace persistency
0053 
0054 }  // namespace cond
0055 #endif