IOPool
Common
interface
CustomStreamer.h
Go to the documentation of this file.
1
#ifndef IOPool_Common_CustomStreamer_h
2
#define IOPool_Common_CustomStreamer_h
3
4
#include <string>
5
#include "TClass.h"
6
#include "TClassStreamer.h"
7
#include "TClassRef.h"
8
#include "
FWCore/Utilities/interface/TypeID.h
"
9
#include "TBuffer.h"
10
11
namespace
edm
{
12
template
<
typename
T>
13
class
CustomStreamer
:
public
TClassStreamer {
14
public
:
15
typedef
T
element_type
;
16
CustomStreamer
();
17
void
operator()
(TBuffer &R__b,
void
*objp);
18
private
:
19
std::string
className_
;
20
TClassRef
cl_
;
21
};
22
23
template
<
typename
T>
24
CustomStreamer<T>::CustomStreamer
() :
25
className_(
TypeID
(typeid(
T
)).
className
()),
26
cl_(className_.c_str())
27
{}
28
29
template
<
typename
T>
30
void
31
CustomStreamer<T>::operator()
(TBuffer &R__b,
void
*objp) {
32
if
(R__b.IsReading()) {
33
cl_->ReadBuffer(R__b, objp);
34
}
else
{
35
cl_->WriteBuffer(R__b, objp);
36
}
37
}
38
39
template
<
typename
T>
40
void
41
SetCustomStreamer
() {
42
TClass *
cl
= TClass::GetClass(
typeid
(
T
));
43
if
(
cl
->GetStreamer() == 0) {
44
cl
->AdoptStreamer(
new
CustomStreamer<T>
());
45
}
46
}
47
48
template
<
typename
T>
49
void
50
SetCustomStreamer
(
T
const
&) {
51
TClass *
cl
= TClass::GetClass(
typeid
(
T
));
52
if
(
cl
->GetStreamer() == 0) {
53
cl
->AdoptStreamer(
new
CustomStreamer<T>
());
54
}
55
}
56
}
57
58
#endif
edm::CustomStreamer::operator()
void operator()(TBuffer &R__b, void *objp)
Definition:
CustomStreamer.h:31
edm::CustomStreamer::cl_
TClassRef cl_
Definition:
CustomStreamer.h:20
edm
HLT enums.
Definition:
AlignableModifier.h:19
TypeID.h
GetRecoTauVFromDQM_MC_cff.cl
cl
Definition:
GetRecoTauVFromDQM_MC_cff.py:38
edm::CustomStreamer::element_type
T element_type
Definition:
CustomStreamer.h:15
edm::CustomStreamer::className_
std::string className_
Definition:
CustomStreamer.h:19
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::TypeID
Definition:
TypeID.h:22
T
long double T
Definition:
Basic3DVectorLD.h:48
edm::CustomStreamer::CustomStreamer
CustomStreamer()
Definition:
CustomStreamer.h:24
className
std::string className(const T &t)
Definition:
ClassName.h:31
edm::CustomStreamer
Definition:
CustomStreamer.h:13
edm::SetCustomStreamer
void SetCustomStreamer()
Definition:
CustomStreamer.h:41
Generated for CMSSW Reference Manual by
1.8.16