Go to the documentation of this file.00001 #ifndef Cond_IOVSequence_h
00002 #define Cond_IOVSequence_h
00003 #include "CondFormats/Common/interface/UpdateStamp.h"
00004 #include "CondFormats/Common/interface/IOVElement.h"
00005 #include "CondFormats/Common/interface/Time.h"
00006 #include "CondFormats/Common/interface/IOVProvenance.h"
00007 #include "CondFormats/Common/interface/IOVDescription.h"
00008 #include "CondFormats/Common/interface/IOVUserMetaData.h"
00009
00010 #include "CondCore/ORA/interface/QueryableVector.h"
00011
00012 #include <vector>
00013 #include <string>
00014 #include <set>
00015
00016 namespace cond {
00017
00023 class IOVSequence : public UpdateStamp{
00024 public:
00025 typedef cond::IOVElement Item;
00026 typedef ora::QueryableVector<Item> Container;
00027 typedef Container::iterator iterator;
00028 typedef Container::const_iterator const_iterator;
00029 typedef enum { Unknown=-1, Obsolete, Tag, TagInGT, ChildTag, ChildTagInGT } ScopeType;
00030
00031 IOVSequence();
00032
00033
00034 explicit IOVSequence( cond::TimeType ttype );
00035
00036
00037 IOVSequence(int type, cond::Time_t till, std::string const& imetadata);
00038
00039 ~IOVSequence();
00040
00041 IOVSequence(IOVSequence const & rh);
00042 IOVSequence & operator=(IOVSequence const & rh);
00043
00044
00045 size_t add(cond::Time_t time, std::string const & token, std::string const& payloadClassName );
00046
00047
00048 size_t truncate();
00049
00050
00051 const_iterator find(cond::Time_t time) const;
00052
00053
00054 const_iterator findSince(cond::Time_t time) const;
00055
00056
00057 bool exist(cond::Time_t time) const;
00058
00059 cond::TimeType timeType() const { return cond::timeTypeSpecs[m_timetype].type;}
00060
00061
00062 cond::Time_t firstSince() const { return iovs().front().sinceTime();}
00063
00064 cond::Time_t lastTill() const { return m_lastTill;}
00065
00066 void updateLastTill(cond::Time_t till) { m_lastTill=till;}
00067
00068 void updateMetadata( const std::string& metadata, bool append=true );
00069
00070 void setScope( ScopeType type ) { m_scope = type;}
00071
00072 public:
00073 Container const & iovs() const;
00074
00075
00076 bool notOrdered() const { return m_notOrdered;}
00077
00078 std::string const & metadata() const { return m_metadata;}
00079
00080 std::set<std::string> const& payloadClasses() const { return m_payloadClasses; }
00081
00082 ScopeType scope() const { return m_scope;}
00083
00084 void loadAll() const;
00085
00086 public:
00087
00088
00089 Container & piovs() {
00090 m_iovs.load();
00091 return m_iovs;
00092 }
00093 Container const & piovs() const {
00094 m_iovs.load();
00095 return m_iovs;
00096 }
00097
00098 void swapTokens( ora::ITokenParser& parser ) const;
00099 void swapOIds( ora::ITokenWriter& writer ) const;
00100
00101 private:
00102
00103
00104 void disorder();
00105
00106
00107 Container const & sortMe() const;
00108
00109 private:
00110
00111 Container m_iovs;
00112 int m_timetype;
00113 cond::Time_t m_lastTill;
00114 bool m_notOrdered;
00115 std::string m_metadata;
00116 std::set<std::string> m_payloadClasses;
00117 ScopeType m_scope;
00118
00119 mutable Container * m_sorted;
00120
00121 };
00122
00123 }
00124 #endif