IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
NodeCollSizeRuleOperators.h
Go to the documentation of this file.
1 // NodeCollSizeRuleOperators.h:
3 // ----------------------------
4 //
15 
16 #ifndef __IPSDKBASEPROCESSING_NODECOLLSIZERULEOPERATORS_H__
17 #define __IPSDKBASEPROCESSING_NODECOLLSIZERULEOPERATORS_H__
18 
20 #include <IPSDKBaseProcessing/Rule/Attribute/DataItem/NodeColl/Size/RuleNodeCollSize.h>
21 #include <IPSDKBaseProcessing/Rule/Attribute/DataItem/NodeColl/Size/RuleNodesCollSize.h>
22 
23 namespace ipsdk {
24 namespace processor {
25 
28 
31 template <typename NodeCollType, typename AttributeType>
32 inline typename boost::enable_if<typename boost::mpl::and_<typename boost::is_same<boost::mpl::int_<AttributeType::g_attributeType>,
33  boost::mpl::int_<eAttributeType::eAT_DataItem> >::type,
34  typename boost::is_same<boost::mpl::int_<NodeCollType::g_itemType>,
35  boost::mpl::int_<eDataItemType::eDIT_NodeColl> >::type>::type,
36  RulePtr>::type
37 isNotEmpty(const boost::shared_ptr<AttributeType>& pAttribute)
38 {
39  return isNotEmpty<NodeCollType>(boost::weak_ptr<const AttributeType>(pAttribute));
40 }
41 
42 template <typename NodeCollType, typename AttributeType>
43 inline typename boost::enable_if<typename boost::mpl::and_<typename boost::is_same<boost::mpl::int_<AttributeType::g_attributeType>,
44  boost::mpl::int_<eAttributeType::eAT_DataItem> >::type,
45  typename boost::is_same<boost::mpl::int_<NodeCollType::g_itemType>,
46  boost::mpl::int_<eDataItemType::eDIT_NodeColl> >::type>::type,
47  RulePtr>::type
48 isNotEmpty(const boost::weak_ptr<const AttributeType>& pAttribute)
49 {
51  boost::shared_ptr<RuleType> pOutputRule = boost::make_shared<RuleType>();
52  pOutputRule->init(pAttribute, 0);
53 
54  return pOutputRule;
55 }
57 
60 template <typename NodeCollType, typename AttributeType>
61 inline typename boost::enable_if<typename boost::mpl::and_<typename boost::is_same<boost::mpl::int_<AttributeType::g_attributeType>,
62  boost::mpl::int_<eAttributeType::eAT_DataItem> >::type,
63  typename boost::is_same<boost::mpl::int_<NodeCollType::g_itemType>,
64  boost::mpl::int_<eDataItemType::eDIT_NodeColl> >::type>::type,
65  RulePtr>::type
66 isEmpty(const boost::shared_ptr<AttributeType>& pAttribute)
67 {
68  return isEmpty<NodeCollType>(boost::weak_ptr<const AttributeType>(pAttribute));
69 }
70 
71 template <typename NodeCollType, typename AttributeType>
72 inline typename boost::enable_if<typename boost::mpl::and_<typename boost::is_same<boost::mpl::int_<AttributeType::g_attributeType>,
73  boost::mpl::int_<eAttributeType::eAT_DataItem> >::type,
74  typename boost::is_same<boost::mpl::int_<NodeCollType::g_itemType>,
75  boost::mpl::int_<eDataItemType::eDIT_NodeColl> >::type>::type,
76  RulePtr>::type
77 isEmpty(const boost::weak_ptr<const AttributeType>& pAttribute)
78 {
80  boost::shared_ptr<RuleType> pOutputRule = boost::make_shared<RuleType>();
81  pOutputRule->init(pAttribute, 0);
82 
83  return pOutputRule;
84 }
86 
89 template <typename NodeCollType, typename AttributeType>
90 inline typename boost::enable_if<typename boost::mpl::and_<typename boost::is_same<boost::mpl::int_<AttributeType::g_attributeType>,
91  boost::mpl::int_<eAttributeType::eAT_DataItem> >::type,
92  typename boost::is_same<boost::mpl::int_<NodeCollType::g_itemType>,
93  boost::mpl::int_<eDataItemType::eDIT_NodeColl> >::type>::type,
94  RulePtr>::type
95 matchSize(const boost::shared_ptr<AttributeType>& pAttribute,
96  const ipUInt32 targetSize)
97 {
98  return matchSize<NodeCollType>(boost::weak_ptr<const AttributeType>(pAttribute), targetSize);
99 }
100 
101 template <typename NodeCollType, typename AttributeType>
102 inline typename boost::enable_if<typename boost::mpl::and_<typename boost::is_same<boost::mpl::int_<AttributeType::g_attributeType>,
103  boost::mpl::int_<eAttributeType::eAT_DataItem> >::type,
104  typename boost::is_same<boost::mpl::int_<NodeCollType::g_itemType>,
105  boost::mpl::int_<eDataItemType::eDIT_NodeColl> >::type>::type,
106  RulePtr>::type
107 matchSize(const boost::weak_ptr<const AttributeType>& pAttribute,
108  const ipUInt32 targetSize)
109 {
111  boost::shared_ptr<RuleType> pOutputRule = boost::make_shared<RuleType>();
112  pOutputRule->init(pAttribute, targetSize);
113 
114  return pOutputRule;
115 }
117 
120 template <typename NodeCollType1, typename NodeCollType2, typename AttributeType1, typename AttributeType2>
121 inline typename boost::enable_if<typename boost::mpl::and_<typename boost::is_same<boost::mpl::int_<AttributeType1::g_attributeType>,
122  boost::mpl::int_<eAttributeType::eAT_DataItem> >::type,
123  typename boost::is_same<boost::mpl::int_<NodeCollType1::g_itemType>,
124  boost::mpl::int_<eDataItemType::eDIT_NodeColl> >::type,
125  typename boost::is_same<boost::mpl::int_<AttributeType2::g_attributeType>,
126  boost::mpl::int_<eAttributeType::eAT_DataItem> >::type,
127  typename boost::mpl::or_<typename boost::is_same<boost::mpl::int_<NodeCollType2::g_itemType>,
128  boost::mpl::int_<eDataItemType::eDIT_NodeColl> >::type,
129  typename boost::is_same<boost::mpl::int_<NodeCollType2::g_itemType>,
130  boost::mpl::int_<eDataItemType::eDIT_LeafColl> >::type>::type>::type,
131  RulePtr>::type
132 matchSize(const boost::shared_ptr<AttributeType1>& pAttribute1,
133  const boost::shared_ptr<AttributeType2>& pAttribute2)
134 {
135  return matchSize<NodeCollType1, NodeCollType2, AttributeType1, AttributeType2>(
136  boost::weak_ptr<const AttributeType1>(pAttribute1),
137  boost::weak_ptr<const AttributeType2>(pAttribute2));
138 }
139 
140 template <typename NodeCollType1, typename NodeCollType2, typename AttributeType1, typename AttributeType2>
141 inline typename boost::enable_if<typename boost::mpl::and_<typename boost::is_same<boost::mpl::int_<AttributeType1::g_attributeType>,
142  boost::mpl::int_<eAttributeType::eAT_DataItem> >::type,
143  typename boost::is_same<boost::mpl::int_<NodeCollType1::g_itemType>,
144  boost::mpl::int_<eDataItemType::eDIT_NodeColl> >::type,
145  typename boost::is_same<boost::mpl::int_<AttributeType2::g_attributeType>,
146  boost::mpl::int_<eAttributeType::eAT_DataItem> >::type,
147  typename boost::mpl::or_<typename boost::is_same<boost::mpl::int_<NodeCollType2::g_itemType>,
148  boost::mpl::int_<eDataItemType::eDIT_NodeColl> >::type,
149  typename boost::is_same<boost::mpl::int_<NodeCollType2::g_itemType>,
150  boost::mpl::int_<eDataItemType::eDIT_LeafColl> >::type>::type>::type,
151  RulePtr>::type
152 matchSize(const boost::weak_ptr<const AttributeType1>& pAttribute1,
153  const boost::weak_ptr<const AttributeType2>& pAttribute2)
154 {
156  boost::shared_ptr<RuleType> pOutputRule = boost::make_shared<RuleType>();
157  pOutputRule->init(pAttribute1, pAttribute2);
158 
159  return pOutputRule;
160 }
162 
165 
166 } // end of namespace processor
167 } // end of namespace ipsdk
168 
169 #endif // __IPSDKBASEPROCESSING_NODECOLLSIZERULEOPERATORS_H__
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Base operators used to combined rules.
void init(const boost::weak_ptr< const AttributeType1 > &pAttribute1, const boost::weak_ptr< const AttributeType2 > &pAttribute2)
initialization of object
Definition: RuleNodesCollSize.h:92
Concrete class for rules on size of node collections of data item attributes.
Definition: RuleNodeCollSize.h:30
boost::shared_ptr< BaseRule > RulePtr
shared pointer to rule
Definition: RuleTypes.h:104
void init(const boost::weak_ptr< const AttributeType > &pAttribute, const ipUInt32 value)
initialization of object
Definition: RuleNodeCollSize.h:77
Concrete class for rules on size of node collections of data item attributes.
Definition: RuleNodesCollSize.h:32
boost::enable_if< typename boost::mpl::and_< typename boost::is_same< boost::mpl::int_< AttributeType::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_DataItem > >::type, typename boost::is_same< boost::mpl::int_< LeafCollType::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_LeafColl > >::type >::type, RulePtr >::type matchSize(const boost::shared_ptr< AttributeType > &pAttribute, const ipUInt32 targetSize)
functions allowing to check leaf collection size
Definition: LeafCollSizeRuleOperators.h:94
boost::enable_if< typename boost::mpl::and_< typename boost::is_same< boost::mpl::int_< AttributeType::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_DataItem > >::type, typename boost::is_same< boost::mpl::int_< LeafCollType::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_LeafColl > >::type >::type, RulePtr >::type isNotEmpty(const boost::shared_ptr< AttributeType > &pAttribute)
functions allowing to check that a leaf collection is not empty
Definition: LeafCollSizeRuleOperators.h:36
boost::enable_if< typename boost::mpl::and_< typename boost::is_same< boost::mpl::int_< AttributeType::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_DataItem > >::type, typename boost::is_same< boost::mpl::int_< LeafCollType::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_LeafColl > >::type >::type, RulePtr >::type isEmpty(const boost::shared_ptr< AttributeType > &pAttribute)
functions allowing to check that a leaf collection is empty
Definition: LeafCollSizeRuleOperators.h:65
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53