IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
AttributeComparisonRuleOperators.h
Go to the documentation of this file.
1 // AttributeComparisonRuleOperators.h:
3 // -----------------------------------
4 //
14 
15 #ifndef __IPSDKBASEPROCESSING_ATTRIBUTECOMPARISONRULEOPERATORS_H__
16 #define __IPSDKBASEPROCESSING_ATTRIBUTECOMPARISONRULEOPERATORS_H__
17 
19 #include <IPSDKBaseProcessing/Rule/Attribute/Value/AttributeComparison/RuleAttributeComparison.h>
20 #include <IPSDKBaseProcessing/Attribute/Value/BaseValueAttribute.h>
21 
22 namespace ipsdk {
23 namespace processor {
24 
28 
30 template <typename AttributeType1, typename AttributeType2>
31 inline typename boost::enable_if<typename boost::mpl::and_<typename boost::is_same<boost::mpl::int_<AttributeType1::g_attributeType>,
32  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
33  typename boost::is_same<boost::mpl::int_<AttributeType2::g_attributeType>,
34  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
35  typename boost::is_same<typename AttributeType1::ValueType,
36  typename AttributeType2::ValueType>::type>::type,
37  RulePtr>::type
38 operator== (const boost::shared_ptr<AttributeType1>& pAttribute1,
39  const boost::shared_ptr<AttributeType2>& pAttribute2)
40 {
41  return isEqual(boost::weak_ptr<AttributeType1>(pAttribute1),
42  boost::weak_ptr<AttributeType2>(pAttribute2));
43 }
44 
45 template <typename AttributeType1, typename AttributeType2>
46 inline typename boost::enable_if<typename boost::mpl::and_<typename boost::is_same<boost::mpl::int_<AttributeType1::g_attributeType>,
47  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
48  typename boost::is_same<boost::mpl::int_<AttributeType2::g_attributeType>,
49  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
50  typename boost::is_same<typename AttributeType1::ValueType,
51  typename AttributeType2::ValueType>::type>::type,
52  RulePtr>::type
53 isEqual(const boost::weak_ptr<AttributeType1>& pAttribute1,
54  const boost::weak_ptr<AttributeType2>& pAttribute2)
55 {
57  boost::shared_ptr<RuleType> pOutputRule = boost::make_shared<RuleType>();
58  pOutputRule->init(pAttribute1, pAttribute2);
59 
60  return pOutputRule;
61 }
63 
67 
69 template <typename AttributeType1, typename AttributeType2>
70 inline typename boost::enable_if<typename boost::mpl::and_<typename boost::is_same<boost::mpl::int_<AttributeType1::g_attributeType>,
71  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
72  typename boost::is_same<boost::mpl::int_<AttributeType2::g_attributeType>,
73  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
74  typename boost::is_same<typename AttributeType1::ValueType,
75  typename AttributeType2::ValueType>::type>::type,
76  RulePtr>::type
77 operator!= (const boost::shared_ptr<AttributeType1>& pAttribute1,
78  const boost::shared_ptr<AttributeType2>& pAttribute2)
79 {
80  return isNotEqual(boost::weak_ptr<AttributeType1>(pAttribute1),
81  boost::weak_ptr<AttributeType2>(pAttribute2));
82 }
83 
84 template <typename AttributeType1, typename AttributeType2>
85 inline typename boost::enable_if<typename boost::mpl::and_<typename boost::is_same<boost::mpl::int_<AttributeType1::g_attributeType>,
86  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
87  typename boost::is_same<boost::mpl::int_<AttributeType2::g_attributeType>,
88  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
89  typename boost::is_same<typename AttributeType1::ValueType,
90  typename AttributeType2::ValueType>::type>::type,
91  RulePtr>::type
92 isNotEqual(const boost::weak_ptr<AttributeType1>& pAttribute1,
93  const boost::weak_ptr<AttributeType2>& pAttribute2)
94 {
96  boost::shared_ptr<RuleType> pOutputRule = boost::make_shared<RuleType>();
97  pOutputRule->init(pAttribute1, pAttribute2);
98 
99  return pOutputRule;
100 }
102 
106 
108 template <typename AttributeType1, typename AttributeType2>
109 inline typename boost::enable_if<typename boost::mpl::and_<typename boost::is_same<boost::mpl::int_<AttributeType1::g_attributeType>,
110  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
111  typename boost::is_same<boost::mpl::int_<AttributeType2::g_attributeType>,
112  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
113  typename boost::is_same<typename AttributeType1::ValueType,
114  typename AttributeType2::ValueType>::type>::type,
115  RulePtr>::type
116 operator> (const boost::shared_ptr<AttributeType1>& pAttribute1,
117  const boost::shared_ptr<AttributeType2>& pAttribute2)
118 {
119  return isGreater(boost::weak_ptr<AttributeType1>(pAttribute1),
120  boost::weak_ptr<AttributeType2>(pAttribute2));
121 }
122 
123 template <typename AttributeType1, typename AttributeType2>
124 inline typename boost::enable_if<typename boost::mpl::and_<typename boost::is_same<boost::mpl::int_<AttributeType1::g_attributeType>,
125  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
126  typename boost::is_same<boost::mpl::int_<AttributeType2::g_attributeType>,
127  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
128  typename boost::is_same<typename AttributeType1::ValueType,
129  typename AttributeType2::ValueType>::type>::type,
130  RulePtr>::type
131 isGreater(const boost::weak_ptr<AttributeType1>& pAttribute1,
132  const boost::weak_ptr<AttributeType2>& pAttribute2)
133 {
135  boost::shared_ptr<RuleType> pOutputRule = boost::make_shared<RuleType>();
136  pOutputRule->init(pAttribute1, pAttribute2);
137 
138  return pOutputRule;
139 }
141 
145 
147 template <typename AttributeType1, typename AttributeType2>
148 inline typename boost::enable_if<typename boost::mpl::and_<typename boost::is_same<boost::mpl::int_<AttributeType1::g_attributeType>,
149  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
150  typename boost::is_same<boost::mpl::int_<AttributeType2::g_attributeType>,
151  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
152  typename boost::is_same<typename AttributeType1::ValueType,
153  typename AttributeType2::ValueType>::type>::type,
154  RulePtr>::type
155 operator< (const boost::shared_ptr<AttributeType1>& pAttribute1,
156  const boost::shared_ptr<AttributeType2>& pAttribute2)
157 {
158  return isLower(boost::weak_ptr<AttributeType1>(pAttribute1),
159  boost::weak_ptr<AttributeType2>(pAttribute2));
160 }
161 
162 template <typename AttributeType1, typename AttributeType2>
163 inline typename boost::enable_if<typename boost::mpl::and_<typename boost::is_same<boost::mpl::int_<AttributeType1::g_attributeType>,
164  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
165  typename boost::is_same<boost::mpl::int_<AttributeType2::g_attributeType>,
166  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
167  typename boost::is_same<typename AttributeType1::ValueType,
168  typename AttributeType2::ValueType>::type>::type,
169  RulePtr>::type
170 isLower(const boost::weak_ptr<AttributeType1>& pAttribute1,
171  const boost::weak_ptr<AttributeType2>& pAttribute2)
172 {
174  boost::shared_ptr<RuleType> pOutputRule = boost::make_shared<RuleType>();
175  pOutputRule->init(pAttribute1, pAttribute2);
176 
177  return pOutputRule;
178 }
180 
185 
187 template <typename AttributeType1, typename AttributeType2>
188 inline typename boost::enable_if<typename boost::mpl::and_<typename boost::is_same<boost::mpl::int_<AttributeType1::g_attributeType>,
189  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
190  typename boost::is_same<boost::mpl::int_<AttributeType2::g_attributeType>,
191  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
192  typename boost::is_same<typename AttributeType1::ValueType,
193  typename AttributeType2::ValueType>::type>::type,
194  RulePtr>::type
195 operator>= (const boost::shared_ptr<AttributeType1>& pAttribute1,
196  const boost::shared_ptr<AttributeType2>& pAttribute2)
197 {
198  return isGreaterOrEqual(boost::weak_ptr<AttributeType1>(pAttribute1),
199  boost::weak_ptr<AttributeType2>(pAttribute2));
200 }
201 
202 template <typename AttributeType1, typename AttributeType2>
203 inline typename boost::enable_if<typename boost::mpl::and_<typename boost::is_same<boost::mpl::int_<AttributeType1::g_attributeType>,
204  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
205  typename boost::is_same<boost::mpl::int_<AttributeType2::g_attributeType>,
206  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
207  typename boost::is_same<typename AttributeType1::ValueType,
208  typename AttributeType2::ValueType>::type>::type,
209  RulePtr>::type
210 isGreaterOrEqual(const boost::weak_ptr<AttributeType1>& pAttribute1,
211  const boost::weak_ptr<AttributeType2>& pAttribute2)
212 {
214  boost::shared_ptr<RuleType> pOutputRule = boost::make_shared<RuleType>();
215  pOutputRule->init(pAttribute1, pAttribute2);
216 
217  return pOutputRule;
218 }
220 
225 
227 template <typename AttributeType1, typename AttributeType2>
228 inline typename boost::enable_if<typename boost::mpl::and_<typename boost::is_same<boost::mpl::int_<AttributeType1::g_attributeType>,
229  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
230  typename boost::is_same<boost::mpl::int_<AttributeType2::g_attributeType>,
231  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
232  typename boost::is_same<typename AttributeType1::ValueType,
233  typename AttributeType2::ValueType>::type>::type,
234  RulePtr>::type
235 operator<= (const boost::shared_ptr<AttributeType1>& pAttribute1,
236  const boost::shared_ptr<AttributeType2>& pAttribute2)
237 {
238  return isLowerOrEqual(boost::weak_ptr<AttributeType1>(pAttribute1),
239  boost::weak_ptr<AttributeType2>(pAttribute2));
240 }
241 
242 template <typename AttributeType1, typename AttributeType2>
243 inline typename boost::enable_if<typename boost::mpl::and_<typename boost::is_same<boost::mpl::int_<AttributeType1::g_attributeType>,
244  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
245  typename boost::is_same<boost::mpl::int_<AttributeType2::g_attributeType>,
246  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
247  typename boost::is_same<typename AttributeType1::ValueType,
248  typename AttributeType2::ValueType>::type>::type,
249  RulePtr>::type
250 isLowerOrEqual(const boost::weak_ptr<AttributeType1>& pAttribute1,
251  const boost::weak_ptr<AttributeType2>& pAttribute2)
252 {
254  boost::shared_ptr<RuleType> pOutputRule = boost::make_shared<RuleType>();
255  pOutputRule->init(pAttribute1, pAttribute2);
256 
257  return pOutputRule;
258 }
260 
263 
264 } // end of namespace processor
265 } // end of namespace ipsdk
266 
267 #endif // __IPSDKBASEPROCESSING_ATTRIBUTECOMPARISONRULEOPERATORS_H__
boost::enable_if< typename boost::mpl::and_< typename boost::is_same< boost::mpl::int_< AttributeType1::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_Value > >::type, typename boost::is_same< boost::mpl::int_< AttributeType2::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_Value > >::type, typename boost::is_same< typename AttributeType1::ValueType, typename AttributeType2::ValueType >::type >::type, RulePtr >::type operator>=(const boost::shared_ptr< AttributeType1 > &pAttribute1, const boost::shared_ptr< AttributeType2 > &pAttribute2)
Definition: AttributeComparisonRuleOperators.h:195
boost::enable_if< typename boost::mpl::and_< typename boost::is_same< boost::mpl::int_< AttributeType::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_DataItem > >::type, typename boost::is_same< boost::mpl::int_< LeafType1::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_Leaf > >::type, typename boost::is_same< boost::mpl::int_< LeafType2::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_Leaf > >::type >::type, RulePtr >::type isGreater(const boost::shared_ptr< AttributeType > &pAttribute)
Rule allowing to check whether a DataItem Leaf is greater than another.
Definition: LeafsComparisonRuleOperators.h:170
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Base operators used to combined rules.
boost::enable_if< typename boost::mpl::and_< typename boost::is_same< boost::mpl::int_< AttributeType::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_DataItem > >::type, typename boost::is_same< boost::mpl::int_< LeafType1::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_Leaf > >::type, typename boost::is_same< boost::mpl::int_< LeafType2::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_Leaf > >::type >::type, RulePtr >::type isNotEqual(const boost::shared_ptr< AttributeType > &pAttribute)
Rule allowing to check whether a DataItem Leaf is not equal to another.
Definition: LeafsComparisonRuleOperators.h:106
boost::enable_if< typename boost::mpl::and_< typename boost::is_same< boost::mpl::int_< AttributeType1::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_Value > >::type, typename boost::is_same< boost::mpl::int_< AttributeType2::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_Value > >::type, typename boost::is_same< typename AttributeType1::ValueType, typename AttributeType2::ValueType >::type >::type, RulePtr >::type operator==(const boost::shared_ptr< AttributeType1 > &pAttribute1, const boost::shared_ptr< AttributeType2 > &pAttribute2)
Rule allowing to check whether a value attribute is equal to another.
Definition: AttributeComparisonRuleOperators.h:38
boost::shared_ptr< BaseRule > RulePtr
shared pointer to rule
Definition: RuleTypes.h:104
boost::enable_if< typename boost::mpl::and_< typename boost::is_same< boost::mpl::int_< AttributeType::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_DataItem > >::type, typename boost::is_same< boost::mpl::int_< LeafType1::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_Leaf > >::type, typename boost::is_same< boost::mpl::int_< LeafType2::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_Leaf > >::type >::type, RulePtr >::type isGreaterOrEqual(const boost::shared_ptr< AttributeType > &pAttribute)
Rule allowing to check whether a DataItem Leaf is greater or equal to another.
Definition: LeafsComparisonRuleOperators.h:298
void init(const boost::weak_ptr< const AttributeType1 > &pAttribute1, const boost::weak_ptr< const AttributeType2 > &pAttribute2)
initialization of object
Definition: RuleAttributeComparison.h:75
boost::enable_if< typename boost::mpl::and_< typename boost::is_same< boost::mpl::int_< AttributeType1::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_Value > >::type, typename boost::is_same< boost::mpl::int_< AttributeType2::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_Value > >::type, typename boost::is_same< typename AttributeType1::ValueType, typename AttributeType2::ValueType >::type >::type, RulePtr >::type operator!=(const boost::shared_ptr< AttributeType1 > &pAttribute1, const boost::shared_ptr< AttributeType2 > &pAttribute2)
Rule allowing to check whether a value attribute is not equal another.
Definition: AttributeComparisonRuleOperators.h:77
boost::enable_if< typename boost::mpl::and_< typename boost::is_same< boost::mpl::int_< AttributeType::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_DataItem > >::type, typename boost::is_same< boost::mpl::int_< LeafType1::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_Leaf > >::type, typename boost::is_same< boost::mpl::int_< LeafType2::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_Leaf > >::type >::type, RulePtr >::type isLower(const boost::shared_ptr< AttributeType > &pAttribute)
Rule allowing to check whether a DataItem Leaf is lower than another.
Definition: LeafsComparisonRuleOperators.h:234
boost::enable_if< typename boost::mpl::and_< typename boost::is_same< boost::mpl::int_< AttributeType::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_DataItem > >::type, typename boost::is_same< boost::mpl::int_< LeafType1::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_Leaf > >::type, typename boost::is_same< boost::mpl::int_< LeafType2::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_Leaf > >::type >::type, RulePtr >::type isEqual(const boost::shared_ptr< AttributeType > &pAttribute)
Rule allowing to check whether a DataItem Leaf is equal to another.
Definition: LeafsComparisonRuleOperators.h:42
Concrete class for rules allowing to compare attributes value.
Definition: RuleAttributeComparison.h:29
boost::enable_if< typename boost::mpl::and_< typename boost::is_same< boost::mpl::int_< AttributeType::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_DataItem > >::type, typename boost::is_same< boost::mpl::int_< LeafType1::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_Leaf > >::type, typename boost::is_same< boost::mpl::int_< LeafType2::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_Leaf > >::type >::type, RulePtr >::type isLowerOrEqual(const boost::shared_ptr< AttributeType > &pAttribute)
Rule allowing to check whether a DataItem Leaf is lower or equal to another.
Definition: LeafsComparisonRuleOperators.h:362
boost::enable_if< typename boost::mpl::and_< typename boost::is_same< boost::mpl::int_< AttributeType1::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_Value > >::type, typename boost::is_same< boost::mpl::int_< AttributeType2::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_Value > >::type, typename boost::is_same< typename AttributeType1::ValueType, typename AttributeType2::ValueType >::type >::type, RulePtr >::type operator>(const boost::shared_ptr< AttributeType1 > &pAttribute1, const boost::shared_ptr< AttributeType2 > &pAttribute2)
Rule allowing to check whether a value attribute is greater than another.
Definition: AttributeComparisonRuleOperators.h:116