IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
DataItemAttributeHdrMacros.h
Go to the documentation of this file.
1 // DataItemAttributeHdrMacros.h:
3 // -----------------------------
4 //
15 
16 #ifndef __IPSDKBASEPROCESSING_DATAITEMATTRIBUTEHDRMACROS_H__
17 #define __IPSDKBASEPROCESSING_DATAITEMATTRIBUTEHDRMACROS_H__
18 
20 #include <IPSDKBaseProcessing/Attribute/DataItem/InOut/BaseInOutMandatoryDataItemAttribute.h>
21 #include <IPSDKBaseProcessing/Attribute/DataItem/InOut/BaseInOutOptionalDataItemAttribute.h>
22 #include <IPSDKBaseProcessing/Attribute/DataItem/Input/BaseInputMandatoryDataItemAttribute.h>
23 #include <IPSDKBaseProcessing/Attribute/DataItem/Input/BaseInputOptionalDataItemAttribute.h>
24 #include <IPSDKBaseProcessing/Attribute/DataItem/Output/BaseOutputMandatoryDataItemAttribute.h>
25 #include <IPSDKBaseProcessing/Attribute/DataItem/Output/BaseOutputOptionalDataItemAttribute.h>
28 
31 
35 #define IPSDK_DECLARE_DATAITEM_ATTRIBUTE_BODY(libraryName, className, baseClassName, \
36  RuleString) \
37  IPSDK_DECLARE_SERIAL_WITHOUT_COPY(libraryName, className) \
38  IPSDK_DECLARE_TOOLTIP() \
39  IPSDK_DECLARE_ATTRIBUTE_BASE_BODY(libraryName, className, RuleString) \
40 public: \
41  typedef baseClassName BaseDataItemAttributeClassType; \
42 protected: \
43  className(); \
44 public: \
45  ~className(); \
46  const std::string& getNodeType() const; \
47  static const std::string& getNodeTypeStr(); \
48  void init(const ValueType& dataItemNode); \
49  void init(const StorageType& pDataItemNode);
50 
52 // Mandatory input attributes
54 
59 #define IPSDK_DECLARE_INPUT_FROM_EXISTING_DATAITEM_ATTRIBUTE(libraryName, className, \
60  dataItemClassName, RuleString) \
61 class IPSDK_LIB_API(libraryName) className : \
62  public ipsdk::processor::BaseInputMandatoryDataItemAttribute { \
63 public: \
64  typedef dataItemClassName ValueType; \
65  typedef dataItemClassName NodeType; \
66  typedef boost::shared_ptr<const ValueType> StorageType; \
67  StorageType getStorage() const \
68  { \
69  return boost::static_pointer_cast<const ValueType, \
70  const ipsdk::BaseDataItemNode>(accessDataItemNodePtr()); \
71  } \
72  IPSDK_DECLARE_DATAITEM_ATTRIBUTE_BODY(libraryName, className, \
73  ipsdk::processor::BaseInputMandatoryDataItemAttribute, \
74  RuleString) \
75  const ValueType& getNode() const \
76  { \
77  return static_cast<const ValueType&>(getDataItemNode()); \
78  } \
79  static StorageType retrieveDefaultValue() { \
80  return StorageType(); \
81  } \
82 };
83 
87 #define IPSDK_DECLARE_INPUT_DATAITEM_ATTRIBUTE(libraryName, className, RuleString, childSeq) \
88  IPSDK_DECLARE_NODE_DATA(libraryName, BOOST_PP_CAT(className, Node), childSeq) }; \
89  IPSDK_DECLARE_INPUT_FROM_EXISTING_DATAITEM_ATTRIBUTE(libraryName, className, \
90  BOOST_PP_CAT(className, Node), RuleString)
91 
93 // Mandatory in/out attributes
95 
100 #define IPSDK_DECLARE_INOUT_FROM_EXISTING_DATAITEM_ATTRIBUTE(libraryName, className, \
101  dataItemClassName, RuleString) \
102 class IPSDK_LIB_API(libraryName) className : \
103  public ipsdk::processor::BaseInOutMandatoryDataItemAttribute { \
104 public: \
105  typedef dataItemClassName ValueType; \
106  typedef dataItemClassName NodeType; \
107  typedef boost::shared_ptr<ValueType> StorageType; \
108  typedef boost::shared_ptr<const ValueType> ConstStorageType; \
109  ConstStorageType getStorage() const \
110  { \
111  return boost::static_pointer_cast<const ValueType, \
112  const ipsdk::BaseDataItemNode>(accessDataItemNodePtr()); \
113  } \
114  StorageType getStorage() \
115  { \
116  return boost::static_pointer_cast<ValueType, \
117  ipsdk::BaseDataItemNode>(accessDataItemNodePtr()); \
118  } \
119  IPSDK_DECLARE_DATAITEM_ATTRIBUTE_BODY(libraryName, className, \
120  ipsdk::processor::BaseInOutMandatoryDataItemAttribute, \
121  RuleString) \
122  const ValueType& getNode() const \
123  { \
124  return static_cast<const ValueType&>(getDataItemNode()); \
125  } \
126  ValueType& getNode() \
127  { \
128  return static_cast<ValueType&>(getDataItemNode()); \
129  } \
130  static StorageType retrieveDefaultValue() { \
131  return StorageType(); \
132  } \
133 };
134 
138 #define IPSDK_DECLARE_INOUT_DATAITEM_ATTRIBUTE(libraryName, className, RuleString, childSeq) \
139  IPSDK_DECLARE_NODE_DATA(libraryName, BOOST_PP_CAT(className, Node), childSeq) }; \
140  IPSDK_DECLARE_INOUT_FROM_EXISTING_DATAITEM_ATTRIBUTE(libraryName, className, \
141  BOOST_PP_CAT(className, Node), RuleString)
142 
144 // Mandatory output attributes
146 
151 #define IPSDK_DECLARE_OUTPUT_FROM_EXISTING_DATAITEM_ATTRIBUTE(libraryName, className, \
152  dataItemClassName, RuleString) \
153 class IPSDK_LIB_API(libraryName) className : \
154  public ipsdk::processor::BaseOutputMandatoryDataItemAttribute { \
155 public: \
156  typedef dataItemClassName ValueType; \
157  typedef dataItemClassName NodeType; \
158  typedef boost::shared_ptr<ValueType> StorageType; \
159  typedef boost::shared_ptr<const ValueType> ConstStorageType; \
160  ConstStorageType getStorage() const \
161  { \
162  return boost::static_pointer_cast<const ValueType, \
163  const ipsdk::BaseDataItemNode>(accessDataItemNodePtr()); \
164  } \
165  StorageType getStorage() \
166  { \
167  return boost::static_pointer_cast<ValueType, \
168  ipsdk::BaseDataItemNode>(accessDataItemNodePtr()); \
169  } \
170  IPSDK_DECLARE_DATAITEM_ATTRIBUTE_BODY(libraryName, className, \
171  ipsdk::processor::BaseOutputMandatoryDataItemAttribute, \
172  RuleString) \
173  const ValueType& getNode() const \
174  { \
175  return static_cast<const ValueType&>(getDataItemNode()); \
176  } \
177  ValueType& getNode() \
178  { \
179  return static_cast<ValueType&>(getDataItemNode()); \
180  } \
181  static StorageType retrieveDefaultValue() { \
182  return StorageType(); \
183  } \
184 };
185 
189 #define IPSDK_DECLARE_OUTPUT_DATAITEM_ATTRIBUTE(libraryName, className, RuleString, childSeq) \
190  IPSDK_DECLARE_NODE_DATA(libraryName, BOOST_PP_CAT(className, Node), childSeq) }; \
191  IPSDK_DECLARE_OUTPUT_FROM_EXISTING_DATAITEM_ATTRIBUTE(libraryName, className, \
192  BOOST_PP_CAT(className, Node), RuleString)
193 
195 // Optional input attributes
197 
203 #define IPSDK_DECLARE_INPUT_OPTIONAL_FROM_EXISTING_DATAITEM_ATTRIBUTE(libraryName, className, \
204  dataItemClassName, \
205  RuleString, defaultValue) \
206 class IPSDK_LIB_API(libraryName) className : \
207  public ipsdk::processor::BaseInputOptionalDataItemAttribute { \
208 public: \
209  typedef dataItemClassName ValueType; \
210  typedef dataItemClassName NodeType; \
211  typedef boost::shared_ptr<const ValueType> StorageType; \
212  StorageType getStorage() const \
213  { \
214  return boost::static_pointer_cast<const ValueType, \
215  const ipsdk::BaseDataItemNode>(accessDataItemNodePtr()); \
216  } \
217  IPSDK_DECLARE_DATAITEM_ATTRIBUTE_BODY(libraryName, className, \
218  ipsdk::processor::BaseInputOptionalDataItemAttribute, \
219  RuleString) \
220  const ValueType& getNode() const \
221  { \
222  return static_cast<const ValueType&>(getDataItemNode()); \
223  } \
224  static StorageType retrieveDefaultValue() { \
225  return defaultValue; \
226  } \
227 };
228 
233 #define IPSDK_DECLARE_INPUT_OPTIONAL_DATAITEM_ATTRIBUTE(libraryName, className, \
234  RuleString, childSeq, defaultValue) \
235  IPSDK_DECLARE_NODE_DATA(libraryName, BOOST_PP_CAT(className, Node), childSeq) }; \
236  IPSDK_DECLARE_INPUT_OPTIONAL_FROM_EXISTING_DATAITEM_ATTRIBUTE(libraryName, className, \
237  BOOST_PP_CAT(className, Node), \
238  RuleString, defaultValue)
239 
241 // Optional in/out attributes
243 
249 #define IPSDK_DECLARE_INOUT_OPTIONAL_FROM_EXISTING_DATAITEM_ATTRIBUTE(libraryName, className, \
250  dataItemClassName, \
251  RuleString, defaultValue) \
252 class IPSDK_LIB_API(libraryName) className : \
253  public ipsdk::processor::BaseInOutOptionalDataItemAttribute { \
254 public: \
255  typedef dataItemClassName ValueType; \
256  typedef dataItemClassName NodeType; \
257  typedef boost::shared_ptr<ValueType> StorageType; \
258  typedef boost::shared_ptr<const ValueType> ConstStorageType; \
259  ConstStorageType getStorage() const \
260  { \
261  return boost::static_pointer_cast<const ValueType, \
262  const ipsdk::BaseDataItemNode>(accessDataItemNodePtr()); \
263  } \
264  StorageType getStorage() \
265  { \
266  return boost::static_pointer_cast<ValueType, \
267  ipsdk::BaseDataItemNode>(accessDataItemNodePtr()); \
268  } \
269  IPSDK_DECLARE_DATAITEM_ATTRIBUTE_BODY(libraryName, className, \
270  ipsdk::processor::BaseInOutOptionalDataItemAttribute, \
271  RuleString) \
272  const ValueType& getNode() const \
273  { \
274  return static_cast<const ValueType&>(getDataItemNode()); \
275  } \
276  ValueType& getNode() \
277  { \
278  return static_cast<ValueType&>(getDataItemNode()); \
279  } \
280  static StorageType retrieveDefaultValue() { \
281  return defaultValue; \
282  } \
283 };
284 
289 #define IPSDK_DECLARE_INOUT_OPTIONAL_DATAITEM_ATTRIBUTE(libraryName, className, \
290  RuleString, childSeq, defaultValue) \
291  IPSDK_DECLARE_NODE_DATA(libraryName, BOOST_PP_CAT(className, Node), childSeq) }; \
292  IPSDK_DECLARE_INOUT_OPTIONAL_FROM_EXISTING_DATAITEM_ATTRIBUTE(libraryName, className, \
293  BOOST_PP_CAT(className, Node), \
294  RuleString, defaultValue)
295 
297 // Optional output attributes
299 
305 #define IPSDK_DECLARE_OUTPUT_OPTIONAL_FROM_EXISTING_DATAITEM_ATTRIBUTE(libraryName, className, \
306  dataItemClassName, \
307  RuleString, defaultValue) \
308 class IPSDK_LIB_API(libraryName) className : \
309  public ipsdk::processor::BaseOutputOptionalDataItemAttribute { \
310 public: \
311  typedef dataItemClassName ValueType; \
312  typedef dataItemClassName NodeType; \
313  typedef boost::shared_ptr<ValueType> StorageType; \
314  typedef boost::shared_ptr<const ValueType> ConstStorageType; \
315  ConstStorageType getStorage() const \
316  { \
317  return boost::static_pointer_cast<const ValueType, \
318  const ipsdk::BaseDataItemNode>(accessDataItemNodePtr()); \
319  } \
320  StorageType getStorage() \
321  { \
322  return boost::static_pointer_cast<ValueType, \
323  ipsdk::BaseDataItemNode>(accessDataItemNodePtr()); \
324  } \
325  IPSDK_DECLARE_DATAITEM_ATTRIBUTE_BODY(libraryName, className, \
326  ipsdk::processor::BaseOutputOptionalDataItemAttribute, \
327  RuleString) \
328  const ValueType& getNode() const \
329  { \
330  return static_cast<const ValueType&>(getDataItemNode()); \
331  } \
332  ValueType& getNode() \
333  { \
334  return static_cast<ValueType&>(getDataItemNode()); \
335  } \
336  static StorageType retrieveDefaultValue() { \
337  return defaultValue; \
338  } \
339 };
340 
345 #define IPSDK_DECLARE_OUTPUT_OPTIONAL_DATAITEM_ATTRIBUTE(libraryName, className, \
346  RuleString, childSeq, defaultValue) \
347  IPSDK_DECLARE_NODE_DATA(libraryName, BOOST_PP_CAT(className, Node), childSeq) }; \
348  IPSDK_DECLARE_OUTPUT_OPTIONAL_FROM_EXISTING_DATAITEM_ATTRIBUTE(libraryName, className, \
349  BOOST_PP_CAT(className, Node), \
350  RuleString, defaultValue)
351 
354 
355 #endif // __IPSDKBASEPROCESSING_DATAITEMATTRIBUTEHDRMACROS_H__
Header part of data item node declaration macros.
Header part of macros set for attribute class declaration.
Predefined operators for rules on data item attributes.