ATLAS Offline Software
Loading...
Searching...
No Matches
Control
AthCUDA
AthCUDAInterfaces
src
StreamHolder.cxx
Go to the documentation of this file.
1
//
2
// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
//
4
5
// Local include(s).
6
#include "
AthCUDAInterfaces/StreamHolder.h
"
7
#include "
AthCUDAInterfaces/IStreamPoolSvc.h
"
8
9
namespace
AthCUDA
{
10
11
StreamHolder::StreamHolder
()
12
:
m_stream
( nullptr ),
m_pool
( nullptr ) {
13
14
}
15
16
StreamHolder::StreamHolder
(
void
* stream,
IStreamPoolSvc
*
pool
)
17
:
m_stream
( stream ),
m_pool
(
pool
) {
18
19
}
20
21
StreamHolder::StreamHolder
(
StreamHolder
&& parent )
22
:
m_stream
( parent.
m_stream
),
m_pool
( parent.
m_pool
) {
23
24
parent.m_stream =
nullptr
;
25
parent.m_pool =
nullptr
;
26
}
27
28
StreamHolder::~StreamHolder
() {
29
30
if
( (
m_stream
!=
nullptr
) && (
m_pool
!=
nullptr
) ) {
31
m_pool
->yieldStream( *
this
);
32
}
33
}
34
35
StreamHolder
&
StreamHolder::operator=
(
StreamHolder
&& rhs ) {
36
37
// Check if anything needs to be done.
38
if
(
this
== &rhs ) {
39
return
*
this
;
40
}
41
42
// Perform the move.
43
m_stream
= rhs.m_stream;
44
rhs.m_stream =
nullptr
;
45
m_pool
= rhs.m_pool;
46
rhs.m_pool =
nullptr
;
47
return
*
this
;
48
}
49
50
StreamHolder::operator bool()
const
{
51
52
return
(
m_stream
!=
nullptr
);
53
}
54
55
}
// namespace AthCUDA
IStreamPoolSvc.h
StreamHolder.h
AthCUDA::IStreamPoolSvc
Interface for a CUDA stream pool service.
Definition
IStreamPoolSvc.h:24
AthCUDA::StreamHolder::operator=
StreamHolder & operator=(const StreamHolder &)=delete
Copy assignment operator.
AthCUDA::StreamHolder::m_pool
IStreamPoolSvc * m_pool
The pool that this holder is attached to.
Definition
StreamHolder.h:55
AthCUDA::StreamHolder::m_stream
void * m_stream
The managed stream.
Definition
StreamHolder.h:53
AthCUDA::StreamHolder::~StreamHolder
~StreamHolder()
Destructor.
Definition
StreamHolder.cxx:28
AthCUDA::StreamHolder::StreamHolder
StreamHolder()
Friend declaration(s).
Definition
StreamHolder.cxx:11
AthCUDA
Definition
Info.h:14
pool
pool namespace
Definition
libname.h:15
Generated on
for ATLAS Offline Software by
1.14.0