IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
RuleNodesCollSize.h
1 // RuleNodesCollSize.h:
3 // --------------------
4 //
15 
16 #ifndef __IPSDKBASEPROCESSING_RULENODESCOLLSIZE_H__
17 #define __IPSDKBASEPROCESSING_RULENODESCOLLSIZE_H__
18 
19 #include <IPSDKBaseProcessing/Rule/Attribute/DataItem/NodeColl/Size/BaseTNodesCollSizeRule.h>
20 
21 namespace ipsdk {
22 namespace processor {
23 
26 
27 template <typename AttributeType1,
28  typename NodeCollType1,
29  typename AttributeType2,
30  typename NodeCollType2,
31  eValueComparisonRuleType::domain ValueComparisonRuleType>
32 class RuleNodesCollSize : public BaseTNodesCollSizeRule<ValueComparisonRuleType>
33 {
34 // predefined public types
35 public:
37  typedef typename boost::enable_if<typename boost::is_same<boost::mpl::int_<AttributeType1::g_attributeType>,
38  boost::mpl::int_<eAttributeType::eAT_DataItem> >::type,
39  typename AttributeType1::ValueType>::type DataItemType1;
40 
42  typedef typename boost::enable_if<typename boost::is_same<boost::mpl::int_<NodeCollType1::g_itemType>,
43  boost::mpl::int_<eDataItemType::eDIT_NodeColl> >::type,
44  typename NodeCollType1::NodeType>::type NodeType1;
45 
47  typedef typename boost::enable_if<typename boost::is_same<boost::mpl::int_<AttributeType2::g_attributeType>,
48  boost::mpl::int_<eAttributeType::eAT_DataItem> >::type,
49  typename AttributeType2::ValueType>::type DataItemType2;
50 
51 public:
55  ~RuleNodesCollSize() {}
57 
58 // methods
59 public:
65  void init(const boost::weak_ptr<const AttributeType1>& pAttribute1,
66  const boost::weak_ptr<const AttributeType2>& pAttribute2);
67 
68 protected:
70  std::string getAttributeName1() const;
71 
73  ipUInt32 getCollSize1() const;
74 
76  std::string getAttributeName2() const;
77 
79  ipUInt32 getCollSize2() const;
80 
81 
82 // attributes
83 protected:
84 
85 };
86 
89 
90 template <typename AttributeType1, typename NodeCollType1, typename AttributeType2, typename NodeCollType2, eValueComparisonRuleType::domain ValueComparisonRuleType>
91 inline void
93  const boost::weak_ptr<const AttributeType2>& pAttribute2)
94 {
95  // call of base class initialization method
97 }
98 
99 template <typename AttributeType1, typename NodeCollType1, typename AttributeType2, typename NodeCollType2, eValueComparisonRuleType::domain ValueComparisonRuleType>
100 inline std::string
102 {
103  return AttributeType1::getObjectNameStr() + "::" +
104  DataItemType1::template getNodeNameStr<NodeCollType1>() + "{size}";
105 }
106 
107 template <typename AttributeType1, typename NodeCollType1, typename AttributeType2, typename NodeCollType2, eValueComparisonRuleType::domain ValueComparisonRuleType>
108 inline std::string
110 {
111  return AttributeType2::getObjectNameStr() + "::" +
112  DataItemType2::template getNodeNameStr<NodeCollType2>() + "{size}";
113 }
114 
115 template <typename AttributeType1, typename NodeCollType1, typename AttributeType2, typename NodeCollType2, eValueComparisonRuleType::domain ValueComparisonRuleType>
116 inline ipUInt32
118 {
119  // retrieve associated attribute
120  const AttributeType1& derivedAttribute = static_cast<const AttributeType1&>(this->getAttribute1());
121 
122  return derivedAttribute.getNode().template getSize<NodeCollType1>();
123 }
124 
125 template <typename AttributeType1, typename NodeCollType1, typename AttributeType2, typename NodeCollType2, eValueComparisonRuleType::domain ValueComparisonRuleType>
126 inline ipUInt32
128 {
129  // retrieve associated attribute
130  const AttributeType2& derivedAttribute = static_cast<const AttributeType2&>(this->getAttribute2());
131 
132  return derivedAttribute.getNode().template getSize<NodeCollType2>();
133 }
134 
137 
138 } // end of namespace processor
139 } // end of namespace ipsdk
140 
141 #endif // __IPSDKBASEPROCESSING_RULENODESCOLLSIZE_H__
std::string getAttributeName2() const
method allowing to retrieve second attribute name into derived class
Definition: RuleNodesCollSize.h:109
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
boost::enable_if< typename boost::is_same< boost::mpl::int_< AttributeType1::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_DataItem > >::type, typename AttributeType1::ValueType >::type DataItemType1
retrieve first attribute type
Definition: RuleNodesCollSize.h:39
void init(const boost::weak_ptr< const AttributeType1 > &pAttribute1, const boost::weak_ptr< const AttributeType2 > &pAttribute2)
initialization of object
Definition: RuleNodesCollSize.h:92
void initBase()
base class initialization method
std::string getAttributeName1() const
method allowing to retrieve first attribute name into derived class
Definition: RuleNodesCollSize.h:101
Base template class for rules on size of node collections of data item attributes.
Definition: BaseTNodesCollSizeRule.h:28
ipUInt32 getCollSize1() const
method allowing to retrieve first collection size into derived class
Definition: RuleNodesCollSize.h:117
boost::enable_if< typename boost::is_same< boost::mpl::int_< NodeCollType1::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_NodeColl > >::type, typename NodeCollType1::NodeType >::type NodeType1
Node type associated to first attribute.
Definition: RuleNodesCollSize.h:44
Concrete class for rules on size of node collections of data item attributes.
Definition: RuleNodesCollSize.h:32
ipUInt32 getCollSize2() const
method allowing to retrieve second collection size into derived class
Definition: RuleNodesCollSize.h:127
boost::enable_if< typename boost::is_same< boost::mpl::int_< AttributeType2::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_DataItem > >::type, typename AttributeType2::ValueType >::type DataItemType2
retrieve second attribute type
Definition: RuleNodesCollSize.h:49
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53