Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-30 02:33:19

0001 #ifndef PhysicsTools_CondLiteIO_RecordWriter_h
0002 #define PhysicsTools_CondLiteIO_RecordWriter_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     CondLiteIO
0006 // Class  :     RecordWriter
0007 //
0008 /**\class RecordWriter RecordWriter.h PhysicsTools/CondLiteIO/interface/RecordWriter.h
0009 
0010  Description: Used to write the contents of an EventSetup Record to a TFile
0011 
0012  Usage:
0013     <usage>
0014 
0015 */
0016 //
0017 // Original Author:  Chris Jones
0018 //         Created:  Wed Dec  9 17:00:53 CST 2009
0019 //
0020 
0021 // system include files
0022 #include <map>
0023 // user include files
0024 #include "FWCore/Utilities/interface/TypeIDBase.h"
0025 #include "DataFormats/Provenance/interface/ESRecordAuxiliary.h"
0026 
0027 // forward declarations
0028 class TFile;
0029 class TBranch;
0030 class TTree;
0031 
0032 namespace fwlite {
0033   class RecordWriter {
0034   public:
0035     RecordWriter(const char* iName, TFile* iFile);
0036 
0037     RecordWriter(const RecordWriter&) = delete;  // stop default
0038 
0039     const RecordWriter& operator=(const RecordWriter&) = delete;  // stop default
0040 
0041     virtual ~RecordWriter();
0042 
0043     struct DataBuffer {
0044       const void* pBuffer_;
0045       TBranch* branch_;
0046       edm::TypeIDBase trueType_;
0047     };
0048     // ---------- const member functions ---------------------
0049 
0050     // ---------- static member functions --------------------
0051 
0052     // ---------- member functions ---------------------------
0053     void update(const void* iData, const std::type_info& iType, const char* iLabel);
0054 
0055     //call update before calling write
0056     void fill(const edm::ESRecordAuxiliary&);
0057 
0058     void write();
0059 
0060   private:
0061     // ---------- member data --------------------------------
0062     TTree* tree_;
0063     edm::ESRecordAuxiliary aux_;
0064     edm::ESRecordAuxiliary* pAux_;
0065     TBranch* auxBranch_;
0066     std::map<std::pair<edm::TypeIDBase, std::string>, DataBuffer> idToBuffer_;
0067   };
0068 }  // namespace fwlite
0069 
0070 #endif