CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/CondCore/DBCommon/interface/PayloadRef.h

Go to the documentation of this file.
00001 #ifndef CondCore_DBCommon_PayloadRef_h
00002 #define CondCore_DBCommon_PayloadRef_h
00003 
00004 namespace cond {
00005 
00006   /* manages various types of wrappers...
00007    */
00008   template<typename DataT>
00009   class PayloadRef {
00010   public:
00011 
00012     PayloadRef() {}
00013     ~PayloadRef(){}
00014     
00015     // dereference (does not re-load)
00016     const DataT & operator*() const {
00017       return *m_Data; 
00018     }
00019     
00020     void clear() {
00021       m_Data.reset();
00022     }
00023     
00024     
00025     bool load( DbSession& dbSess, std::string const & itoken) {
00026       clear();
00027       bool ok = false;
00028       
00029       boost::shared_ptr<DataT> tmp = dbSess.getTypedObject<DataT>( itoken );
00030       if (tmp.get()) {
00031         m_Data = tmp;
00032         ok =  true;
00033       }
00034       return ok;
00035     }
00036     
00037     
00038   private:
00039     boost::shared_ptr<DataT> m_Data;
00040   };
00041   
00042 }
00043 #endif // CondCore_PayloadProxy_h