CMS 3D CMS Logo

GTEditor.h
Go to the documentation of this file.
1 #ifndef CondCore_CondDB_GTEditor_h
2 #define CondCore_CondDB_GTEditor_h
3 //
4 // Package: CondDB
5 // Class : GTEditor
6 //
10 //
11 // Author: Giacomo Govi
12 // Created: Jul 2013
13 //
14 
17 //
18 #include <boost/date_time/posix_time/posix_time.hpp>
19 
20 namespace cond {
21 
22  namespace persistency {
23 
24  class SessionImpl;
25  class GTEditorData;
26 
27  // value semantics...
28  class GTEditor {
29  public:
30  // default ctor
31  GTEditor();
32 
33  // ctor
34  explicit GTEditor(const std::shared_ptr<SessionImpl>& session);
35 
36  // ctor used after new tag creation. the specified params are assumed and passed directly to the object.
37  GTEditor(const std::shared_ptr<SessionImpl>& session, const std::string& gtName);
38 
39  //
40  GTEditor(const GTEditor& rhs);
41 
42  //
43  GTEditor& operator=(const GTEditor& rhs);
44 
45  // loads to tag to edit
46  void load(const std::string& gtName);
47 
48  // read only getters. they could be changed to return references...
49  std::string name() const;
50 
51  // getters/setters for the updatable parameters
52  cond::Time_t validity() const;
54 
55  std::string description() const;
57 
58  std::string release() const;
59  void setRelease(const std::string& release);
60 
61  boost::posix_time::ptime snapshotTime() const;
62  void setSnapshotTime(const boost::posix_time::ptime& snapshotTime);
63 
64  // register a new insertion.
65  // if checkType==true, the object type declared for the tag is verified to be the same type as the iov payloadObjectType record object type.
66  void insert(const std::string& recordName, const std::string& tagName, bool checkType = false);
67  void insert(const std::string& recordName,
68  const std::string& recordLabel,
69  const std::string& tagName,
70  bool checkType = false);
71 
72  // execute the update/intert queries and reset the buffer
73  bool flush();
74  // execute the update/intert queries and reset the buffer
75  bool flush(const boost::posix_time::ptime& operationTime);
76 
77  private:
78  void checkTransaction(const std::string& ctx);
79 
80  private:
81  std::shared_ptr<GTEditorData> m_data;
82  std::shared_ptr<SessionImpl> m_session;
83  };
84 
85  } // namespace persistency
86 } // namespace cond
87 
88 #endif
void setDescription(const std::string &description)
Definition: GTEditor.cc:69
std::string name() const
Definition: GTEditor.cc:56
std::string release() const
Definition: GTEditor.cc:76
void insert(const std::string &recordName, const std::string &tagName, bool checkType=false)
Definition: GTEditor.cc:96
boost::posix_time::ptime snapshotTime() const
Definition: GTEditor.cc:85
std::string description() const
Definition: GTEditor.cc:67
std::shared_ptr< SessionImpl > m_session
Definition: GTEditor.h:82
unsigned long long Time_t
Definition: Time.h:14
void checkTransaction(const std::string &ctx)
Definition: GTEditor.cc:146
void setSnapshotTime(const boost::posix_time::ptime &snapshotTime)
Definition: GTEditor.cc:89
GTEditor & operator=(const GTEditor &rhs)
Definition: GTEditor.cc:37
Definition: plugin.cc:23
cond::Time_t validity() const
Definition: GTEditor.cc:58
void load(const std::string &gtName)
Definition: GTEditor.cc:43
void setRelease(const std::string &release)
Definition: GTEditor.cc:78
std::shared_ptr< GTEditorData > m_data
Definition: GTEditor.h:81
void setValidity(cond::Time_t validity)
Definition: GTEditor.cc:60