Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
IOPool
Common
interface
getWrapperBasePtr.h
Go to the documentation of this file.
1
#ifndef IOPool_Common_getWrapperBasePtr_h
2
#define IOPool_Common_getWrapperBasePtr_h
3
4
#include <cassert>
5
#include <memory>
6
#include "TClass.h"
7
#include "
DataFormats/Common/interface/WrapperBase.h
"
8
9
namespace
edm {
10
inline
11
std::unique_ptr<WrapperBase>
getWrapperBasePtr
(
void
*
p
,
int
offset
) {
12
// A union is used to avoid possible copies during the triple cast that would otherwise be needed.
13
// std::unique_ptr<WrapperBase> edp(static_cast<WrapperBase *>(static_cast<void *>(static_cast<unsigned char *>(p) + branchInfo.offsetToWrapperBase_)));
14
union
{
15
void
* vp;
16
unsigned
char
* ucp;
17
WrapperBase
* edp;
18
} pointerUnion;
19
assert(p !=
nullptr
);
20
pointerUnion.vp =
p
;
21
pointerUnion.ucp +=
offset
;
22
std::unique_ptr<WrapperBase> edp(pointerUnion.edp);
23
return
(std::move(edp));
24
}
25
}
26
27
#endif
evf::evtn::offset
unsigned int offset(bool)
Definition:
GlobalEventNumber.cc:66
WrapperBase.h
AlCaHLTBitMon_ParallelJobs.p
tuple p
Definition:
AlCaHLTBitMon_ParallelJobs.py:152
edm::WrapperBase
Definition:
WrapperBase.h:16
edm::getWrapperBasePtr
std::unique_ptr< WrapperBase > getWrapperBasePtr(void *p, int offset)
Definition:
getWrapperBasePtr.h:11
Generated for CMSSW Reference Manual by
1.8.5