Juggler
Juggling algorithms and event processing using gaudi framework
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
i
j
k
l
m
o
p
q
r
s
t
u
v
Functions
a
b
d
e
f
g
i
j
m
p
r
s
v
Variables
c
e
g
k
l
o
p
q
t
u
Typedefs
b
c
d
f
g
i
m
p
s
t
u
v
Enumerations
Enumerator
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
k
m
n
o
p
r
s
t
u
v
~
Functions
a
b
c
d
e
f
g
h
i
k
m
o
p
r
s
t
~
Variables
b
c
d
e
h
i
m
n
p
r
s
t
u
Typedefs
c
d
f
g
i
k
m
p
r
t
v
Enumerations
Enumerator
Related Functions
Files
File List
File Members
All
Functions
Typedefs
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Modules
Pages
DataWrapper.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: LGPL-3.0-or-later
2
// Copyright (C) 2022 Whitney Armstrong
3
4
#ifndef JUGBASE_DATAWRAPPER_H
5
#define JUGBASE_DATAWRAPPER_H
6
7
#include <type_traits>
8
9
// Include files
10
#include <GaudiKernel/DataObject.h>
11
#include <podio/CollectionBase.h>
12
13
/** Data wrapper.
14
*
15
* \ingroup base
16
*/
17
class
GAUDI_API
DataWrapperBase
:
public
DataObject {
18
public
:
19
// ugly hack to circumvent the usage of boost::any yet
20
// DataSvc would need a templated register method
21
virtual
podio::CollectionBase*
collectionBase
() = 0;
22
virtual
~DataWrapperBase
(){};
23
};
24
25
/** Data wrapper.
26
*
27
* \ingroup base
28
*/
29
template
<
class
T>
30
class
GAUDI_API
DataWrapper
:
public
DataWrapperBase
{
31
public
:
32
DataWrapper
() :
DataWrapperBase
(), m_data(nullptr){};
33
virtual
~
DataWrapper
();
34
35
const
T*
getData
() {
return
m_data; }
36
void
setData
(T* data) { m_data = data; }
37
/// try to cast to collectionBase; may return nullptr;
38
virtual
podio::CollectionBase*
collectionBase
();
39
40
private
:
41
T* m_data;
42
};
43
44
template
<
class
T>
45
DataWrapper<T>::~DataWrapper
() {
46
if
(m_data !=
nullptr
)
delete
m_data;
47
}
48
49
template
<
class
T>
50
podio::CollectionBase*
DataWrapper<T>::collectionBase
() {
51
if
(std::is_base_of<podio::CollectionBase, T>::value) {
52
return
reinterpret_cast<
podio::CollectionBase*
>
(m_data);
53
}
54
return
nullptr
;
55
}
56
57
#endif
DataWrapper
Definition:
DataWrapper.h:30
DataWrapperBase::collectionBase
virtual podio::CollectionBase * collectionBase()=0
DataWrapperBase
Definition:
DataWrapper.h:17
DataWrapper::~DataWrapper
virtual ~DataWrapper()
Definition:
DataWrapper.h:45
DataWrapper::setData
void setData(T *data)
Definition:
DataWrapper.h:36
DataWrapper::DataWrapper
DataWrapper()
Definition:
DataWrapper.h:32
DataWrapper::collectionBase
virtual podio::CollectionBase * collectionBase()
try to cast to collectionBase; may return nullptr;
Definition:
DataWrapper.h:50
DataWrapperBase::~DataWrapperBase
virtual ~DataWrapperBase()
Definition:
DataWrapper.h:22
DataWrapper::getData
const T * getData()
Definition:
DataWrapper.h:35
JugBase
JugBase
DataWrapper.h
Generated by
1.8.18