IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
ValueComparisonRuleOperators.h
Go to the documentation of this file.
1 // ValueComparisonRuleOperators.h:
3 // -------------------------------
4 //
15 
16 #ifndef __IPSDKBASEPROCESSING_VALUECOMPARISONRULEOPERATORS_H__
17 #define __IPSDKBASEPROCESSING_VALUECOMPARISONRULEOPERATORS_H__
18 
20 #include <IPSDKBaseProcessing/Rule/Attribute/Value/ValueComparison/RuleValueComparison.h>
21 #include <IPSDKBaseProcessing/Attribute/Value/BaseValueAttribute.h>
22 
23 namespace ipsdk {
24 namespace processor {
25 
29 
31 template <typename AttributeType>
32 inline typename boost::enable_if<typename boost::is_same<boost::mpl::int_<AttributeType::g_attributeType>,
33  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
34  RulePtr>::type
35 operator== (const boost::shared_ptr<AttributeType>& pAttribute,
36  const typename AttributeType::ValueType& value)
37 {
38  return isEqual(boost::weak_ptr<AttributeType>(pAttribute), value);
39 }
40 
41 template <typename AttributeType>
42 inline typename boost::enable_if<typename boost::is_same<boost::mpl::int_<AttributeType::g_attributeType>,
43  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
44  RulePtr>::type
45 isEqual(const boost::weak_ptr<AttributeType>& pAttribute,
46  const typename AttributeType::ValueType& value)
47 {
49  boost::shared_ptr<RuleType> pOutputRule = boost::make_shared<RuleType>();
50  pOutputRule->init(pAttribute, value);
51 
52  return pOutputRule;
53 }
55 
59 
61 template <typename AttributeType>
62 inline typename boost::enable_if<typename boost::is_same<boost::mpl::int_<AttributeType::g_attributeType>,
63  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
64  RulePtr>::type
65 operator!= (const boost::shared_ptr<AttributeType>& pAttribute,
66  const typename AttributeType::ValueType& value)
67 {
68  return isNotEqual(boost::weak_ptr<AttributeType>(pAttribute), value);
69 }
70 
71 template <typename AttributeType>
72 inline typename boost::enable_if<typename boost::is_same<boost::mpl::int_<AttributeType::g_attributeType>,
73  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
74  RulePtr>::type
75 isNotEqual(const boost::weak_ptr<AttributeType>& pAttribute,
76  const typename AttributeType::ValueType& value)
77 {
79  boost::shared_ptr<RuleType> pOutputRule = boost::make_shared<RuleType>();
80  pOutputRule->init(pAttribute, value);
81 
82  return pOutputRule;
83 }
85 
89 
91 template <typename AttributeType>
92 inline typename boost::enable_if<typename boost::is_same<boost::mpl::int_<AttributeType::g_attributeType>,
93  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
94  RulePtr>::type
95 operator> (const boost::shared_ptr<AttributeType>& pAttribute,
96  const typename AttributeType::ValueType& value)
97 {
98  return isGreater(boost::weak_ptr<AttributeType>(pAttribute), value);
99 }
100 
101 template <typename AttributeType>
102 inline typename boost::enable_if<typename boost::is_same<boost::mpl::int_<AttributeType::g_attributeType>,
103  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
104  RulePtr>::type
105 isGreater(const boost::weak_ptr<AttributeType>& pAttribute,
106  const typename AttributeType::ValueType& value)
107 {
109  boost::shared_ptr<RuleType> pOutputRule = boost::make_shared<RuleType>();
110  pOutputRule->init(pAttribute, value);
111 
112  return pOutputRule;
113 }
115 
119 
121 template <typename AttributeType>
122 inline typename boost::enable_if<typename boost::is_same<boost::mpl::int_<AttributeType::g_attributeType>,
123  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
124  RulePtr>::type
125 operator< (const boost::shared_ptr<AttributeType>& pAttribute,
126  const typename AttributeType::ValueType& value)
127 {
128  return isLower(boost::weak_ptr<AttributeType>(pAttribute), value);
129 }
130 
131 template <typename AttributeType>
132 inline typename boost::enable_if<typename boost::is_same<boost::mpl::int_<AttributeType::g_attributeType>,
133  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
134  RulePtr>::type
135 isLower(const boost::weak_ptr<AttributeType>& pAttribute,
136  const typename AttributeType::ValueType& value)
137 {
139  boost::shared_ptr<RuleType> pOutputRule = boost::make_shared<RuleType>();
140  pOutputRule->init(pAttribute, value);
141 
142  return pOutputRule;
143 }
145 
150 
152 template <typename AttributeType>
153 inline typename boost::enable_if<typename boost::is_same<boost::mpl::int_<AttributeType::g_attributeType>,
154  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
155  RulePtr>::type
156 operator>= (const boost::shared_ptr<AttributeType>& pAttribute,
157  const typename AttributeType::ValueType& value)
158 {
159  return isGreaterOrEqual(boost::weak_ptr<AttributeType>(pAttribute), value);
160 }
161 
162 template <typename AttributeType>
163 inline typename boost::enable_if<typename boost::is_same<boost::mpl::int_<AttributeType::g_attributeType>,
164  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
165  RulePtr>::type
166 isGreaterOrEqual(const boost::weak_ptr<AttributeType>& pAttribute,
167  const typename AttributeType::ValueType& value)
168 {
170  boost::shared_ptr<RuleType> pOutputRule = boost::make_shared<RuleType>();
171  pOutputRule->init(pAttribute, value);
172 
173  return pOutputRule;
174 }
176 
181 
183 template <typename AttributeType>
184 inline typename boost::enable_if<typename boost::is_same<boost::mpl::int_<AttributeType::g_attributeType>,
185  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
186  RulePtr>::type
187 operator<= (const boost::shared_ptr<AttributeType>& pAttribute,
188  const typename AttributeType::ValueType& value)
189 {
190  return isLowerOrEqual(boost::weak_ptr<AttributeType>(pAttribute), value);
191 }
192 
193 template <typename AttributeType>
194 inline typename boost::enable_if<typename boost::is_same<boost::mpl::int_<AttributeType::g_attributeType>,
195  boost::mpl::int_<eAttributeType::eAT_Value> >::type,
196  RulePtr>::type
197 isLowerOrEqual(const boost::weak_ptr<AttributeType>& pAttribute,
198  const typename AttributeType::ValueType& value)
199 {
201  boost::shared_ptr<RuleType> pOutputRule = boost::make_shared<RuleType>();
202  pOutputRule->init(pAttribute, value);
203 
204  return pOutputRule;
205 }
207 
210 
211 } // end of namespace processor
212 } // end of namespace ipsdk
213 
214 #endif // __IPSDKBASEPROCESSING_VALUECOMPARISONRULEOPERATORS_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.
void init(const boost::weak_ptr< const AttributeType > &pAttribute, const ValueType &value)
initialization of object
Definition: RuleValueComparison.h:64
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
Concrete class for rules allowing to compare an attribute value with a given value.
Definition: RuleValueComparison.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 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
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
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