CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
KeyedElement.h
Go to the documentation of this file.
4 #include <sstream>
5 
6 namespace cond{
7 
8  /* encapsulate data to write a keyed element in an IOVSequence
9  */
10  class KeyedElement {
11 
12  public:
13  // constructor from int key
15  m_obj(obj),
16  m_skey(""),
17  m_key(key) {
18  std::ostringstream ss; ss << key;
19  m_skey = ss.str();
20  (*obj).setKey(m_skey);
21  }
22 
23  // constructor from ascii key
24  KeyedElement(BaseKeyed * obj, std::string key) :
25  m_obj(obj),
26  m_skey(key),
27  m_key(convert(key)) {
28  (*obj).setKey(m_skey);
29  }
30 
31  static cond::Time_t convert(std::string key) {
32  return cond::hash64( (unsigned char*)(&key[0]),key.size(),0);
33  }
34 
36  std::string m_skey;
38  };
39 
40 
41 }
unsigned long long hash64(unsigned char *k, unsigned long long length, unsigned long long level)
Definition: hash64.cc:45
KeyedElement(BaseKeyed *obj, cond::Time_t key)
Definition: KeyedElement.h:14
BaseKeyed * m_obj
Definition: KeyedElement.h:35
unsigned long long Time_t
Definition: Time.h:16
static cond::Time_t convert(std::string key)
Definition: KeyedElement.h:31
list key
Definition: combine.py:13
std::string m_skey
Definition: KeyedElement.h:36
cond::Time_t m_key
Definition: KeyedElement.h:37
KeyedElement(BaseKeyed *obj, std::string key)
Definition: KeyedElement.h:24