CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IOVSequence.h
Go to the documentation of this file.
1 #ifndef Cond_IOVSequence_h
2 #define Cond_IOVSequence_h
3 
10 
12 
13 #include <vector>
14 #include <string>
15 #include <set>
16 
17 namespace cond {
18 
24  class IOVSequence : public UpdateStamp{
25  public:
31 
32  IOVSequence();
33 
34  // the real default constructor...
35  explicit IOVSequence( cond::TimeType ttype );
36 
37  // constructor for the editor
38  IOVSequence(int type, cond::Time_t till, std::string const& imetadata);
39 
40  ~IOVSequence();
41 
42  IOVSequence(IOVSequence const & rh);
43  IOVSequence & operator=(IOVSequence const & rh);
44 
45  // append a new item, return position of last inserted entry
46  size_t add(cond::Time_t time, std::string const & token, std::string const& payloadClassName );
47 
48  // remove last entry, return position of last entry still valid
49  size_t truncate();
50 
51  // find IOV for which time is valid (this is not STANDARD std::find!)
53 
54  // find IOV with a given since (this is not STANDARD std::find!)
56 
57  // true if an iov with since==time already exists
58  bool exist(cond::Time_t time) const;
59 
61 
62  // FIXME shall we cache it?
63  cond::Time_t firstSince() const { return iovs().front().sinceTime();}
64 
65  cond::Time_t lastTill() const { return m_lastTill;}
66 
68 
69  void updateMetadata( const std::string& metadata, bool append=true );
70 
72 
73  public:
74  Container const & iovs() const;
75 
76  // if true the "sorted" sequence is not guaranted to be the same as in previous version
77  bool notOrdered() const { return m_notOrdered;}
78 
79  std::string const & metadata() const { return m_metadata;}
80 
81  std::set<std::string> const& payloadClasses() const { return m_payloadClasses; }
82 
83  ScopeType scope() const { return m_scope;}
84 
85  void loadAll() const;
86 
87  public:
88 
89  // the real persistent container...
91  m_iovs.load();
92  return m_iovs;
93  }
94  Container const & piovs() const {
95  m_iovs.load();
96  return m_iovs;
97  }
98 
99  void swapTokens( ora::ITokenParser& parser ) const;
100  void swapOIds( ora::ITokenWriter& writer ) const;
101 
102  private:
103 
104  // iovs is not in order: take action!
105  void disorder();
106 
107  // sort the container in m_sorted
108  Container const & sortMe() const;
109 
110  private:
111 
116  std::string m_metadata; // FIXME not used???
117  std::set<std::string> m_payloadClasses;
119 
120  mutable Container * m_sorted;
121 
122 };
123 
124 }//ns cond
125 #endif
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
type
Definition: HCALResponse.h:21
cond::Time_t lastTill() const
Definition: IOVSequence.h:65
ScopeType scope() const
Definition: IOVSequence.h:83
Container & piovs()
Definition: IOVSequence.h:90
std::string m_metadata
Definition: IOVSequence.h:116
const_iterator find(cond::Time_t time) const
Definition: IOVSequence.cc:110
cond::Time_t firstSince() const
Definition: IOVSequence.h:63
void swapOIds(ora::ITokenWriter &writer) const
Definition: IOVSequence.cc:157
Container const & iovs() const
Definition: IOVSequence.cc:76
std::string const & metadata() const
Definition: IOVSequence.h:79
IOVSequence & operator=(IOVSequence const &rh)
Definition: IOVSequence.cc:55
PVector< Item >::iterator iterator
Container const & piovs() const
Definition: IOVSequence.h:94
void setScope(ScopeType type)
Definition: IOVSequence.h:71
ora::QueryableVector< Item > Container
Definition: IOVSequence.h:27
Container m_iovs
Definition: IOVSequence.h:112
Container::const_iterator const_iterator
Definition: IOVSequence.h:29
Container const & sortMe() const
Definition: IOVSequence.cc:82
TimeType
Definition: Time.h:21
Container::iterator iterator
Definition: IOVSequence.h:28
void updateLastTill(cond::Time_t till)
Definition: IOVSequence.h:67
bool exist(cond::Time_t time) const
Definition: IOVSequence.cc:127
unsigned long long Time_t
Definition: Time.h:16
void loadAll() const
Definition: IOVSequence.cc:69
TimeType type
Definition: Time.h:41
size_t add(cond::Time_t time, std::string const &token, std::string const &payloadClassName)
Definition: IOVSequence.cc:95
void swapTokens(ora::ITokenParser &parser) const
Definition: IOVSequence.cc:147
const_iterator findSince(cond::Time_t time) const
Definition: IOVSequence.cc:122
std::set< std::string > m_payloadClasses
Definition: IOVSequence.h:117
cond::IOVElement Item
Definition: IOVSequence.h:26
bool notOrdered() const
Definition: IOVSequence.h:77
ScopeType m_scope
Definition: IOVSequence.h:118
std::set< std::string > const & payloadClasses() const
Definition: IOVSequence.h:81
PVector< Tp >::const_iterator const_iterator
Container * m_sorted
Definition: IOVSequence.h:120
cond::Time_t m_lastTill
Definition: IOVSequence.h:114
void updateMetadata(const std::string &metadata, bool append=true)
Definition: IOVSequence.cc:131
cond::TimeType timeType() const
Definition: IOVSequence.h:60