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