IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
MeasureInfoSrcMacros.h
Go to the documentation of this file.
1 // MeasureInfoSrcMacros.h:
3 // -----------------------
4 //
15 
16 #ifndef __IPSDKBASESHAPEANALYSIS_MEASUREINFOSRCMACROS_H__
17 #define __IPSDKBASESHAPEANALYSIS_MEASUREINFOSRCMACROS_H__
18 
20 #include <IPSDKBaseShapeAnalysis/Measure/Info/MeasureInfoFactory.h>
22 #include <boost/make_shared.hpp>
23 
26 
29 #define IPSDK_IMPLEMENT_MEASURE_INFO(libraryName, namespaceSeq, msrName, eMsgEnum, version) \
30  IPSDK_IMPLEMENT_SERIAL_WITHOUT_COPY(libraryName, namespaceSeq, \
31  BOOST_PP_CAT(msrName, MsrInfo), version) \
32  IPSDK_IMPLEMENT_TOOLTIP(libraryName, BOOST_PP_CAT(msrName, MsrInfo), eMsgEnum) \
33  ipsdk::shape::analysis::MeasureInfoPtr BOOST_PP_CAT(msrName, MsrInfo)::createMeasureInfo() { \
34  return boost::make_shared<BOOST_PP_CAT(msrName, MsrInfo)>(); \
35  } \
36  ipsdk::shape::analysis::MeasurePtr BOOST_PP_CAT(msrName, MsrInfo)::createMeasureDerived() const { \
37  return boost::make_shared<BOOST_PP_CAT(msrName, Msr)>(); \
38  } \
39  namespace ipsdk { \
40  namespace shape { \
41  namespace analysis { \
42  template <> \
43  struct ShapeMeasureInfoRegistrator<BOOST_PP_CAT(msrName, MsrInfo)> { \
44  static MeasureInfoPtr measureCreatorFcn() { \
45  return BOOST_PP_CAT(msrName, MsrInfo)::createMeasureInfo(); \
46  } \
47  ShapeMeasureInfoRegistrator() \
48  { \
49  MeasureInfoFactory& factory = MeasureInfoFactory::getInstance(); \
50  factory.registerMsrInfo(BOOST_PP_STRINGIZE(BOOST_PP_CAT(msrName, Msr)), \
51  measureCreatorFcn); \
52  } \
53  ~ShapeMeasureInfoRegistrator() \
54  { \
55  ipsdk::shape::analysis::MeasureInfoFactory& factory = \
56  ipsdk::shape::analysis::MeasureInfoFactory::getInstance(); \
57  factory.unRegisterMsrInfo(BOOST_PP_STRINGIZE(BOOST_PP_CAT(msrName, Msr))); \
58  } \
59  static ShapeMeasureInfoRegistrator g_classRegistrator; \
60  }; \
61  ShapeMeasureInfoRegistrator<BOOST_PP_CAT(msrName, MsrInfo)> \
62  ShapeMeasureInfoRegistrator<BOOST_PP_CAT(msrName, MsrInfo)>::g_classRegistrator; \
63  }}}
64 
65 
68 
69 #endif // __IPSDKBASESHAPEANALYSIS_MEASUREINFOSRCMACROS_H__
Source part of macros set for ToolTip class declaration.
Source part of macros set for class serialization.