CMS 3D CMS Logo

ROOTDeserializer.h
Go to the documentation of this file.
1 #ifndef FWCore_SharedMemory_ROOTDeserializer_h
2 #define FWCore_SharedMemory_ROOTDeserializer_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/SharedMemory
6 // Class : ROOTDeserializer
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: 22/01/2020
19 //
20 
21 // system include files
22 #include "TClass.h"
23 #include "TBufferFile.h"
24 
25 // user include files
26 
27 // forward declarations
28 
29 namespace edm::shared_memory {
30  template <typename T, typename READBUFFER>
32  public:
33  ROOTDeserializer(READBUFFER& iBuffer)
34  : buffer_{iBuffer}, class_{TClass::GetClass(typeid(T))}, bufferFile_(TBuffer::kRead) {}
35 
36  ROOTDeserializer(const ROOTDeserializer&) = delete;
37  const ROOTDeserializer& operator=(const ROOTDeserializer&) = delete;
39  const ROOTDeserializer& operator=(ROOTDeserializer&&) = delete;
40 
41  // ---------- const member functions ---------------------
42 
43  // ---------- member functions ---------------------------
45  T value;
46  if (previousBufferIdentifier_ != buffer_.bufferIdentifier()) {
47  auto buff = buffer_.buffer();
48  bufferFile_.SetBuffer(buff.first, buff.second, kFALSE);
49  previousBufferIdentifier_ = buffer_.bufferIdentifier();
50  }
51 
52  class_->ReadBuffer(bufferFile_, &value);
53  bufferFile_.Reset();
54  return value;
55  }
56 
57  private:
58  // ---------- member data --------------------------------
59  READBUFFER& buffer_;
60  TClass* const class_;
61  TBufferFile bufferFile_;
63  };
64 } // namespace edm::shared_memory
65 
66 #endif
const ROOTDeserializer & operator=(const ROOTDeserializer &)=delete
Definition: value.py:1
long double T