Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:01:24

0001 #ifndef CondCore_CondDB_GTEditor_h
0002 #define CondCore_CondDB_GTEditor_h
0003 //
0004 // Package:     CondDB
0005 // Class  :     GTEditor
0006 //
0007 /**\class GTEditor GTEditor.h CondCore/CondDB/interface/GTEditor.h
0008    Description: service for update access to the condition IOVs.  
0009 */
0010 //
0011 // Author:      Giacomo Govi
0012 // Created:     Jul 2013
0013 //
0014 
0015 #include "CondCore/CondDB/interface/Time.h"
0016 #include "CondCore/CondDB/interface/Types.h"
0017 //
0018 #include <boost/date_time/posix_time/posix_time.hpp>
0019 
0020 namespace cond {
0021 
0022   namespace persistency {
0023 
0024     class SessionImpl;
0025     class GTEditorData;
0026 
0027     // value semantics...
0028     class GTEditor {
0029     public:
0030       // default ctor
0031       GTEditor();
0032 
0033       // ctor
0034       explicit GTEditor(const std::shared_ptr<SessionImpl>& session);
0035 
0036       // ctor used after new tag creation. the specified params are assumed and passed directly to the object.
0037       GTEditor(const std::shared_ptr<SessionImpl>& session, const std::string& gtName);
0038 
0039       //
0040       GTEditor(const GTEditor& rhs);
0041 
0042       //
0043       GTEditor& operator=(const GTEditor& rhs);
0044 
0045       // loads to tag to edit
0046       void load(const std::string& gtName);
0047 
0048       // read only getters. they could be changed to return references...
0049       std::string name() const;
0050 
0051       // getters/setters for the updatable parameters
0052       cond::Time_t validity() const;
0053       void setValidity(cond::Time_t validity);
0054 
0055       std::string description() const;
0056       void setDescription(const std::string& description);
0057 
0058       std::string release() const;
0059       void setRelease(const std::string& release);
0060 
0061       boost::posix_time::ptime snapshotTime() const;
0062       void setSnapshotTime(const boost::posix_time::ptime& snapshotTime);
0063 
0064       // register a new insertion.
0065       // if checkType==true, the object type declared for the tag is verified to be the same type as the iov payloadObjectType record object type.
0066       void insert(const std::string& recordName, const std::string& tagName, bool checkType = false);
0067       void insert(const std::string& recordName,
0068                   const std::string& recordLabel,
0069                   const std::string& tagName,
0070                   bool checkType = false);
0071 
0072       // execute the update/intert queries and reset the buffer
0073       bool flush();
0074       // execute the update/intert queries and reset the buffer
0075       bool flush(const boost::posix_time::ptime& operationTime);
0076 
0077     private:
0078       void checkTransaction(const std::string& ctx);
0079 
0080     private:
0081       std::shared_ptr<GTEditorData> m_data;
0082       std::shared_ptr<SessionImpl> m_session;
0083     };
0084 
0085   }  // namespace persistency
0086 }  // namespace cond
0087 
0088 #endif