IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
RuleLeafCollSize.h
1 // RuleLeafCollSize.h:
3 // -------------------
4 //
15 
16 #ifndef __IPSDKBASEPROCESSING_RULELEAFCOLLSIZE_H__
17 #define __IPSDKBASEPROCESSING_RULELEAFCOLLSIZE_H__
18 
19 #include <IPSDKBaseProcessing/Rule/Attribute/DataItem/LeafColl/Size/BaseTLeafCollSizeRule.h>
20 
21 namespace ipsdk {
22 namespace processor {
23 
26 
27 template <typename AttributeType,
28  typename LeafCollType,
29  eValueComparisonRuleType::domain ValueComparisonRuleType>
30 class RuleLeafCollSize : public BaseTLeafCollSizeRule<ValueComparisonRuleType>
31 {
32 // predefined public types
33 public:
35  typedef typename boost::enable_if<typename boost::is_same<boost::mpl::int_<AttributeType::g_attributeType>,
36  boost::mpl::int_<eAttributeType::eAT_DataItem> >::type,
37  typename AttributeType::ValueType>::type DataItemType;
38 
40  typedef typename boost::enable_if<typename boost::is_same<boost::mpl::int_<LeafCollType::g_itemType>,
41  boost::mpl::int_<eDataItemType::eDIT_LeafColl> >::type,
42  typename LeafCollType::ValueType>::type ValueType;
43 
44 public:
47  RuleLeafCollSize() {}
48  ~RuleLeafCollSize() {}
50 
51 // methods
52 public:
56  void init(const boost::weak_ptr<const AttributeType>& pAttribute,
57  const ipUInt32 value);
58 
59 protected:
61  std::string getAttributeName() const;
62 
64  ipUInt32 getTargetSize() const;
65 
67  ipUInt32 getCollSize() const;
68 
69 
70 // attributes
71 protected:
74 };
75 
78 
79 template <typename AttributeType, typename LeafCollType, eValueComparisonRuleType::domain ValueComparisonRuleType>
80 inline void
81 RuleLeafCollSize<AttributeType, LeafCollType, ValueComparisonRuleType>::init(const boost::weak_ptr<const AttributeType>& pAttribute,
82  const ipUInt32 value)
83 {
84  // store input value
85  _value = value;
86 
87  // call of base class initialization method
89 }
90 
91 template <typename AttributeType, typename LeafCollType, eValueComparisonRuleType::domain ValueComparisonRuleType>
92 inline std::string
94 {
95  return AttributeType::getObjectNameStr() + "::" +
96  DataItemType::template getNodeNameStr<LeafCollType>() + "{size}";
97 }
98 
99 template <typename AttributeType, typename LeafCollType, eValueComparisonRuleType::domain ValueComparisonRuleType>
100 inline ipUInt32
102 {
103  return _value;
104 }
105 
106 template <typename AttributeType, typename LeafCollType, eValueComparisonRuleType::domain ValueComparisonRuleType>
107 inline ipUInt32
109 {
110  // retrieve associated attribute
111  const AttributeType& derivedAttribute = static_cast<const AttributeType&>(this->getAttribute1());
112 
113  return derivedAttribute.getNode().template getSize<LeafCollType>();
114 }
115 
118 
119 } // end of namespace processor
120 } // end of namespace ipsdk
121 
122 #endif // __IPSDKBASEPROCESSING_RULELEAFCOLLSIZE_H__
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
std::string getAttributeName() const
method allowing to retrieve attribute name into derived class
Definition: RuleLeafCollSize.h:93
ipUInt32 getTargetSize() const
method allowing to retrieve target size into derived class
Definition: RuleLeafCollSize.h:101
ipUInt32 getCollSize() const
method allowing to retrieve collection size into derived class
Definition: RuleLeafCollSize.h:108
void initBase()
base class initialization method
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: RuleLeafCollSize.h:37
boost::enable_if< typename boost::is_same< boost::mpl::int_< LeafCollType::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_LeafColl > >::type, typename LeafCollType::ValueType >::type ValueType
Value type associated to leaf.
Definition: RuleLeafCollSize.h:42
ipUInt32 _value
value associated to rule
Definition: RuleLeafCollSize.h:73
Base template class for rules on size of leaf collections of data item attributes.
Definition: BaseTLeafCollSizeRule.h:28
Concrete class for rules on size of leaf collections of data item attributes.
Definition: RuleLeafCollSize.h:30
void init(const boost::weak_ptr< const AttributeType > &pAttribute, const ipUInt32 value)
initialization of object
Definition: RuleLeafCollSize.h:81
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53