IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
GpuPlanStorage.h
1 // GpuPlanStorage.h:
3 // --------------------
4 //
14 /*
15 #ifndef __IPSDKIMAGE_GPUPLANSTORAGE_H__
16 #define __IPSDKIMAGE_GPUPLANSTORAGE_H__
17 
18 // suppression warnings
19 // warning C4251: 'ipsdk::image::GpuPlanStorage::_buffer' : class 'boost::compute::vector<ipsdk::ipUInt8,boost::compute::buffer_allocator<T>>' nécessite une interface DLL pour être utilisé(e) par les clients de class 'ipsdk::image::GpuPlanStorage'
20 #pragma warning (push)
21 #pragma warning (disable : 4251)
22 
23 #include <IPSDKImage/Storage/BasePlanStorage.h>
24 #include <IPSDKHardware/Gpu/GpuDescription.h>
25 #include <IPSDKImage/Geometry/BaseImageGeometry.h>
26 #include <boost/compute/container/vector.hpp>
27 #include <boost/compute.hpp>
28 
29 namespace ipsdk {
30 namespace image {
31 
34 
35 class IPSDKIMAGE_API GpuPlanStorage : public BasePlanStorage
36 {
37  // declare dynamic serializable class
38  IPSDK_DECLARE_SERIAL_WITHOUT_COPY(IPSDKImage, GpuPlanStorage);
39 
40 // predefined public types
41 public:
43  static const ePlanStorageType::domain g_planStorageType = ePlanStorageType::ePST_Gpu;
44 
46  typedef boost::shared_ptr<GpuPlanStorage> GpuPlanStoragePtr;
47  typedef boost::shared_ptr<const GpuPlanStorage> GpuPlanStorageConstPtr;
48 
50  typedef boost::compute::buffer GpuBuffer;
51  typedef boost::shared_ptr<GpuBuffer> GpuBufferPtr;
52  typedef boost::shared_ptr<const GpuBuffer> GpuBufferConstPtr;
53 
54 public:
57  GpuPlanStorage();
58  ~GpuPlanStorage();
60 
61 // methods
62 public:
64  ePlanStorageType getPlanStorageType() const;
65 
68  BoolResult init(const ImagePlanGeometry& planGeometry, const ipUInt64 deviceIdx = 0);
69 
72  BoolResult init(const BaseImageGeometry& geometry, const ipUInt64 nbDevices, const ipUInt64 deviceIdx = 0);
73 
76  eImageAccessMode getAccessMode() const;
77 
81  const void* getDataPtr() const;
82  void* getDataPtr();
84 
87  bool canBeRemotlyAccessed() const;
88 
92  bool hasBinary8BitsStorage() const;
93 
96  ipUInt64 getFullBufferSize() const;
97 
103  const GpuBuffer& getBuffer() const;
104  GpuBuffer& getBuffer();
106 
108  boost::compute::command_queue& getQueue();
109 
112  BoolResult resize(const ImagePlanGeometry& planGeometry);
113 
118  BoolResult resize(const BaseImageGeometry& geometry, const ipUInt64 nbDevices);
119 
121  const VolumeGeometry& getVolumeGeometry() const;
122 
124  const ColorGeometry& getColorGeometry() const;
125 
127  const TemporalGeometry& getTemporalGeometry() const;
128 
129 protected:
132  BoolResult resizePlan(const ImagePlanGeometry& planGeometry);
133 
138  BoolResult resizePlan(const BaseImageGeometry& geometry, const ipUInt64 nbDevices);
139 
142  BoolResult readRawData(const ipUInt64 startOffset,
143  const ipUInt64 size,
144  void* pData) const;
145 
150  BoolResult writeRawData(const ipUInt64 startOffset,
151  const ipUInt64 size,
152  const void* pData);
153 
155  void clearPlanData();
156 
157 // attributes
158 protected:
160  GpuBufferPtr _pBuffer;
161 
163  ipUInt64 _bufferBaseSize;
164 
166  eDataType _dataType;
167 
169  ipsdk::hard::GpuDescription* _pGpuDescription;
170 
172  ipsdk::ipUInt64 _deviceIdx;
173 
175  VolumeGeometry _volumeGeometry;
176  ColorGeometry _colorGeometry;
177  TemporalGeometry _temporalGeometry;
178 };
179 
182 
183 inline ePlanStorageType
184 GpuPlanStorage::getPlanStorageType() const
185 {
186  return g_planStorageType;
187 }
188 
191 
192 } // end of namespace image
193 } // end of namespace ipsdk
194 
195 #pragma warning (pop)
196 
197 #endif // __IPSDKIMAGE_GPUPLANSTORAGE_H__
198 */