16 #ifndef __IPSDKBASESHAPEANALYSIS_MEASURESRCMACROS_H__ 17 #define __IPSDKBASESHAPEANALYSIS_MEASURESRCMACROS_H__ 22 #include <boost/make_shared.hpp> 29 #define IPSDK_IMPLEMENT_INDIVISIBLE_MEASURE(libraryName, namespaceSeq, msrName, version) \ 30 IPSDK_IMPLEMENT_SERIAL_WITH_COPY(libraryName, namespaceSeq, BOOST_PP_CAT(msrName, Msr), version) \ 31 const BOOST_PP_CAT(msrName, Msr)::MsrParamsConstStorageType& \ 32 BOOST_PP_CAT(msrName, Msr)::getMsrParams() const { \ 33 if (_pMsrDerivedParams.get() == 0) \ 34 _pMsrDerivedParams = boost::static_pointer_cast<MsrParamsConstType>( \ 35 getMeasureInfo().getMsrParams()); \ 36 return _pMsrDerivedParams; \ 38 ipsdk::shape::analysis::MeasureResultPtr \ 39 BOOST_PP_CAT(msrName, Msr)::startProcessingDerived(const ipsdk::ipUInt64 defaultNbColorPlans, \ 40 const ipsdk::ipUInt64 nbEntities, \ 41 const bool bForceNbColorPlans, \ 42 const bool bWithIgnoredFirstElement) { \ 43 boost::shared_ptr<MsrResultType> pMsrResults(boost::make_shared<MsrResultType>()); \ 44 ipUInt64 usedNbColorPlans = 1; \ 45 if (bForceNbColorPlans == true) \ 46 usedNbColorPlans = defaultNbColorPlans; \ 48 if (hasColorDependency() == true) \ 49 usedNbColorPlans = defaultNbColorPlans; \ 51 pMsrResults->init(usedNbColorPlans, nbEntities); \ 55 BOOST_PP_CAT(msrName, Msr)::measureDerived(const ipUInt64 cPlanIdx) { \ 56 MsrResultType& msrResults = static_cast<MsrResultType&>(accessMeasureResult()); \ 57 MsrResultCollType& resultColl = msrResults.getColl(cPlanIdx); \ 58 BoolResult bRes = processMeasure(cPlanIdx, resultColl); \ 66 #define IPSDK_IMPLEMENT_GENERIC_MEASURE(libraryName, namespaceSeq, msrName, version) \ 67 IPSDK_IMPLEMENT_SERIAL_WITH_COPY(libraryName, namespaceSeq, BOOST_PP_CAT(msrName, Msr), version) \ 68 const BOOST_PP_CAT(msrName, Msr)::MsrParamsConstStorageType& \ 69 BOOST_PP_CAT(msrName, Msr)::getMsrParams() const { \ 70 if (_pMsrDerivedParams.get() == 0) \ 71 _pMsrDerivedParams = boost::static_pointer_cast<MsrParamsConstType>( \ 72 getMeasureInfo().getMsrParams()); \ 73 return _pMsrDerivedParams; \ 75 ipsdk::shape::analysis::MeasureResultPtr \ 76 BOOST_PP_CAT(msrName, Msr)::startProcessingDerived(const ipsdk::ipUInt64 defaultNbColorPlans, \ 77 const ipsdk::ipUInt64 nbEntities, \ 78 const bool bForceNbColorPlans, \ 79 const bool bWithIgnoredFirstElement) { \ 80 boost::shared_ptr<MsrResultType> pMsrResults(boost::make_shared<MsrResultType>()); \ 81 ipUInt64 usedNbColorPlans = 1; \ 82 if (bForceNbColorPlans == true) \ 83 usedNbColorPlans = defaultNbColorPlans; \ 85 if (hasColorDependency() == true) \ 86 usedNbColorPlans = defaultNbColorPlans; \ 88 pMsrResults->init(usedNbColorPlans, nbEntities); \ 92 BOOST_PP_CAT(msrName, Msr)::measureShapeDerived(const ipUInt64 cPlanIdx, \ 93 const ipsdk::ipUInt64 shapeIdx) { \ 94 MsrResultType& msrResults = static_cast<MsrResultType&>(accessMeasureResult()); \ 95 MsrResultValueType result; \ 96 BoolResult bRes = processMeasure(cPlanIdx, shapeIdx, result); \ 99 msrResults.getColl(cPlanIdx)[shapeIdx] = result; \ 105 #define IPSDK_IMPLEMENT_GEOMETRY2D_MEASURE(libraryName, namespaceSeq, msrName, version) \ 106 IPSDK_IMPLEMENT_SERIAL_WITH_COPY(libraryName, namespaceSeq, BOOST_PP_CAT(msrName, Msr), version) \ 107 const BOOST_PP_CAT(msrName, Msr)::MsrParamsConstStorageType& \ 108 BOOST_PP_CAT(msrName, Msr)::getMsrParams() const { \ 109 if (_pMsrDerivedParams.get() == 0) \ 110 _pMsrDerivedParams = boost::static_pointer_cast<MsrParamsConstType>( \ 111 getMeasureInfo().getMsrParams()); \ 112 return _pMsrDerivedParams; \ 114 ipsdk::shape::analysis::MeasureResultPtr \ 115 BOOST_PP_CAT(msrName, Msr)::startProcessingDerived(const ipsdk::ipUInt64 defaultNbColorPlans, \ 116 const ipsdk::ipUInt64 nbEntities, \ 117 const bool bForceNbColorPlans, \ 118 const bool bWithIgnoredFirstElement) { \ 119 boost::shared_ptr<MsrResultType> pMsrResults(boost::make_shared<MsrResultType>()); \ 120 pMsrResults->init(1, nbEntities); \ 121 return pMsrResults; \ 124 BOOST_PP_CAT(msrName, Msr)::measureShapeDerived(const ipsdk::ipUInt64 shapeIdx, \ 125 const ipsdk::geom::Shape2d& shape2d) { \ 126 MsrResultType& msrResults = static_cast<MsrResultType&>(accessMeasureResult()); \ 127 MsrResultValueType result; \ 128 BoolResult bRes = processMeasure(shapeIdx, shape2d, result); \ 131 msrResults.getColl()[shapeIdx] = result; \ 137 #define IPSDK_IMPLEMENT_GEOMETRY3D_MEASURE(libraryName, namespaceSeq, msrName, version) \ 138 IPSDK_IMPLEMENT_SERIAL_WITH_COPY(libraryName, namespaceSeq, BOOST_PP_CAT(msrName, Msr), version) \ 139 const BOOST_PP_CAT(msrName, Msr)::MsrParamsConstStorageType& \ 140 BOOST_PP_CAT(msrName, Msr)::getMsrParams() const { \ 141 if (_pMsrDerivedParams.get() == 0) \ 142 _pMsrDerivedParams = boost::static_pointer_cast<MsrParamsConstType>( \ 143 getMeasureInfo().getMsrParams()); \ 144 return _pMsrDerivedParams; \ 146 ipsdk::shape::analysis::MeasureResultPtr \ 147 BOOST_PP_CAT(msrName, Msr)::startProcessingDerived(const ipsdk::ipUInt64 defaultNbColorPlans, \ 148 const ipsdk::ipUInt64 nbEntities, \ 149 const bool bForceNbColorPlans, \ 150 const bool bWithIgnoredFirstElement) { \ 151 boost::shared_ptr<MsrResultType> pMsrResults(boost::make_shared<MsrResultType>()); \ 152 pMsrResults->init(1, nbEntities); \ 153 return pMsrResults; \ 156 BOOST_PP_CAT(msrName, Msr)::measureShapeDerived(const ipsdk::ipUInt64 shapeIdx, \ 157 const ipsdk::geom::Shape3d& shape3d) { \ 158 MsrResultType& msrResults = static_cast<MsrResultType&>(accessMeasureResult()); \ 159 MsrResultValueType result; \ 160 BoolResult bRes = processMeasure(shapeIdx, shape3d, result); \ 163 msrResults.getColl()[shapeIdx] = result; \ 169 #define IPSDK_IMPLEMENT_INTENSITY_MEASURE(libraryName, namespaceSeq, msrName, version) \ 170 IPSDK_IMPLEMENT_SERIAL_WITH_COPY(libraryName, namespaceSeq, BOOST_PP_CAT(msrName, Msr), version) \ 171 const BOOST_PP_CAT(msrName, Msr)::MsrParamsConstStorageType& \ 172 BOOST_PP_CAT(msrName, Msr)::getMsrParams() const { \ 173 if (_pMsrDerivedParams.get() == 0) \ 174 _pMsrDerivedParams = boost::static_pointer_cast<MsrParamsConstType>( \ 175 getMeasureInfo().getMsrParams()); \ 176 return _pMsrDerivedParams; \ 178 ipsdk::shape::analysis::MeasureResultPtr \ 179 BOOST_PP_CAT(msrName, Msr)::startProcessingDerived(const ipsdk::ipUInt64 defaultNbColorPlans, \ 180 const ipsdk::ipUInt64 nbEntities, \ 181 const bool bForceNbColorPlans, \ 182 const bool bWithIgnoredFirstElement) { \ 183 boost::shared_ptr<MsrResultType> pMsrResults(boost::make_shared<MsrResultType>()); \ 184 pMsrResults->init(defaultNbColorPlans, nbEntities); \ 185 if (nbEntities != 0) { \ 186 for (ipsdk::ipUInt64 cPlanIdx = 0; cPlanIdx<defaultNbColorPlans; ++cPlanIdx) \ 187 initMsrResults(cPlanIdx, nbEntities, bWithIgnoredFirstElement, pMsrResults->getColl(cPlanIdx)); \ 189 return pMsrResults; \ 192 BOOST_PP_CAT(msrName, Msr)::measureShapeDerived(const ipsdk::ipUInt64 cPlanIdx, \ 193 const ipsdk::ipUInt64 shapeIdx, \ 194 const ipsdk::geom::RowSegments& rowSegments, \ 195 const ipsdk::image::eImageBufferType& imageBufferType, \ 196 const ipsdk::ipUInt64 rowIdx, \ 197 const ipsdk::ipUInt64 zPlanIdx, \ 198 const void* pBuf) { \ 199 MsrResultType& msrResults = static_cast<MsrResultType&>(accessMeasureResult()); \ 200 MsrResultValueType& curMsrResult = msrResults.getColl(cPlanIdx)[shapeIdx]; \ 201 switch (imageBufferType.value()) { \ 202 case ipsdk::image::eImageBufferType::eIBT_Int8: { \ 203 typedef ipsdk::image::ImageType2Buffer<ipsdk::image::eImageBufferType::eIBT_Int8>::type DataType; \ 204 ipsdk::geom::RowSegments::const_iterator iterSeg = rowSegments.begin(); \ 205 while (iterSeg != rowSegments.end()) { \ 206 ipsdk::BoolResult bRes = processMeasure<DataType>(cPlanIdx, shapeIdx, \ 207 iterSeg->_startX, iterSeg->_endX, \ 208 imageBufferType, rowIdx, zPlanIdx, \ 209 static_cast<const DataType*>(pBuf), \ 217 case ipsdk::image::eImageBufferType::eIBT_UInt8: { \ 218 typedef ipsdk::image::ImageType2Buffer<ipsdk::image::eImageBufferType::eIBT_UInt8>::type DataType; \ 219 ipsdk::geom::RowSegments::const_iterator iterSeg = rowSegments.begin(); \ 220 while (iterSeg != rowSegments.end()) { \ 221 ipsdk::BoolResult bRes = processMeasure<DataType>(cPlanIdx, shapeIdx, \ 222 iterSeg->_startX, iterSeg->_endX, \ 223 imageBufferType, rowIdx, zPlanIdx, \ 224 static_cast<const DataType*>(pBuf), \ 232 case ipsdk::image::eImageBufferType::eIBT_Int16: { \ 233 typedef ipsdk::image::ImageType2Buffer<ipsdk::image::eImageBufferType::eIBT_Int16>::type DataType; \ 234 ipsdk::geom::RowSegments::const_iterator iterSeg = rowSegments.begin(); \ 235 while (iterSeg != rowSegments.end()) { \ 236 ipsdk::BoolResult bRes = processMeasure<DataType>(cPlanIdx, shapeIdx, \ 237 iterSeg->_startX, iterSeg->_endX, \ 238 imageBufferType, rowIdx, zPlanIdx, \ 239 static_cast<const DataType*>(pBuf), \ 247 case ipsdk::image::eImageBufferType::eIBT_UInt16: { \ 248 typedef ipsdk::image::ImageType2Buffer<ipsdk::image::eImageBufferType::eIBT_UInt16>::type DataType; \ 249 ipsdk::geom::RowSegments::const_iterator iterSeg = rowSegments.begin(); \ 250 while (iterSeg != rowSegments.end()) { \ 251 ipsdk::BoolResult bRes = processMeasure<DataType>(cPlanIdx, shapeIdx, \ 252 iterSeg->_startX, iterSeg->_endX, \ 253 imageBufferType, rowIdx, zPlanIdx, \ 254 static_cast<const DataType*>(pBuf), \ 262 case ipsdk::image::eImageBufferType::eIBT_Int32: { \ 263 typedef ipsdk::image::ImageType2Buffer<ipsdk::image::eImageBufferType::eIBT_Int32>::type DataType; \ 264 ipsdk::geom::RowSegments::const_iterator iterSeg = rowSegments.begin(); \ 265 while (iterSeg != rowSegments.end()) { \ 266 ipsdk::BoolResult bRes = processMeasure<DataType>(cPlanIdx, shapeIdx, \ 267 iterSeg->_startX, iterSeg->_endX, \ 268 imageBufferType, rowIdx, zPlanIdx, \ 269 static_cast<const DataType*>(pBuf), \ 277 case ipsdk::image::eImageBufferType::eIBT_UInt32: { \ 278 typedef ipsdk::image::ImageType2Buffer<ipsdk::image::eImageBufferType::eIBT_UInt32>::type DataType; \ 279 ipsdk::geom::RowSegments::const_iterator iterSeg = rowSegments.begin(); \ 280 while (iterSeg != rowSegments.end()) { \ 281 ipsdk::BoolResult bRes = processMeasure<DataType>(cPlanIdx, shapeIdx, \ 282 iterSeg->_startX, iterSeg->_endX, \ 283 imageBufferType, rowIdx, zPlanIdx, \ 284 static_cast<const DataType*>(pBuf), \ 292 case ipsdk::image::eImageBufferType::eIBT_Real32: { \ 293 typedef ipsdk::image::ImageType2Buffer<ipsdk::image::eImageBufferType::eIBT_Real32>::type DataType; \ 294 ipsdk::geom::RowSegments::const_iterator iterSeg = rowSegments.begin(); \ 295 while (iterSeg != rowSegments.end()) { \ 296 ipsdk::BoolResult bRes = processMeasure<DataType>(cPlanIdx, shapeIdx, \ 297 iterSeg->_startX, iterSeg->_endX, \ 298 imageBufferType, rowIdx, zPlanIdx, \ 299 static_cast<const DataType*>(pBuf), \ 307 case ipsdk::image::eImageBufferType::eIBT_Binary: { \ 308 typedef ipsdk::image::ImageType2Buffer<ipsdk::image::eImageBufferType::eIBT_Binary>::type DataType; \ 309 ipsdk::geom::RowSegments::const_iterator iterSeg = rowSegments.begin(); \ 310 while (iterSeg != rowSegments.end()) { \ 311 ipsdk::BoolResult bRes = processMeasure<DataType>(cPlanIdx, shapeIdx, \ 312 iterSeg->_startX, iterSeg->_endX, \ 313 imageBufferType, rowIdx, zPlanIdx, \ 314 static_cast<const DataType*>(pBuf), \ 322 case ipsdk::image::eImageBufferType::eIBT_Label16: { \ 323 typedef ipsdk::image::ImageType2Buffer<ipsdk::image::eImageBufferType::eIBT_Label16>::type DataType; \ 324 ipsdk::geom::RowSegments::const_iterator iterSeg = rowSegments.begin(); \ 325 while (iterSeg != rowSegments.end()) { \ 326 ipsdk::BoolResult bRes = processMeasure<DataType>(cPlanIdx, shapeIdx, \ 327 iterSeg->_startX, iterSeg->_endX, \ 328 imageBufferType, rowIdx, zPlanIdx, \ 329 static_cast<const DataType*>(pBuf), \ 337 case ipsdk::image::eImageBufferType::eIBT_Label32: { \ 338 typedef ipsdk::image::ImageType2Buffer<ipsdk::image::eImageBufferType::eIBT_Label32>::type DataType; \ 339 ipsdk::geom::RowSegments::const_iterator iterSeg = rowSegments.begin(); \ 340 while (iterSeg != rowSegments.end()) { \ 341 ipsdk::BoolResult bRes = processMeasure<DataType>(cPlanIdx, shapeIdx, \ 342 iterSeg->_startX, iterSeg->_endX, \ 343 imageBufferType, rowIdx, zPlanIdx, \ 344 static_cast<const DataType*>(pBuf), \ 352 case ipsdk::image::eImageBufferType::eIBT_Label8: { \ 353 typedef ipsdk::image::ImageType2Buffer<ipsdk::image::eImageBufferType::eIBT_Label8>::type DataType; \ 354 ipsdk::geom::RowSegments::const_iterator iterSeg = rowSegments.begin(); \ 355 while (iterSeg != rowSegments.end()) { \ 356 ipsdk::BoolResult bRes = processMeasure<DataType>(cPlanIdx, shapeIdx, \ 357 iterSeg->_startX, iterSeg->_endX, \ 358 imageBufferType, rowIdx, zPlanIdx, \ 359 static_cast<const DataType*>(pBuf), \ 368 ipsdk::LogMessageFormater logMsgFormater( \ 369 ipsdk::shape::analysis::getIPSDKBaseShapeAnalysisLogMessageManager()); \ 370 logMsgFormater[ipsdk::shape::analysis::eMeasureMessage::eInvalidImageBufferType] % \ 371 imageBufferType.str(); \ 372 return ipsdk::BoolResult(false, logMsgFormater.string()); \ 377 BOOST_PP_CAT(msrName, Msr)::collectResultsDerived(const ipsdk::UInt64Vector& resultIndexColl, \ 378 const ipsdk::shape::analysis::BaseMeasure& subMeasure) { \ 379 MsrResultType& msrResults = static_cast<MsrResultType&>(accessMeasureResult()); \ 380 const MsrResultType& subMsrResults = static_cast<const MsrResultType&>(subMeasure.getMeasureResult()); \ 381 const ipsdk::ipUInt64 nbColorPlans = getNbColorPlans(); \ 382 for (ipsdk::ipUInt64 cPlanIdx = 0; cPlanIdx<nbColorPlans; ++cPlanIdx) { \ 383 ipsdk::BoolResult bRes = processResults(cPlanIdx, resultIndexColl, \ 384 subMsrResults.getColl(cPlanIdx), msrResults.getColl(cPlanIdx)); \ 394 #endif // __IPSDKBASESHAPEANALYSIS_MEASURESRCMACROS_H__ Log messages description.
Logger api for library IPSDKBaseShapeAnalysis.
Source part of macros set for class serialization.