The Gaudi Framework
master (37c0b60a)
extends.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 GAUDIKERNEL_EXTENDS_H
12
#define GAUDIKERNEL_EXTENDS_H
13
14
#include <
GaudiKernel/IInterface.h
>
15
19
template
<
typename
BASE,
typename
... Interfaces>
20
class
GAUDI_API
extends
:
public
BASE,
virtual
public
extend_interfaces
<Interfaces...> {
21
22
public
:
24
using
base_class
=
extends
;
26
using
extend_interfaces_base
=
extend_interfaces
<Interfaces...>;
28
using
BASE::BASE;
29
31
void
*
i_cast
(
const
InterfaceID
& tid )
const override
{
32
using
iids =
typename
extend_interfaces_base::ext_iids
;
33
void
* ptr =
Gaudi::iid_cast
( tid, iids{}, this );
34
return
ptr ? ptr : BASE::i_cast( tid );
35
}
36
38
StatusCode
queryInterface
(
const
InterfaceID
& ti,
void
**
pp
)
override
{
39
if
( !
pp
)
return
StatusCode::FAILURE
;
40
using
iids =
typename
extend_interfaces_base::ext_iids
;
41
*
pp
=
Gaudi::iid_cast
( ti, iids{}, this );
42
// if cast failed, try the base class
43
if
( !*
pp
)
return
BASE::queryInterface( ti,
pp
);
44
this->addRef();
45
return
StatusCode::SUCCESS
;
46
}
47
49
std::vector<std::string>
getInterfaceNames
()
const override
{
50
using
iids =
typename
extend_interfaces_base::ext_iids
;
51
auto
vb =
BASE::getInterfaceNames
();
52
auto
vi =
Gaudi::getInterfaceNames
( iids{} );
53
// start with base, and move the rest...
54
vb.
insert
( vb.end(),
std::make_move_iterator
( vi.begin() ),
std::make_move_iterator
( vi.end() ) );
55
return
vb;
56
}
57
};
58
59
template
<
typename
BASE,
typename
I1>
60
using
extends1
=
extends<BASE, I1>
;
61
template
<
typename
BASE,
typename
I1,
typename
I2>
62
using
extends2
=
extends<BASE, I1, I2>
;
63
template
<
typename
BASE,
typename
I1,
typename
I2,
typename
I3>
64
using
extends3
=
extends<BASE, I1, I2, I3>
;
65
template
<
typename
BASE,
typename
I1,
typename
I2,
typename
I3,
typename
I4>
66
using
extends4
=
extends<BASE, I1, I2, I3, I4>
;
67
68
#endif
/* GAUDIKERNEL_EXTENDS_H */
extend_interfaces< Interfaces... >::ext_iids
typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type ext_iids
take union of the ext_iids of all Interfaces...
Definition:
extend_interfaces.h:26
std::vector< std::string >
extend_interfaces
Base class to be used to extend an interface.
Definition:
extend_interfaces.h:15
extends::i_cast
void * i_cast(const InterfaceID &tid) const override
Implementation of IInterface::i_cast.
Definition:
extends.h:31
StatusCode
Definition:
StatusCode.h:65
IInterface.h
CommonMessaging
Definition:
CommonMessaging.h:66
extends
Base class used to extend a class implementing other interfaces.
Definition:
extends.h:20
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition:
StatusCode.h:100
Gaudi::iid_cast
void * iid_cast(const InterfaceID &tid, Gaudi::interface_list< Is... >, P *ptr)
Definition:
IInterface.h:177
Gaudi::getInterfaceNames
std::vector< std::string > getInterfaceNames(Gaudi::interface_list< Is... >)
Definition:
IInterface.h:172
std::vector::insert
T insert(T... args)
extends::queryInterface
StatusCode queryInterface(const InterfaceID &ti, void **pp) override
Implementation of IInterface::queryInterface.
Definition:
extends.h:38
extends::getInterfaceNames
std::vector< std::string > getInterfaceNames() const override
Implementation of IInterface::getInterfaceNames.
Definition:
extends.h:49
InterfaceID
Definition:
IInterface.h:39
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition:
StatusCode.h:101
std::make_move_iterator
T make_move_iterator(T... args)
compareOutputFiles.pp
pp
Definition:
compareOutputFiles.py:507
GAUDI_API
#define GAUDI_API
Definition:
Kernel.h:81
GaudiKernel
include
GaudiKernel
extends.h
Generated on Thu Dec 19 2024 15:35:01 for The Gaudi Framework by
1.8.18