CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
31  // ctor
32  explicit GTEditor( const std::shared_ptr<SessionImpl>& session );
33 
34  // ctor used after new tag creation. the specified params are assumed and passed directly to the object.
35  GTEditor( const std::shared_ptr<SessionImpl>& session, const std::string& gtName );
36 
37  //
38  GTEditor( const GTEditor& rhs );
39 
40  //
41  GTEditor& operator=( const GTEditor& rhs );
42 
43  // loads to tag to edit
44  void load( const std::string& gtName );
45 
46  // read only getters. they could be changed to return references...
47  std::string name() const;
48 
49  // getters/setters for the updatable parameters
50  cond::Time_t validity() const;
51  void setValidity( cond::Time_t validity );
52 
53  std::string description() const;
54  void setDescription( const std::string& description );
55 
56  std::string release() const;
57  void setRelease( const std::string& release );
58 
59  boost::posix_time::ptime snapshotTime() const;
60  void setSnapshotTime( const boost::posix_time::ptime& snapshotTime );
61 
62  // register a new insertion.
63  // if checkType==true, the object type declared for the tag is verified to be the same type as the iov payloadObjectType record object type.
64  void insert( const std::string& recordName, const std::string& tagName, bool checkType=false );
65  void insert( const std::string& recordName, const std::string& recordLabel, const std::string& tagName, bool checkType=false );
66 
67  // execute the update/intert queries and reset the buffer
68  bool flush();
69  // execute the update/intert queries and reset the buffer
70  bool flush( const boost::posix_time::ptime& operationTime );
71  private:
72  void checkTransaction( const std::string& ctx );
73 
74  private:
75  std::shared_ptr<GTEditorData> m_data;
76  std::shared_ptr<SessionImpl> m_session;
77 
78  };
79 
80  }
81 }
82 
83 #endif
84 
GTEditor(const std::shared_ptr< SessionImpl > &session)
Definition: GTEditor.cc:31
void setDescription(const std::string &description)
Definition: GTEditor.cc:84
std::string description() const
Definition: GTEditor.cc:80
void insert(const std::string &recordName, const std::string &tagName, bool checkType=false)
Definition: GTEditor.cc:113
std::shared_ptr< SessionImpl > m_session
Definition: GTEditor.h:76
unsigned long long Time_t
Definition: Time.h:16
void checkTransaction(const std::string &ctx)
Definition: GTEditor.cc:162
boost::posix_time::ptime snapshotTime() const
Definition: GTEditor.cc:102
void setSnapshotTime(const boost::posix_time::ptime &snapshotTime)
Definition: GTEditor.cc:106
GTEditor & operator=(const GTEditor &rhs)
Definition: GTEditor.cc:48
std::string name() const
Definition: GTEditor.cc:65
std::string release() const
Definition: GTEditor.cc:91
void load(const std::string &gtName)
Definition: GTEditor.cc:53
cond::Time_t validity() const
Definition: GTEditor.cc:69
void setRelease(const std::string &release)
Definition: GTEditor.cc:95
std::shared_ptr< GTEditorData > m_data
Definition: GTEditor.h:75
void setValidity(cond::Time_t validity)
Definition: GTEditor.cc:73