CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/CondCore/IOVService/interface/KeyListProxy.h

Go to the documentation of this file.
00001 #ifndef CondCore_IOVService_KeyListProxy_h
00002 #define CondCore_IOVService_KeyListProxy_h
00003 
00004 #include "CondCore/IOVService/interface/PayloadProxy.h"
00005 #include "CondCore/IOVService/interface/KeyList.h"
00006 #include <vector>
00007 #include <string>
00008 
00009 namespace cond {
00010 
00011   template<> class PayloadProxy<cond::KeyList> : public PayloadProxy<std::vector<cond::Time_t> > {
00012   public:
00013     typedef std::vector<cond::Time_t> DataT;
00014     typedef PayloadProxy<DataT> super;
00015 
00016     PayloadProxy(cond::DbSession& session,
00017                  bool errorPolicy, const char * source=0) :
00018       super(session, errorPolicy) {
00019       m_name = source;
00020     }
00021 
00022     PayloadProxy(cond::DbSession& session,
00023                  const std::string & token, bool errorPolicy, const char * source=0) :
00024       super(session, token, errorPolicy) {
00025       m_name = source;
00026     }
00027     
00028     virtual ~PayloadProxy(){}
00029 
00030     // dereference (does not load)
00031     const cond::KeyList & operator()() const {
00032       return me; 
00033     }
00034         
00035     virtual void invalidateCache() {
00036       super::invalidateCache();
00037     }
00038 
00039     virtual void loadMore(CondGetter const & getter){
00040       me.init(getter.get(m_name));
00041     }
00042 
00043 
00044   protected:
00045     virtual bool load( DbSession& sess, std::string const & token) {
00046       bool ok = super::load(sess, token);
00047       me.load(super::operator()());
00048       return ok;
00049     }
00050 
00051   private:
00052 
00053     std::string m_name;
00054 
00055     KeyList me;
00056 
00057   };
00058 }
00059 #endif