IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
MeasureHdrMacros.h
Go to the documentation of this file.
1 // MeasureHdrMacros.h:
3 // -------------------
4 //
15 
16 #ifndef __IPSDKBASESHAPEANALYSIS_MEASUREHDRMACROS_H__
17 #define __IPSDKBASESHAPEANALYSIS_MEASUREHDRMACROS_H__
18 
19 #include <IPSDKBaseShapeAnalysis/Measure/BaseIndivisibleMeasure.h>
20 #include <IPSDKBaseShapeAnalysis/Measure/BaseGenericMeasure.h>
21 #include <IPSDKBaseShapeAnalysis/Measure/BaseGeometry2dMeasure.h>
22 #include <IPSDKBaseShapeAnalysis/Measure/BaseGeometry3dMeasure.h>
23 #include <IPSDKBaseShapeAnalysis/Measure/BaseIntensityMeasure.h>
24 #include <IPSDKBaseShapeAnalysis/Measure/Result/ValueMeasureResult.h>
25 #include <IPSDKBaseShapeAnalysis/Measure/Result/CollMeasureResult.h>
26 #include <IPSDKUtil/Tools/ProcessingResult.h>
27 #include <boost/type_traits/is_same.hpp>
28 #include <boost/static_assert.hpp>
29 
32 
35 #define IPSDK_DECLARE_MEASURE_BODY(libraryName, msrName) \
36  IPSDK_DECLARE_SERIAL_WITH_COPY(libraryName, BOOST_PP_CAT(msrName, Msr)) \
37  friend boost::shared_ptr<BOOST_PP_CAT(msrName, Msr)> \
38  boost::make_shared<BOOST_PP_CAT(msrName, Msr)>(); \
39 protected: \
40  BOOST_PP_CAT(msrName, Msr)(); \
41 public: \
42  ~BOOST_PP_CAT(msrName, Msr)(); \
43  typedef BOOST_PP_CAT(msrName, MsrInfo) MsrInfoType; \
44  typedef MsrInfoType::MsrResultType MsrResultType; \
45  typedef MsrResultType::CollType MsrResultCollType; \
46  typedef MsrInfoType::MsrParamsType MsrParamsType; \
47  typedef MsrInfoType::MsrParamsConstType MsrParamsConstType; \
48  typedef MsrInfoType::MsrParamsStorageType MsrParamsStorageType; \
49  typedef MsrInfoType::MsrParamsConstStorageType MsrParamsConstStorageType; \
50 private: \
51  static void internalValidateMsrInfo() { \
52  BOOST_STATIC_ASSERT_MSG((boost::is_same<BaseClassType, \
53  ipsdk::shape::analysis::MsrProcessingPolicyClass< \
54  BOOST_PP_CAT(msrName, MsrInfo)::g_msrProcessingPolicy>::Type> \
55  ::value), \
56  "Information and measure class type mismatch"); \
57  } \
58  ipsdk::shape::analysis::MeasureResultPtr \
59  startProcessingDerived(const ipsdk::ipUInt64 defaultNbColorPlans, \
60  const ipsdk::ipUInt64 nbEntities, \
61  const bool bForceNbColorPlans, \
62  const bool bWithIgnoredFirstElement); \
63  const MsrParamsConstStorageType& getMsrParams() const; \
64  mutable MsrParamsConstStorageType _pMsrDerivedParams;
65 
68 
71 #define IPSDK_DECLARE_INDIVISIBLE_MEASURE(libraryName, msrName) \
72 class IPSDK_LIB_API(libraryName) BOOST_PP_CAT(msrName, Msr) : \
73  public ipsdk::shape::analysis::BaseIndivisibleMeasure { \
74 public: \
75  typedef ipsdk::shape::analysis::BaseIndivisibleMeasure BaseClassType; \
76  IPSDK_DECLARE_MEASURE_BODY(libraryName, msrName) \
77 protected: \
78  ipsdk::BoolResult \
79  processMeasure(const ipsdk::ipUInt64 cPlanIdx, \
80  MsrResultCollType& resultColl); \
81  ipsdk::BoolResult \
82  measureDerived(const ipsdk::ipUInt64 cPlanIdx);
83 
86 
89 #define IPSDK_DECLARE_GENERIC_MEASURE(libraryName, msrName) \
90 class IPSDK_LIB_API(libraryName) BOOST_PP_CAT(msrName, Msr) : \
91  public ipsdk::shape::analysis::BaseGenericMeasure { \
92 public: \
93  typedef ipsdk::shape::analysis::BaseGenericMeasure BaseClassType; \
94  IPSDK_DECLARE_MEASURE_BODY(libraryName, msrName) \
95 public: \
96  typedef MsrResultType::ValueType MsrResultValueType; \
97 protected: \
98  ipsdk::BoolResult \
99  processMeasure(const ipsdk::ipUInt64 cPlanIdx, \
100  const ipsdk::ipUInt64 shapeIdx, \
101  MsrResultValueType& result); \
102  ipsdk::BoolResult \
103  measureShapeDerived(const ipsdk::ipUInt64 cPlanIdx, \
104  const ipsdk::ipUInt64 shapeIdx);
105 
108 
111 #define IPSDK_DECLARE_GEOMETRY2D_MEASURE(libraryName, msrName) \
112 class IPSDK_LIB_API(libraryName) BOOST_PP_CAT(msrName, Msr) : \
113  public ipsdk::shape::analysis::BaseGeometry2dMeasure { \
114 public: \
115  typedef ipsdk::shape::analysis::BaseGeometry2dMeasure BaseClassType; \
116  IPSDK_DECLARE_MEASURE_BODY(libraryName, msrName) \
117 public: \
118  typedef MsrResultType::ValueType MsrResultValueType; \
119 protected: \
120  ipsdk::BoolResult \
121  processMeasure(const ipsdk::ipUInt64 shapeIdx, \
122  const ipsdk::geom::Shape2d& shape2d, \
123  MsrResultValueType& result); \
124  ipsdk::BoolResult \
125  measureShapeDerived(const ipsdk::ipUInt64 shapeIdx, \
126  const ipsdk::geom::Shape2d& shape2d);
127 
130 #define IPSDK_DECLARE_GEOMETRY3D_MEASURE(libraryName, msrName) \
131 class IPSDK_LIB_API(libraryName) BOOST_PP_CAT(msrName, Msr) : \
132  public ipsdk::shape::analysis::BaseGeometry3dMeasure { \
133 public: \
134  typedef ipsdk::shape::analysis::BaseGeometry3dMeasure BaseClassType; \
135  IPSDK_DECLARE_MEASURE_BODY(libraryName, msrName) \
136 public: \
137  typedef MsrResultType::ValueType MsrResultValueType; \
138 protected: \
139  ipsdk::BoolResult \
140  processMeasure(const ipsdk::ipUInt64 shapeIdx, \
141  const ipsdk::geom::Shape3d& shape3d, \
142  MsrResultValueType& result); \
143  ipsdk::BoolResult \
144  measureShapeDerived(const ipsdk::ipUInt64 shapeIdx, \
145  const ipsdk::geom::Shape3d& shape3d);
146 
149 
152 #define IPSDK_DECLARE_INTENSITY_MEASURE(libraryName, msrName) \
153 class IPSDK_LIB_API(libraryName) BOOST_PP_CAT(msrName, Msr) : \
154  public ipsdk::shape::analysis::BaseIntensityMeasure { \
155 public: \
156  typedef ipsdk::shape::analysis::BaseIntensityMeasure BaseClassType; \
157  IPSDK_DECLARE_MEASURE_BODY(libraryName, msrName) \
158 public: \
159  typedef MsrResultType::ValueType MsrResultValueType; \
160 protected: \
161  void initMsrResults(const ipsdk::ipUInt64 cPlanIdx, \
162  const ipsdk::ipUInt64 nbEntities, \
163  const bool bWithIgnoredFirstElement, \
164  MsrResultCollType& msrResults); \
165  template <typename T> \
166  ipsdk::BoolResult \
167  processMeasure(const ipsdk::ipUInt64 cPlanIdx, \
168  const ipsdk::ipUInt64 shapeIdx, \
169  const ipsdk::ipUInt64 startX, \
170  const ipsdk::ipUInt64 endX, \
171  const ipsdk::image::eImageBufferType& imageBufferType, \
172  const ipsdk::ipUInt64 rowIdx, \
173  const ipsdk::ipUInt64 zPlanIdx, \
174  const T* pBuf, \
175  MsrResultValueType& result); \
176  ipsdk::BoolResult \
177  measureShapeDerived(const ipsdk::ipUInt64 cPlanIdx, \
178  const ipsdk::ipUInt64 shapeIdx, \
179  const ipsdk::geom::RowSegments& rowSegments, \
180  const ipsdk::image::eImageBufferType& imageBufferType, \
181  const ipsdk::ipUInt64 rowIdx, \
182  const ipsdk::ipUInt64 zPlanIdx, \
183  const void* pBuf); \
184  ipsdk::BoolResult \
185  processResults(const ipsdk::ipUInt64 cPlanIdx, \
186  const ipsdk::UInt64Vector& resultIndexColl, \
187  const MsrResultCollType& collectedMsrResults, \
188  MsrResultCollType& msrResults); \
189  ipsdk::BoolResult \
190  collectResultsDerived(const ipsdk::UInt64Vector& resultIndexColl, \
191  const ipsdk::shape::analysis::BaseMeasure& subMeasure);
192 
195 
196 #endif // __IPSDKBASESHAPEANALYSIS_MEASUREHDRMACROS_H__