IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
RuleNodeCollSize.h
1 // RuleNodeCollSize.h:
3 // -------------------
4 //
15 
16 #ifndef __IPSDKBASEPROCESSING_RULENODECOLLSIZE_H__
17 #define __IPSDKBASEPROCESSING_RULENODECOLLSIZE_H__
18 
19 #include <IPSDKBaseProcessing/Rule/Attribute/DataItem/NodeColl/Size/BaseTNodeCollSizeRule.h>
20 
21 namespace ipsdk {
22 namespace processor {
23 
26 
27 template <typename AttributeType,
28  typename NodeCollType,
29  eValueComparisonRuleType::domain ValueComparisonRuleType>
30 class RuleNodeCollSize : public BaseTNodeCollSizeRule<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_<NodeCollType::g_itemType>,
41  boost::mpl::int_<eDataItemType::eDIT_NodeColl> >::type,
42  typename NodeCollType::NodeType>::type NodeType;
43 
44 public:
47  RuleNodeCollSize() {}
48  ~RuleNodeCollSize() {}
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 getCollSize() const;
65 
66 
67 // attributes
68 protected:
69 
70 };
71 
74 
75 template <typename AttributeType, typename NodeCollType, eValueComparisonRuleType::domain ValueComparisonRuleType>
76 inline void
77 RuleNodeCollSize<AttributeType, NodeCollType, ValueComparisonRuleType>::init(const boost::weak_ptr<const AttributeType>& pAttribute,
78  const ipUInt32 value)
79 {
80  // call of base class initialization method
82 }
83 
84 template <typename AttributeType, typename NodeCollType, eValueComparisonRuleType::domain ValueComparisonRuleType>
85 inline std::string
87 {
88  return AttributeType::getObjectNameStr() + "::" +
89  DataItemType::template getNodeNameStr<NodeCollType>() + "{size}";
90 }
91 
92 template <typename AttributeType, typename NodeCollType, eValueComparisonRuleType::domain ValueComparisonRuleType>
93 inline ipUInt32
95 {
96  // retrieve associated attribute
97  const AttributeType& derivedAttribute = static_cast<const AttributeType&>(this->getAttribute1());
98 
99  return derivedAttribute.getNode().template getSize<NodeCollType>();
100 }
101 
104 
105 } // end of namespace processor
106 } // end of namespace ipsdk
107 
108 #endif // __IPSDKBASEPROCESSING_RULENODECOLLSIZE_H__
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
ipUInt32 getCollSize() const
method allowing to retrieve collection size into derived class
Definition: RuleNodeCollSize.h:94
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: RuleNodeCollSize.h:37
Concrete class for rules on size of node collections of data item attributes.
Definition: RuleNodeCollSize.h:30
void initBase()
base class initialization method
void init(const boost::weak_ptr< const AttributeType > &pAttribute, const ipUInt32 value)
initialization of object
Definition: RuleNodeCollSize.h:77
boost::enable_if< typename boost::is_same< boost::mpl::int_< NodeCollType::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_NodeColl > >::type, typename NodeCollType::NodeType >::type NodeType
Value type associated to leaf.
Definition: RuleNodeCollSize.h:42
Base template class for rules on size of node collections of data item attributes.
Definition: BaseTNodeCollSizeRule.h:28
std::string getAttributeName() const
method allowing to retrieve attribute name into derived class
Definition: RuleNodeCollSize.h:86
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53