CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
KeyList.h
Go to the documentation of this file.
1 #ifndef CondCore_IOVService_KeyList_h
2 #define CondCore_IOVService_KeyList_h
3 
6 #include<vector>
7 #include<string>
8 
9 /*
10  * KeyList represents a set of payloads each identified by a key and "valid" at given time
11  * Usually these payloads are configuration objects loaded in anvance
12  * The model used here calls for all payloads to be "stored" in a single IOVSequence each identified by a unique key
13  * (properly hashed to be mapped in 64bits)
14  *
15  * the keylist is just a vector of the hashes each corresponding to a key
16  * the correspondence position in the vector user-friendly name is kept in
17  * a list of all "names" that is defined in advance and kept in a dictionary at IOVSequence level
18 
19  *
20  */
21 
22 namespace cond {
23 
24  class IOVKeysDescription;
25 
26  class KeyList {
27  public:
28  typedef BaseKeyed Base;
29 
30  KeyList(IOVKeysDescription const * idescr=0);
31 
32  void init(cond::IOVProxy const & seq ) {
33  m_sequence = seq;
34  }
35 
36  void load(std::vector<unsigned long long> const & keys);
37 
38  template<typename T>
39  T const * get(int n) const {
40  return dynamic_cast<T const *>(elem(n));
41  }
42 
43  template<typename T>
44  T const * get(char const * iname) const {
45  return dynamic_cast<T const *>(elem(iname));
46  }
47 
48  template<typename T>
49  T const * get(std::string const & iname) const {
50  return dynamic_cast<T const *>(elem(iname));
51  }
52 
53  BaseKeyed const * elem(int n) const;
54 
55  BaseKeyed const * elem(char const * iname) const;
56 
57  BaseKeyed const * elem(std::string const & iname) const;
58 
59  int size() const { return m_data.size();}
60 
61  private:
62  // tag and dict
64 
65  // the full collection of keyed object
67  // the current set
68  std::vector<boost::shared_ptr<Base> > m_data;
69 
70  };
71 
72 
73 }
74 
75 #endif
void load(std::vector< unsigned long long > const &keys)
Definition: KeyList.cc:10
std::vector< boost::shared_ptr< Base > > m_data
Definition: KeyList.h:68
KeyList(IOVKeysDescription const *idescr=0)
Definition: KeyList.cc:8
void init(cond::IOVProxy const &seq)
Definition: KeyList.h:32
cond::IOVProxy m_sequence
Definition: KeyList.h:66
BaseKeyed const * elem(int n) const
Definition: KeyList.cc:26
int size() const
Definition: KeyList.h:59
IOVKeysDescription const * m_description
Definition: KeyList.h:63
long double T
BaseKeyed Base
Definition: KeyList.h:28