File indexing completed on 2024-04-06 12:23:21
0001 #ifndef PhysicsTools_CondLiteIO_RecordWriter_h
0002 #define PhysicsTools_CondLiteIO_RecordWriter_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include <map>
0023
0024 #include "FWCore/Utilities/interface/TypeIDBase.h"
0025 #include "DataFormats/Provenance/interface/ESRecordAuxiliary.h"
0026
0027
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;
0038
0039 const RecordWriter& operator=(const RecordWriter&) = delete;
0040
0041 virtual ~RecordWriter();
0042
0043 struct DataBuffer {
0044 const void* pBuffer_;
0045 TBranch* branch_;
0046 edm::TypeIDBase trueType_;
0047 };
0048
0049
0050
0051
0052
0053 void update(const void* iData, const std::type_info& iType, const char* iLabel);
0054
0055
0056 void fill(const edm::ESRecordAuxiliary&);
0057
0058 void write();
0059
0060 private:
0061
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 }
0069
0070 #endif