The Gaudi Framework
master (37c0b60a)
DataObjectHandleBase.h
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
#ifndef GAUDIHIVE_DATAOBJECTHANDLEBASE_H
12
#define GAUDIHIVE_DATAOBJECTHANDLEBASE_H
13
14
#include <mutex>
15
16
#include <
GaudiKernel/DataHandle.h
>
17
#include <
GaudiKernel/IDataProviderSvc.h
>
18
#include <
GaudiKernel/IMessageSvc.h
>
19
#include <
GaudiKernel/IProperty.h
>
20
#include <
GaudiKernel/SmartIF.h
>
21
22
//---------------------------------------------------------------------------
23
33
//---------------------------------------------------------------------------
34
35
class
DataObjectHandleBase
:
public
Gaudi::DataHandle
{
36
37
public
:
38
DataObjectHandleBase
(
DataObjID
k,
Gaudi::DataHandle::Mode
a,
IDataHandleHolder
*
owner
);
39
DataObjectHandleBase
(
std::string
k,
Gaudi::DataHandle::Mode
a,
IDataHandleHolder
*
owner
);
40
41
~DataObjectHandleBase
()
override
;
42
DataObjectHandleBase
(
const
DataObjectHandleBase
& ) =
delete
;
43
DataObjectHandleBase
(
DataObjectHandleBase
&& );
44
DataObjectHandleBase
&
operator=
(
const
DataObjectHandleBase
& );
45
48
template
<
class
OWNER,
class
K,
typename
= std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
49
inline
DataObjectHandleBase
( OWNER*
owner
,
Gaudi::DataHandle::Mode
m
,
std::string
name
, K
key
= {},
50
std::string
doc =
""
)
51
:
DataObjectHandleBase
(
std::move
(
key
),
m
,
owner
) {
52
auto
p =
owner
->declareProperty(
std::move
(
name
), *
this
,
std::move
( doc ) );
53
p->template setOwnerType<OWNER>();
54
}
55
56
friend
std::ostream
&
operator<<
(
std::ostream
& str,
const
DataObjectHandleBase
& d );
57
59
bool
isOptional
()
const
{
return
m_optional
; }
60
void
setOptional
(
bool
optional =
true
) {
m_optional
= optional; }
61
62
bool
isValid
()
const
;
63
64
protected
:
65
bool
init
()
override
;
66
67
DataObject
*
fetch
()
const
;
68
69
protected
:
70
SmartIF<IDataProviderSvc>
m_EDS
;
71
SmartIF<IMessageSvc>
m_MS
;
72
73
bool
m_init
=
false
;
74
bool
m_optional
=
false
;
75
};
76
77
#endif
IDataHandleHolder
Definition:
IDataHandleHolder.h:24
std::string
STL class.
std::move
T move(T... args)
DataObjectHandleBase::m_EDS
SmartIF< IDataProviderSvc > m_EDS
Definition:
DataObjectHandleBase.h:70
DataObjectHandleBase::m_MS
SmartIF< IMessageSvc > m_MS
Definition:
DataObjectHandleBase.h:71
DataObjectHandleBase::setOptional
void setOptional(bool optional=true)
Definition:
DataObjectHandleBase.h:60
DataObjectHandleBase::m_optional
bool m_optional
Definition:
DataObjectHandleBase.h:74
Gaudi::DataHandle
Definition:
DataHandle.h:38
DataObjectHandleBase::operator=
DataObjectHandleBase & operator=(const DataObjectHandleBase &)
Definition:
DataObjectHandleBase.cpp:36
IMessageSvc.h
IDataProviderSvc.h
DataObjectHandleBase::isOptional
bool isOptional() const
Check if the data object declared is optional for the algorithm.
Definition:
DataObjectHandleBase.h:59
DataObjectHandleBase::DataObjectHandleBase
DataObjectHandleBase(OWNER *owner, Gaudi::DataHandle::Mode m, std::string name, K key={}, std::string doc="")
Autodeclaring constructor with property name, mode, key and documentation.
Definition:
DataObjectHandleBase.h:49
SmartIF.h
Gaudi::DataHandle::owner
virtual IDataHandleHolder * owner() const
Definition:
DataHandle.h:53
DataObjectHandleBase::m_init
bool m_init
Definition:
DataObjectHandleBase.h:73
Gaudi::Units::m
constexpr double m
Definition:
SystemOfUnits.h:108
std::ostream
STL class.
DataObjectHandleBase::DataObjectHandleBase
DataObjectHandleBase(const DataObjectHandleBase &)=delete
DataObjectHandleBase
DataObjectHandleBase GaudiKernel/DataObjectHandleBase.h.
Definition:
DataObjectHandleBase.h:35
SmartIF< IDataProviderSvc >
DataObjID
Definition:
DataObjID.h:47
DataObjectHandleBase::fetch
DataObject * fetch() const
Definition:
DataObjectHandleBase.cpp:61
Gaudi::DataHandle::Mode
Mode
Definition:
DataHandle.h:40
ConditionsStallTest.name
name
Definition:
ConditionsStallTest.py:77
DataObjectHandleBase::operator<<
friend std::ostream & operator<<(std::ostream &str, const DataObjectHandleBase &d)
Definition:
DataObjectHandleBase.cpp:104
DataObject
Definition:
DataObject.h:36
DataHandle.h
DataObjectHandleBase::~DataObjectHandleBase
~DataObjectHandleBase() override
Definition:
DataObjectHandleBase.cpp:58
DataObjectHandleBase::DataObjectHandleBase
DataObjectHandleBase(DataObjID k, Gaudi::DataHandle::Mode a, IDataHandleHolder *owner)
Definition:
DataObjectHandleBase.cpp:47
IProperty.h
DataObjectHandleBase::isValid
bool isValid() const
Definition:
DataObjectHandleBase.cpp:100
ProduceConsume.key
key
Definition:
ProduceConsume.py:84
DataObjectHandleBase::init
bool init() override
Definition:
DataObjectHandleBase.cpp:75
GaudiKernel
include
GaudiKernel
DataObjectHandleBase.h
Generated on Thu Dec 19 2024 15:35:01 for The Gaudi Framework by
1.8.18