IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
CudaSubImageSplit.h
1 // CudaSubImageSplit.h:
3 // --------------------
4 //
14 
15 #ifndef __IPSDKIMAGEPROCESSING_CUDASUBIMAGESPLIT_H__
16 #define __IPSDKIMAGEPROCESSING_CUDASUBIMAGESPLIT_H__
17 
18 // suppression warnings
19 // warning C4251: 'ipsdk::imaproc::CudaSubImageSplit<InOutStorageType>::_subImageSplitType' : class 'ipsdk::imaproc::eSubImageSplitType' needs to have dll-interface to be used by clients of class 'ipsdk::imaproc::CudaSubImageSplit<InOutStorageType>'
20 #pragma warning (push)
21 #pragma warning (disable : 4251)
22 
24 #include <IPSDKImageProcessing/DataSplit/SubImage/BaseCudaSubImageSplit.h>
27 #include <IPSDKUtil/Tools/ProcessingResult.h>
28 
29 namespace ipsdk {
30 namespace imaproc {
31 
34 
35 template <typename TProcessor, typename TAttribute>
36 class CudaSubImageSplit : public BaseCudaSubImageSplit<typename TAttribute::StorageType>
37 {
38  // predefined public types
39 public:
41  typedef TProcessor ProcessorType;
42 
44  typedef TAttribute AttributeType;
45 
47  typedef typename TAttribute::StorageType InputStorageType;
48 
50  typedef typename TAttribute::StorageType OutputStorageType;
51 
52 public:
56  ~CudaSubImageSplit() {}
58 
59 // methods from SubImageSplit
60 public:
62  const std::string& getAttributeName() const;
63 
65  const std::string& getAttributeToolTip() const;
66 
73  void init(const eSubImageSplitType& subImageSplitType,
74  const ipUInt64 nbDevices,
75  const InputStorageType& pImage);
76 
81  void init(const eSubImageSplitType& subImageSplitType,
82  const InputStorageType& pImage);
83 
84 protected:
86  bool checkProcessorType(const processor::BaseProcessor& processor);
87 
92  const ipUInt32 elementIdx,
93  const core::BaseRequestOrigin& requestOrigin);
94 };
95 
98 
99 template <typename TProcessor, typename TAttribute>
100 inline const std::string&
102 {
103  return TAttribute::getObjectNameStr();
104 }
105 
106 template <typename TProcessor, typename TAttribute>
107 inline const std::string&
109 {
110  return TAttribute::getToolTipStr();
111 }
112 
113 //template <typename TProcessor, typename TAttribute>
114 //inline void
115 //CudaSubImageSplit<TProcessor, TAttribute>::init(const eSubImageSplitType& subImageSplitType,
116 // const ipUInt64 nbDevices,
117 // const InputStorageType& pImage)
118 //{
119 // // call of base class initialization method
120 // this->initBase(subImageSplitType, nbDevices, pImage);
121 //}
122 
123 template <typename TProcessor, typename TAttribute>
124 inline void
126  const InputStorageType& pImage)
127 {
128  // call of base class initialization method
129  this->initBase(subImageSplitType, pImage);
130 }
131 
132 template <typename TProcessor, typename TAttribute>
133 inline bool
135 {
136  // check for consistency between processor and attribute
138  "This attribute is not part of processor class");
139 
140  return dynamic_cast<const TProcessor*>(&processor) != 0;
141 }
142 
143 template <typename TProcessor, typename TAttribute>
144 inline BoolResult
146  const ipUInt32 elementIdx,
147  const core::BaseRequestOrigin& requestOrigin)
148 {
149  // cast of input processor object
150  TProcessor& tProcessor = static_cast<TProcessor&>(processor);
151 
152  // retrieve sub image associated to element
153  OutputStorageType pSubImage;
154  BoolResult bGetSubImageRes = this->getSubImage(elementIdx, pSubImage);
155  if (bGetSubImageRes == true) {
156 
157  // update of processor attribute value
158  tProcessor.TProcessor::template set<TAttribute>(pSubImage);
159 
160  return true;
161  }
162  else
163  return bGetSubImageRes;
164 }
165 
166 } // end of namespace imaproc
167 } // end of namespace ipsdk
168 
169 #pragma warning (pop)
170 
171 #endif // __IPSDKIMAGEPROCESSING_CUDASUBIMAGESPLIT_H__
172 
bool checkProcessorType(const processor::BaseProcessor &processor)
check processor type in derived class
Definition: CudaSubImageSplit.h:134
Class allowing to encapsulate a typed process result associated to a string description.
Definition: ProcessingResult.h:28
eSubImageSplitType
Enumerate describing sub image geometry split type.
Definition: SubImageSplitTypes.h:32
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
uint64_t ipUInt64
Base types definition.
Definition: BaseTypes.h:55
TProcessor ProcessorType
processor type associated to object
Definition: CudaSubImageSplit.h:41
void init(const eSubImageSplitType &subImageSplitType, const ipUInt64 nbDevices, const InputStorageType &pImage)
initialization method for splitted objects
Predefined types for sub image split operations.
TAttribute::StorageType InputStorageType
input data type for split operation
Definition: CudaSubImageSplit.h:47
Definition of import/export macro for library.
BoolResult processAttribute(processor::BaseProcessor &processor, const ipUInt32 elementIdx, const core::BaseRequestOrigin &requestOrigin)
initialize processor attribute associate to split operation for a given element index ...
Definition: CudaSubImageSplit.h:145
Base class for processor class.
Definition: BaseProcessor.h:43
structure allowing to check whether a given attribute exists in attribute collection information ...
Definition: AttributeCollInfoCheckMacros.h:131
const std::string & getAttributeName() const
retrieve attribute name associated to split operation
Definition: CudaSubImageSplit.h:101
TAttribute::StorageType OutputStorageType
output data type for split operation
Definition: CudaSubImageSplit.h:50
const std::string & getAttributeToolTip() const
retrieve attribute tooltip associated to split operation
Definition: CudaSubImageSplit.h:108
Base class for request origin description.
Definition: BaseRequestOrigin.h:28
Base class used to split image into sub images for data dispatch on NVIdia graphic cards...
Definition: BaseCudaSubImageSplit.h:37
Class used to split image into sub images for data dispatch on NVidia graphic cards.
Definition: CudaSubImageSplit.h:36
Predefined type for image management.
TAttribute AttributeType
attribute type associated to object
Definition: CudaSubImageSplit.h:44
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53