The Gaudi Framework
v27r0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
implements.h
Go to the documentation of this file.
1
#ifndef GAUDIKERNEL_IMPLEMENTS_H
2
#define GAUDIKERNEL_IMPLEMENTS_H
3
4
#include "GaudiKernel/IInterface.h"
5
#include <atomic>
6
8
template
<
typename
... Interfaces>
9
struct
GAUDI_API
implements
:
virtual
public
extend_interfaces
<Interfaces...> {
11
using
base_class =
implements
<Interfaces...>;
13
using
extend_interfaces_base =
extend_interfaces
<Interfaces...>;
14
using
iids =
typename
extend_interfaces_base::ext_iids;
15
16
public
:
18
void
*i_cast(
const
InterfaceID
&tid)
const override
{
19
return
Gaudi::iid_cast
(tid,iids{},
this
);
20
}
22
StatusCode
queryInterface(
const
InterfaceID
&ti,
void
**
pp
)
override
{
23
if
(!pp)
return
StatusCode::FAILURE
;
24
*pp =
Gaudi::iid_cast
(ti,iids{},
this
);
25
if
(!*pp)
return
StatusCode::FAILURE
;
/* cast failed */
26
this->addRef();
27
return
StatusCode::SUCCESS
;
28
}
30
std::vector<std::string>
getInterfaceNames
()
const override
{
31
return
Gaudi::getInterfaceNames
( iids{} );
32
}
34
implements
() =
default
;
36
implements
(
const
implements
&
/*other*/
) : m_refCount{0} {}
38
implements
& operator=(
const
implements
&
/*other*/
) {
return
*
this
; }
40
~
implements
()
override
=
default
;
41
42
public
:
44
unsigned
long
addRef()
override
{
return
++m_refCount; }
46
unsigned
long
release()
override
{
47
/* Avoid to decrement 0 */
48
auto
count = ( m_refCount ? --m_refCount : m_refCount.load() );
49
if
(count == 0)
delete
this
;
50
return
count;
51
}
53
unsigned
long
refCount()
const override
{
return
m_refCount.load(); }
54
55
protected
:
57
std::atomic_ulong m_refCount = {0};
58
};
59
60
61
template
<
typename
I1>
using
implements1
=
implements<I1>
;
62
template
<
typename
I1,
63
typename
I2>
using
implements2
=
implements<I1,I2>
;
64
template
<
typename
I1,
65
typename
I2,
66
typename
I3>
using
implements3
=
implements<I1,I2,I3>
;
67
template
<
typename
I1,
68
typename
I2,
69
typename
I3,
70
typename
I4>
using
implements4
=
implements<I1,I2,I3,I4>
;
71
72
#endif
/* GAUDIKERNEL_IMPLEMENTS_H_ */
implements
Base class used to implement the interfaces.
Definition:
implements.h:9
GAUDI_API
#define GAUDI_API
Definition:
Kernel.h:107
Gaudi::getInterfaceNames
std::vector< std::string > getInterfaceNames(Gaudi::interface_list< Is...>)
Definition:
IInterface.h:177
compareOutputFiles.pp
tuple pp
Definition:
compareOutputFiles.py:417
InterfaceID
Interface ID class.
Definition:
IInterface.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition:
StatusCode.h:26
extend_interfaces
Base class to be used to extend an interface.
Definition:
extend_interfaces.h:11
StatusCode::FAILURE
Definition:
StatusCode.h:29
StatusCode::SUCCESS
Definition:
StatusCode.h:30
Gaudi::iid_cast
void * iid_cast(const InterfaceID &tid, Gaudi::interface_list< Is...>, P *ptr)
Definition:
IInterface.h:182
GaudiKernel
GaudiKernel
implements.h
Generated on Thu Feb 4 2016 16:42:12 for The Gaudi Framework by
1.8.9.1