IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
IPEnumRuleOperators.h
Go to the documentation of this file.
1 // IPEnumRuleOperators.h:
3 // ----------------------
4 //
14 
15 #ifndef __IPSDKIMAGEPROCESSING_IPENUMRULEOPERATORS_H__
16 #define __IPSDKIMAGEPROCESSING_IPENUMRULEOPERATORS_H__
17 
20 #include <IPSDKImageProcessing/Rule/IPEnum/RuleIPEnumValue.h>
21 #include <IPSDKImageProcessing/Attribute/IPEnum/IPEnumAttribute.h>
22 #include <boost/utility/enable_if.hpp>
23 #include <boost/type_traits/is_same.hpp>
24 #include <boost/mpl/equal_to.hpp>
25 #include <boost/mpl/and.hpp>
26 #include <boost/make_shared.hpp>
27 
28 namespace ipsdk {
29 namespace imaproc {
30 
33 
37 template <typename AttributeType>
38 inline typename boost::enable_if<typename boost::mpl::equal_to<boost::mpl::int_<AttributeType::g_imageProcessingAttributeType>,
39  boost::mpl::int_<eImageProcessingAttributeType::eIPAT_IPEnum> >::type,
41 operator== (const boost::shared_ptr<AttributeType>& pAttribute,
42  const typename AttributeType::ValueType& value)
43 {
44  return isEqual(boost::weak_ptr<AttributeType>(pAttribute), value);
45 }
46 
47 template <typename AttributeType>
48 inline typename boost::enable_if<typename boost::mpl::equal_to<boost::mpl::int_<AttributeType::g_imageProcessingAttributeType>,
49  boost::mpl::int_<eImageProcessingAttributeType::eIPAT_IPEnum> >::type,
51 isEqual(const boost::weak_ptr<AttributeType>& pAttribute,
52  const typename AttributeType::ValueType& value)
53 {
55  boost::shared_ptr<RuleType> pOutputRule = boost::make_shared<RuleType>();
56  pOutputRule->init(pAttribute, value);
57 
58  return pOutputRule;
59 }
61 
65 template <typename AttributeType>
66 inline typename boost::enable_if<typename boost::mpl::equal_to<boost::mpl::int_<AttributeType::g_imageProcessingAttributeType>,
67  boost::mpl::int_<eImageProcessingAttributeType::eIPAT_IPEnum> >::type,
69 operator!= (const boost::shared_ptr<AttributeType>& pAttribute,
70  const typename AttributeType::ValueType& value)
71 {
72  return isEqual(boost::weak_ptr<AttributeType>(pAttribute), value);
73 }
74 
75 template <typename AttributeType>
76 inline typename boost::enable_if<typename boost::mpl::equal_to<boost::mpl::int_<AttributeType::g_imageProcessingAttributeType>,
77  boost::mpl::int_<eImageProcessingAttributeType::eIPAT_IPEnum> >::type,
79 isNotEqual(const boost::weak_ptr<AttributeType>& pAttribute,
80  const typename AttributeType::ValueType& value)
81 {
82  return ipsdk::processor::Not(isEqual(pAttribute, value));
83 }
85 
88 
89 } // end of namespace imaproc
90 } // end of namespace ipsdk
91 
92 #endif // __IPSDKIMAGEPROCESSING_IPENUMRULEOPERATORS_H__
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Base operators used to combined rules.
boost::enable_if< typename boost::mpl::equal_to< boost::mpl::int_< AttributeType::g_imageProcessingAttributeType >, boost::mpl::int_< eImageProcessingAttributeType::eIPAT_IPEnum > >::type, ipsdk::processor::RulePtr >::type isNotEqual(const boost::weak_ptr< AttributeType > &pAttribute, const typename AttributeType::ValueType &value)
Definition: IPEnumRuleOperators.h:79
boost::enable_if< typename boost::mpl::equal_to< boost::mpl::int_< AttributeType::g_imageProcessingAttributeType >, boost::mpl::int_< eImageProcessingAttributeType::eIPAT_IPEnum > >::type, ipsdk::processor::RulePtr >::type isEqual(const boost::weak_ptr< AttributeType > &pAttribute, const typename AttributeType::ValueType &value)
Definition: IPEnumRuleOperators.h:51
IPSDKBASEPROCESSING_API RulePtr Not(const RulePtr &pRule)
logical rule combination operators
boost::shared_ptr< BaseRule > RulePtr
shared pointer to rule
Definition: RuleTypes.h:104
Definition of import/export macro for library.
Definition: RuleIPEnumValue.h:28
boost::enable_if< typename boost::mpl::equal_to< boost::mpl::int_< AttributeType::g_imageProcessingAttributeType >, boost::mpl::int_< eImageProcessingAttributeType::eIPAT_IPEnum > >::type, ipsdk::processor::RulePtr >::type operator==(const boost::shared_ptr< AttributeType > &pAttribute, const typename AttributeType::ValueType &value)
Definition: IPEnumRuleOperators.h:41
boost::enable_if< typename boost::mpl::equal_to< boost::mpl::int_< AttributeType::g_imageProcessingAttributeType >, boost::mpl::int_< eImageProcessingAttributeType::eIPAT_IPEnum > >::type, ipsdk::processor::RulePtr >::type operator!=(const boost::shared_ptr< AttributeType > &pAttribute, const typename AttributeType::ValueType &value)
Definition: IPEnumRuleOperators.h:69
void init(const AttributeConstWeakPtr &pAttribute, const EnumType &enumValue)
initialization of object
Definition: RuleIPEnumValue.h:52