IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
ProcessingAlgorithmHdrDetailsMacros.h
Go to the documentation of this file.
1 // ProcessingAlgorithmHdrDetailsMacros.h:
3 // --------------------------------------
4 //
15 
16 #ifndef __IPSDKBASEPROCESSING_PROCESSINGALGORITHMHDRDETAILSMACROS_H__
17 #define __IPSDKBASEPROCESSING_PROCESSINGALGORITHMHDRDETAILSMACROS_H__
18 
20 #include <IPSDKBaseProcessing/Algorithm/BaseProcessingAlgorithm.h>
21 #include <IPSDKBaseProcessing/Algorithm/Function/AlgorithmFunctionSelector.h>
22 #include <IPSDKBaseProcessing/Algorithm/Function/DataTypeIdentifierColl.h>
23 #include <boost/make_shared.hpp>
24 
27 
30 #define IPSDK_ENUM_DATATYPE_IDENTIFIER_MACRO(z, n, _) \
31  BOOST_PP_CAT(dataTypeIdentifier, n)
32 
35 #define IPSDK_ENUM_INSTRUCTION_SET_MACRO(z, n, seq) \
36  ipsdk::eInstructionSet::BOOST_PP_SEQ_ELEM(n, seq)
37 
40 
44 #define IPSDK_INIT_IDENTIFIER_FROM_ATTRIBUTE_MACRO(r, _, idx, dataTypeId) \
45  BOOST_PP_CAT(IPSDK_IDENTIFIER_TYPE_, BOOST_PP_SEQ_ELEM(0, dataTypeId))() \
46  BOOST_PP_CAT(dataTypeIdentifier, idx); \
47  BOOST_PP_CAT(IPSDK_INIT_IDENTIFIER_FROM_ATTRIBUTE_, \
48  BOOST_PP_SEQ_ELEM(0, dataTypeId))( \
49  BOOST_PP_CAT(dataTypeIdentifier, idx), \
50  BOOST_PP_SEQ_ELEM(1, dataTypeId))
51 
54 
58 #define IPSDK_DECLARE_DATA_PARSER_MACRO(r, _, dataTypeId) \
59  boost::shared_ptr< \
60  BOOST_PP_CAT(IPSDK_PARSER_TYPE_, BOOST_PP_SEQ_ELEM(0, dataTypeId))( \
61  BOOST_PP_SEQ_ELEM(1, dataTypeId)) > \
62  BOOST_PP_CAT(IPSDK_PARSER_NAME_, BOOST_PP_SEQ_ELEM(0, dataTypeId))( \
63  BOOST_PP_SEQ_ELEM(1, dataTypeId));
64 
69 #define IPSDK_REGISTER_DATA_PARSER(dataType, attributeName, parserName, collName) \
70  if (BOOST_PP_CAT(_p, attributeName)->isInit() == true) { \
71  BOOST_PP_CAT(IPSDK_PARSER_CREATE_, dataType)(attributeName); \
72  collName.push_back(parserName); \
73  }
74 
78 #define IPSDK_INIT_DATA_PARSER_MACRO(r, collName, dataTypeId) \
79  IPSDK_REGISTER_DATA_PARSER(BOOST_PP_SEQ_ELEM(0, dataTypeId), \
80  BOOST_PP_SEQ_ELEM(1, dataTypeId), \
81  BOOST_PP_CAT(IPSDK_PARSER_NAME_, \
82  BOOST_PP_SEQ_ELEM(0, dataTypeId))( \
83  BOOST_PP_SEQ_ELEM(1, dataTypeId)), \
84  collName);
85 
89 #define IPSDK_CLEAR_DATA_PARSER(parserName) \
90  if (parserName.get() != 0) { \
91  parserName->clear(); \
92  parserName.reset(); \
93  }
94 
98 #define IPSDK_CLEAR_DATA_PARSER_MACRO(r, _, dataTypeId) \
99  IPSDK_CLEAR_DATA_PARSER( \
100  BOOST_PP_CAT(IPSDK_PARSER_NAME_, \
101  BOOST_PP_SEQ_ELEM(0, dataTypeId))( \
102  BOOST_PP_SEQ_ELEM(1, dataTypeId)))
103 
106 
110 #define IPSDK_ADD_TO_SEQ(s, value, seqElem) \
111  (value)(seqElem)
112 
116 #define IPSDK_TRANSFORM_SEQ(bufferTypeSeq, value) \
117  BOOST_PP_IF(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE((_)bufferTypeSeq)), \
118  BOOST_PP_SEQ_TRANSFORM(IPSDK_ADD_TO_SEQ, value, \
119  BOOST_PP_IF(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE((_)bufferTypeSeq)), \
120  bufferTypeSeq, (_))), )
121 
124 
125 // Generates the full enumerate name :
126 // eIBT_UInt8 -> ipsdk::image::eImageBufferType::eIBT_UInt8
127 #define IPSDKCUDA_TYPE_WITH_NAMESPACE(param)\
128 ipsdk::image::eImageBufferType::param
129 
130 // Declare the idx^th identifier
131 // The macro output is for instance :
132 //ipsdk::imaproc::ImageBufferTypeIdentifier identifier0;
133 #define ISPDKCUDA_DECLARE_IDENTIFIER_MACRO(r, data, idx, elem) \
134 ipsdk::imaproc::ImageBufferTypeIdentifier BOOST_PP_CAT(dataTypeIdentifier, idx);
135 
136 // Declare all the identifiers required for all the data types
137 #define ISPDKCUDA_DECLARE_IDENTIFIERS(ST)\
138 BOOST_PP_SEQ_FOR_EACH_I(ISPDKCUDA_DECLARE_IDENTIFIER_MACRO, _, ST)
139 
140 // Initialize the idx^th identifier
141 // The macro output is for instance :
142 //identifier0.init(ipsdk::image::eImageBufferType::eIBT_UInt8);
143 #define ISPDKCUDA_INIT_IDENTIFIER_MACRO(r, data, idx, elem) \
144 BOOST_PP_CAT(dataTypeIdentifier, idx).init(IPSDKCUDA_TYPE_WITH_NAMESPACE(elem));
145 
146 // Initialize all the identifiers required for all the data types
147 #define ISPDKCUDA_INIT_IDENTIFIERS(ST)\
148 BOOST_PP_SEQ_FOR_EACH_I(ISPDKCUDA_INIT_IDENTIFIER_MACRO, _, ST)
149 
150 
151 // Initialize the idx^th identifier from an image attribute
152 // The macro output is for instance :
153 //identifier0.init(_pInSubGpuImg->getImage()->getBufferType());
154 #define ISPDKCUDA_INIT_IDENTIFIER_FROM_ATTRIBUTE_MACRO(r, data, idx, elem) \
155 BOOST_PP_CAT(dataTypeIdentifier, idx).init(BOOST_PP_CAT(_p, elem)->getImage().getBufferType());
156 
157 // Initialize all the identifiers required for all the data types
158 // by using algorithm attribute
159 #define ISPDKCUDA_INIT_IDENTIFIERS_FROM_ATTRIBUTE(ST) \
160 BOOST_PP_SEQ_FOR_EACH_I(ISPDKCUDA_INIT_IDENTIFIER_FROM_ATTRIBUTE_MACRO, _, ST)
161 
164 
165 #endif // __IPSDKBASEPROCESSING_PROCESSINGALGORITHMHDRDETAILSMACROS_H__
Header part of macros set for processor class declaration.