CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10/src/CondFormats/Common/interface/IOVElement.h

Go to the documentation of this file.
00001 #ifndef Cond_IOVElement_h
00002 #define Cond_IOVElement_h
00003 #include "CondFormats/Common/interface/Time.h"
00004 #include "CondCore/ORA/interface/OId.h"
00005 #include <string>
00006 
00007 namespace cond {
00008 
00012   class IOVElement {
00013     public:
00014     IOVElement():
00015       m_sinceTime(0),
00016       m_wrapper(""),
00017       m_oid(){}
00018 
00019     explicit IOVElement(cond::Time_t it) : 
00020       m_sinceTime(it),
00021       m_wrapper(""),
00022       m_oid(){}
00023 
00024     IOVElement(cond::Time_t it,
00025                std::string const& itoken):
00026       m_sinceTime(it),
00027       m_wrapper(""),
00028       m_oid(){
00029       m_oid.fromString( itoken );
00030     }
00031 
00032     cond::Time_t sinceTime() const {return m_sinceTime;}
00033 
00034     std::string token() const {
00035       return m_oid.toString();
00036     }
00037 
00038     bool operator==(IOVElement const & rh) const {
00039       return sinceTime()==rh.sinceTime()
00040         &&  token()==rh.token();
00041     }
00042     
00043     void swapToken( ora::ITokenParser& parser ) const {
00044       if( !m_wrapper.empty() ){
00045         const_cast<IOVElement*>(this)->m_oid = parser.parse( m_wrapper );
00046         const_cast<IOVElement*>(this)->m_wrapper.clear();
00047       }
00048     }
00049 
00050     void swapOId( ora::ITokenWriter& writer ) const {
00051       if( !m_oid.isInvalid() ){
00052         const_cast<IOVElement*>(this)->m_wrapper = writer.write( m_oid );
00053       }
00054     }
00055 
00056     private:
00057     cond::Time_t m_sinceTime;
00058     std::string m_wrapper;
00059     ora::OId m_oid;
00060     
00061   };
00062   
00063   
00064 } // ns cond
00065 
00066 
00067 #endif