IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
RuleLeafCollValueComparison.h
1 // RuleLeafCollValueComparison.h:
3 // ------------------------------
4 //
15 
16 #ifndef __IPSDKBASEPROCESSING_RULELEAFCOLLVALUECOMPARISON_H__
17 #define __IPSDKBASEPROCESSING_RULELEAFCOLLVALUECOMPARISON_H__
18 
19 #include <IPSDKBaseProcessing/Rule/Attribute/DataItem/LeafColl/LeafCollValueComparison/BaseTLeafCollValueComparisonRule.h>
20 
21 namespace ipsdk {
22 namespace processor {
23 
26 
27 template <typename AttributeType,
28  typename LeafType,
29  eValueComparisonRuleType::domain ValueComparisonRuleType>
30 class RuleLeafCollValueComparison : public BaseTLeafCollValueComparisonRule<typename LeafType::ValueType,
31  ValueComparisonRuleType>
32 {
33 // predefined public types
34 public:
36  typedef typename boost::enable_if<typename boost::is_same<boost::mpl::int_<AttributeType::g_attributeType>,
37  boost::mpl::int_<eAttributeType::eAT_DataItem> >::type,
38  typename AttributeType::ValueType>::type DataItemType;
39 
41  typedef typename boost::enable_if<typename boost::is_same<boost::mpl::int_<LeafType::g_itemType>,
42  boost::mpl::int_<eDataItemType::eDIT_LeafColl> >::type,
43  typename LeafType::ValueType>::type ValueType;
44 
46  typedef typename boost::enable_if<typename boost::is_same<boost::mpl::int_<LeafType::g_itemType>,
47  boost::mpl::int_<eDataItemType::eDIT_LeafColl> >::type,
48  typename LeafType::CollType>::type CollType;
49 
50 public:
56 
57 // methods
58 public:
62  void init(const boost::weak_ptr<const AttributeType>& pAttribute,
63  const ValueType& value);
64 
65 protected:
67  std::string getAttributeName() const;
68 
70  const CollType& getAttributeLeafColl() const;
71 
72 // attributes
73 protected:
74 
75 };
76 
79 
80 template <typename AttributeType, typename LeafType, eValueComparisonRuleType::domain ValueComparisonRuleType>
81 inline void
82 RuleLeafCollValueComparison<AttributeType, LeafType, ValueComparisonRuleType>::init(const boost::weak_ptr<const AttributeType>& pAttribute,
83  const ValueType& value)
84 {
85  // call of base class initialization method
87 }
88 
89 template <typename AttributeType, typename LeafType, eValueComparisonRuleType::domain ValueComparisonRuleType>
90 inline std::string
92 {
93  return AttributeType::getObjectNameStr() + "::" +
94  DataItemType::template getNodeNameStr<LeafType>();
95 }
96 
97 template <typename AttributeType, typename LeafType, eValueComparisonRuleType::domain ValueComparisonRuleType>
100 {
101  // retrieve associated attribute
102  const AttributeType& derivedAttribute = static_cast<const AttributeType&>(this->getAttribute1());
103 
104  return derivedAttribute.getNode().template getLeafColl<LeafType>();
105 }
106 
109 
110 } // end of namespace processor
111 } // end of namespace ipsdk
112 
113 #endif // __IPSDKBASEPROCESSING_RULELEAFCOLLVALUECOMPARISON_H__
boost::enable_if< typename boost::is_same< boost::mpl::int_< AttributeType::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_DataItem > >::type, typename AttributeType::ValueType >::type DataItemType
retrieve attribute type
Definition: RuleLeafCollValueComparison.h:38
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
boost::enable_if< typename boost::is_same< boost::mpl::int_< LeafType::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_LeafColl > >::type, typename LeafType::ValueType >::type ValueType
Value type associated to leaf.
Definition: RuleLeafCollValueComparison.h:43
void initBase()
base class initialization method
std::string getAttributeName() const
method allowing to retrieve attribute name into derived class
Definition: RuleLeafCollValueComparison.h:91
Concrete class for rule allowing to compare leaf value collection of data item attributes with a give...
Definition: RuleLeafCollValueComparison.h:30
const CollType & getAttributeLeafColl() const
method allowing to retrieve attribute leaf value collection into derived class
Definition: RuleLeafCollValueComparison.h:99
void init(const boost::weak_ptr< const AttributeType > &pAttribute, const ValueType &value)
initialization of object
Definition: RuleLeafCollValueComparison.h:82
Definition: BaseTLeafCollValueComparisonRule.h:32
boost::enable_if< typename boost::is_same< boost::mpl::int_< LeafType::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_LeafColl > >::type, typename LeafType::CollType >::type CollType
Collection type associated to leaf.
Definition: RuleLeafCollValueComparison.h:48