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