ITK
4.4.0
Insight Segmentation and Registration Toolkit
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
ITK
Modules
Core
GPUCommon
include
itkGPUDataManager.h
Go to the documentation of this file.
1
/*=========================================================================
2
*
3
* Copyright Insight Software Consortium
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0.txt
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*
17
*=========================================================================*/
18
19
#ifndef __itkGPUDataManager_h
20
#define __itkGPUDataManager_h
21
22
#include "
itkObject.h
"
23
#include "
itkDataObject.h
"
24
#include "
itkObjectFactory.h
"
25
#include "
itkOpenCLUtil.h
"
26
#include "
itkGPUContextManager.h
"
27
#include "
itkSimpleFastMutexLock.h
"
28
#include "
itkMutexLockHolder.h
"
29
30
namespace
itk
31
{
43
class
ITK_EXPORT
GPUDataManager
:
public
Object
//DataObject//
44
{
46
friend
class
GPUKernelManager
;
47
48
public
:
49
50
typedef
GPUDataManager
Self
;
51
typedef
Object
Superclass
;
52
typedef
SmartPointer<Self>
Pointer
;
53
typedef
SmartPointer<const Self>
ConstPointer
;
54
55
itkNewMacro(
Self
);
56
itkTypeMacro(
GPUDataManager
,
Object
);
57
58
typedef
MutexLockHolder<SimpleFastMutexLock>
MutexHolderType
;
59
61
void
SetBufferSize(
unsigned
int
num );
62
63
unsigned
int
GetBufferSize
() {
64
return
m_BufferSize;
65
}
66
67
void
SetBufferFlag( cl_mem_flags flags );
68
69
void
SetCPUBufferPointer(
void
* ptr );
70
71
void
SetCPUDirtyFlag(
bool
isDirty );
72
73
void
SetGPUDirtyFlag(
bool
isDirty );
74
77
void
SetCPUBufferDirty();
78
81
void
SetGPUBufferDirty();
82
83
bool
IsCPUBufferDirty
() {
84
return
m_IsCPUBufferDirty;
85
}
86
87
bool
IsGPUBufferDirty
() {
88
return
m_IsGPUBufferDirty;
89
}
90
92
virtual
void
UpdateCPUBuffer();
93
95
virtual
void
UpdateGPUBuffer();
96
97
void
Allocate();
98
99
void
SetCurrentCommandQueue(
int
queueid );
100
101
int
GetCurrentCommandQueueID();
102
104
bool
Update();
105
107
virtual
void
Graft(
const
GPUDataManager
* data);
108
110
virtual
void
Initialize();
111
113
cl_mem* GetGPUBufferPointer();
114
116
void
* GetCPUBufferPointer();
117
118
protected
:
119
120
GPUDataManager
();
121
virtual
~
GPUDataManager
();
122
virtual
void
PrintSelf(std::ostream & os,
Indent
indent)
const
;
123
124
private
:
125
126
GPUDataManager
(
const
Self&);
//purposely not implemented
127
void
operator=(
const
Self&);
128
129
protected
:
130
131
unsigned
int
m_BufferSize
;
// # of bytes
132
133
GPUContextManager
*
m_ContextManager
;
134
135
int
m_CommandQueueId
;
136
138
cl_mem_flags
m_MemFlags
;
139
141
cl_mem
m_GPUBuffer
;
142
void
*
m_CPUBuffer
;
143
145
bool
m_IsGPUBufferDirty
;
146
bool
m_IsCPUBufferDirty
;
147
149
SimpleFastMutexLock
m_Mutex
;
150
};
151
152
}
// namespace itk
153
154
#endif
155
Generated on Mon May 13 2013 00:51:09 for ITK by
1.8.3.1