IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
CudaPlanStorage.h
Go to the documentation of this file.
1 // CudaPlanStorage.h:
3 // ------------------
4 //
14 
15 #ifndef __IPSDKIMAGE_CUDAPLANSTORAGE_H__
16 #define __IPSDKIMAGE_CUDAPLANSTORAGE_H__
17 
18 // suppression warning
19 // warning C4251: 'ipsdk::image::CudaPlanStorage::_pBuffer' : class 'boost::shared_ptr<ipsdk::image::CudaBuffer>' needs to have dll-interface to be used by clients of class 'ipsdk::processor::BaseOutputOptionalValueAttribute<T>'
20 // warning C4251: 'ipsdk::image::CudaPlanStorage::_dataType' : class 'boost::shared_ptr<ipsdk::image::CudaBuffer>' needs to have dll-interface to be used by clients of class 'ipsdk::processor::BaseOutputOptionalValueAttribute<T>'
21 #pragma warning (push)
22 #pragma warning (disable : 4251)
23 
24 //#include <IPSDKImage/IPSDKImageExports.h>
25 #include <IPSDKImage/Storage/BasePlanStorage.h>
26 #include <IPSDKImage/Geometry/BaseImageGeometry.h>
27 #include <IPSDKImage/Storage/Buffers/CudaBuffer.cuh>
28 
29 namespace ipsdk {
30 namespace image {
31 
34 
36 {
37  // declare dynamic serializable class
39 
40 // predefined public types
41 public:
43  static const ePlanStorageType::domain g_planStorageType = ePlanStorageType::ePST_Gpu;
44 
46  typedef boost::shared_ptr<CudaPlanStorage> CudaPlanStoragePtr;
47  typedef boost::shared_ptr<const CudaPlanStorage> CudaPlanStorageConstPtr;
48 
50  typedef boost::shared_ptr<CudaBuffer> CudaBufferPtr;
51  typedef boost::shared_ptr<const CudaBuffer> CudaBufferConstPtr;
52 
53 public:
57  ~CudaPlanStorage();
59 
60 // methods
61 public:
63  ePlanStorageType getPlanStorageType() const;
64 
67  BoolResult init(const ImagePlanGeometry& geometry, const ipUInt64 deviceIdx = 0);
68 
71  eImageAccessMode getAccessMode() const;
72 
76  const void* getDataPtr() const;
77  void* getDataPtr();
79 
82  bool canBeRemotlyAccessed() const;
83 
87  bool hasBinary8BitsStorage() const;
88 
91  ipUInt64 getFullBufferSize() const;
92 
98  const CudaBuffer& getBuffer() const;
99  CudaBuffer& getBuffer();
101 
105  ipUInt64 getDeviceIdx() const;
107 
110  BoolResult resizePlan(const ImagePlanGeometry& planGeometry);
111 
114  BoolResult resize(const ImagePlanGeometry& geometry, const ipUInt64 deviceIdx = 0);
115 
116 protected:
119  BoolResult resizePlan(const ImagePlanGeometry& geometry, const ipUInt64 deviceIdx = 0);
120 
123  BoolResult readRawData(const ipUInt64 startOffset,
124  const ipUInt64 size,
125  void* pData) const;
126 
131  BoolResult writeRawData(const ipUInt64 startOffset,
132  const ipUInt64 size,
133  const void* pData);
134 
136  void clearPlanData();
137 
138 // attributes
139 protected:
142 
145 
148 
151 };
152 
155 
156 inline ePlanStorageType
158 {
159  return g_planStorageType;
160 }
161 
164 
165 } // end of namespace image
166 } // end of namespace ipsdk
167 
168 #pragma warning (pop)
169 
170 #endif // __IPSDKIMAGE_CUDAPLANSTORAGE_H__
boost::shared_ptr< CudaBuffer > CudaBufferPtr
Shared pointer to CudaBuffer.
Definition: CudaPlanStorage.h:50
ipUInt64 _bufferBaseSize
Element size (in Bytes)
Definition: CudaPlanStorage.h:144
static const ePlanStorageType::domain g_planStorageType
plan storage type
Definition: CudaPlanStorage.h:43
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
boost::shared_ptr< CudaPlanStorage > CudaPlanStoragePtr
Shared pointer to GpuPlanStorage.
Definition: CudaPlanStorage.h:46
uint64_t ipUInt64
Base types definition.
Definition: BaseTypes.h:55
GPU plan storage.
Definition: PlanStorageTypes.h:45
CudaBufferPtr _pBuffer
buffer associated to storage
Definition: CudaPlanStorage.h:141
ipUInt64 _deviceIdx
Element size (in Bytes)
Definition: CudaPlanStorage.h:147
IPSDKIMAGE_API ImageGeometryPtr geometry(const eImageBufferType &imageBufferType, const ipUInt64 sizeX, const ipUInt64 sizeY, const VolumeGeometry &volumeGeometry, const ColorGeometry &colorGeometry, const TemporalGeometry &temporalGeometry)
create an image geometry
Base class for image plan data storage.
Definition: BasePlanStorage.h:38
#define IPSDK_DECLARE_SERIAL_WITHOUT_COPY(libraryName, className)
macro enabling serialization on class
Definition: SerializationHdrMacro.h:79
eDataType
Enumerate describing a base type.
Definition: BaseTypes.h:77
#define IPSDKIMAGE_API
Import/Export macro for library IPSDKImage.
Definition: IPSDKImageExports.h:27
Class encapsulating image plan geometry.
Definition: ImagePlanGeometry.h:33
ePlanStorageType
Enumerate describing plan storage type.
Definition: PlanStorageTypes.h:33
ePlanStorageType getPlanStorageType() const
retrieve plan storage type
Definition: CudaPlanStorage.h:157
Definition: CudaPlanStorage.h:35
eImageAccessMode
Image access mode.
Definition: ImageTypes.h:110
eDataType _dataType
Data buffer type.
Definition: CudaPlanStorage.h:150