CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IOVEditor.h
Go to the documentation of this file.
1 #ifndef CondCore_IOVService_IOVEditor_h
2 #define CondCore_IOVService_IOVEditor_h
3 #include <string>
4 #include <vector>
7 //#include "DataSvc/Ref.h"
8 #include<iosfwd>
9 
10 
11 //
12 // Package: CondCore/IOVService
13 // Class : IOVEditor
14 //
18 //
19 // Author: Zhen Xie
20 //
21 namespace cond{
22  class IOVElement;
23  class IOVSequence;
24 
25  class IOVEditor{
26  public:
27 
28  // default constructor
29  explicit IOVEditor(cond::DbSession& dbSess);
30 
31  // constructor from existing iov
32  IOVEditor( cond::DbSession& dbSess,
33  const std::string& token);
34 
36  ~IOVEditor();
37 
38  // create empty default sequence
40 
41  // create empty sequence with fixed time boundary
43 
44  // return the current sequence
45  IOVSequence & iov();
46 
47 
49  unsigned int insert( cond::Time_t tillTime,
50  const std::string& payloadToken
51  );
52 
54  unsigned int append( cond::Time_t sinceTime,
55  const std::string& payloadToken
56  );
57 
59  unsigned int
60  freeInsert( cond::Time_t sinceTime ,
61  const std::string& payloadToken
62  );
63 
65  void bulkAppend( std::vector< std::pair<cond::Time_t,std::string> >& values );
66 
67  void bulkAppend(std::vector< cond::IOVElement >& values);
68 
69  //stamp iov
70  void stamp(std::string const & icomment, bool append=false);
71 
73  void updateClosure( cond::Time_t newtillTime );
74  // remove last entry
75  unsigned int truncate(bool withPayload=false);
76  // delete all entries
77  void deleteEntries( bool withPayload=false);
78  //
79  void import( const std::string& sourceIOVtoken );
81  std::string const & token() const { return m_token;}
82 
83  Time_t firstSince() const;
84 
85  Time_t lastTill() const;
86 
87  TimeType timetype() const;
88 
89 
90  private:
91 
92  void init();
93  bool validTime(cond::Time_t time, cond::TimeType timetype) const;
94  bool validTime(cond::Time_t time) const;
95 
96  void debugInfo(std::ostream & co) const;
97  void reportError(std::string message) const;
98  void reportError(std::string message, cond::Time_t time) const;
99 
100  private:
101 
103  std::string m_token;
105  boost::shared_ptr<cond::IOVSequence> m_iov;
106  };
107 }//ns cond
108 #endif
void debugInfo(std::ostream &co) const
Definition: IOVEditor.cc:27
void reportError(std::string message) const
Definition: IOVEditor.cc:49
bool validTime(cond::Time_t time, cond::TimeType timetype) const
Definition: IOVEditor.cc:118
Time_t lastTill() const
Definition: IOVEditor.cc:109
std::string m_token
Definition: IOVEditor.h:103
unsigned int freeInsert(cond::Time_t sinceTime, const std::string &payloadToken)
insert a payload with known since in any position
Definition: IOVEditor.cc:244
TimeType
Definition: Time.h:21
IOVSequence & iov()
Definition: IOVEditor.cc:24
void create(cond::TimeType timetype)
Definition: IOVEditor.cc:67
unsigned int truncate(bool withPayload=false)
Definition: IOVEditor.cc:280
unsigned long long Time_t
Definition: Time.h:16
TimeType timetype() const
Definition: IOVEditor.cc:113
unsigned int insert(cond::Time_t tillTime, const std::string &payloadToken)
Assign a payload with till time. Returns the payload index in the iov sequence.
Definition: IOVEditor.cc:130
void updateClosure(cond::Time_t newtillTime)
Update the closure of the iov sequence.
Definition: IOVEditor.cc:204
unsigned int append(cond::Time_t sinceTime, const std::string &payloadToken)
Append a payload with known since time. The previous last payload&#39;s till time will be adjusted to the...
Definition: IOVEditor.cc:212
string message
Definition: argparse.py:126
void bulkAppend(std::vector< std::pair< cond::Time_t, std::string > > &values)
Bulk append of iov chunck.
Definition: IOVEditor.cc:152
boost::shared_ptr< cond::IOVSequence > m_iov
Definition: IOVEditor.h:105
void stamp(std::string const &icomment, bool append=false)
Definition: IOVEditor.cc:196
std::string const & token() const
Returns the token of the iov sequence associated with this editor.
Definition: IOVEditor.h:81
void deleteEntries(bool withPayload=false)
Definition: IOVEditor.cc:296
IOVEditor(cond::DbSession &dbSess)
Definition: IOVEditor.cc:14
Time_t firstSince() const
Definition: IOVEditor.cc:105
cond::DbSession m_dbSess
Definition: IOVEditor.h:102
~IOVEditor()
Destructor.
Definition: IOVEditor.cc:12