CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IOVElement.h
Go to the documentation of this file.
1 #ifndef Cond_IOVElement_h
2 #define Cond_IOVElement_h
5 #include <string>
6 
7 namespace cond {
8 
12  class IOVElement {
13  public:
15  m_sinceTime(0),
16  m_wrapper(""),
17  m_oid(){}
18 
19  explicit IOVElement(cond::Time_t it) :
20  m_sinceTime(it),
21  m_wrapper(""),
22  m_oid(){}
23 
25  std::string const& itoken):
26  m_sinceTime(it),
27  m_wrapper(""),
28  m_oid(){
29  m_oid.fromString( itoken );
30  }
31 
33 
34  std::string token() const {
35  return m_oid.toString();
36  }
37 
38  bool operator==(IOVElement const & rh) const {
39  return sinceTime()==rh.sinceTime()
40  && token()==rh.token();
41  }
42 
44  if( !m_wrapper.empty() ){
45  const_cast<IOVElement*>(this)->m_oid = parser.parse( m_wrapper );
46  const_cast<IOVElement*>(this)->m_wrapper.clear();
47  }
48  }
49 
50  void swapOId( ora::ITokenWriter& writer ) const {
51  if( !m_oid.isInvalid() ){
52  const_cast<IOVElement*>(this)->m_wrapper = writer.write( m_oid );
53  }
54  }
55 
56  private:
58  std::string m_wrapper;
60 
61  };
62 
63 
64 } // ns cond
65 
66 
67 #endif
IOVElement(cond::Time_t it, std::string const &itoken)
Definition: IOVElement.h:24
virtual std::string write(const OId &oid)=0
std::string token() const
Definition: IOVElement.h:34
bool isInvalid() const
Definition: OId.cc:80
Definition: OId.h:8
bool operator==(IOVElement const &rh) const
Definition: IOVElement.h:38
void swapOId(ora::ITokenWriter &writer) const
Definition: IOVElement.h:50
unsigned long long Time_t
Definition: Time.h:16
cond::Time_t m_sinceTime
Definition: IOVElement.h:57
void swapToken(ora::ITokenParser &parser) const
Definition: IOVElement.h:43
ora::OId m_oid
Definition: IOVElement.h:59
IOVElement(cond::Time_t it)
Definition: IOVElement.h:19
virtual OId parse(const std::string &poolToken)=0
cond::Time_t sinceTime() const
Definition: IOVElement.h:32
std::string toString() const
Definition: OId.cc:58
std::string m_wrapper
Definition: IOVElement.h:58
bool fromString(const std::string &s)
Definition: OId.cc:64