IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
RuleLeafProperty.h
1 // RuleLeafProperty.h:
3 // -------------------
4 //
15 
16 #ifndef __IPSDKBASEPROCESSING_RULELEAFPROPERTY_H__
17 #define __IPSDKBASEPROCESSING_RULELEAFPROPERTY_H__
18 
19 #include <IPSDKBaseProcessing/Rule/Attribute/DataItem/Leaf/LeafProperty/BaseTLeafPropertyRule.h>
20 
21 namespace ipsdk {
22 namespace processor {
23 
26 
27 template <typename AttributeType,
28  typename LeafType,
29  eValuePropertyRuleType::domain ValuePropertyRuleType>
30 class RuleLeafProperty : public BaseTLeafPropertyRule<typename LeafType::ValueType,
31  ValuePropertyRuleType>
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_Leaf> >::type,
43  typename LeafType::ValueType>::type ValueType;
44 
45 public:
48  RuleLeafProperty() {}
49  ~RuleLeafProperty() {}
51 
52 // methods
53 public:
57  void init(const boost::weak_ptr<const AttributeType>& pAttribute);
58 
59 protected:
61  std::string getAttributeName() const;
62 
64  const ValueType& getAttributeValue() const;
65 
66 
67 // attributes
68 protected:
69 
70 };
71 
74 
75 template <typename AttributeType, typename LeafType, eValuePropertyRuleType::domain ValuePropertyRuleType>
76 inline void
77 RuleLeafProperty<AttributeType, LeafType, ValuePropertyRuleType>::init(const boost::weak_ptr<const AttributeType>& pAttribute)
78 {
79  // call of base class initialization method
81 }
82 
83 template <typename AttributeType, typename LeafType, eValuePropertyRuleType::domain ValuePropertyRuleType>
84 inline std::string
86 {
87  return AttributeType::getObjectNameStr() + "::" +
88  DataItemType::template getNodeNameStr<LeafType>();
89 }
90 
91 template <typename AttributeType, typename LeafType, eValuePropertyRuleType::domain ValuePropertyRuleType>
94 {
95  // retrieve associated attribute
96  const AttributeType& derivedAttribute = static_cast<const AttributeType&>(this->getAttribute1());
97 
98  return derivedAttribute.getNode().template getValue<LeafType>();
99 }
100 
103 
104 } // end of namespace processor
105 } // end of namespace ipsdk
106 
107 #endif // __IPSDKBASEPROCESSING_RULELEAFPROPERTY_H__
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Concrete class for rule allowing to check properties of leafs of data item attributes.
Definition: RuleLeafProperty.h:30
void init(const boost::weak_ptr< const AttributeType > &pAttribute)
initialization of object
Definition: RuleLeafProperty.h:77
void initBase()
base class initialization method
const ValueType & getAttributeValue() const
method allowing to retrieve attribute value into derived class
Definition: RuleLeafProperty.h:93
Base template class for rule allowing to check properties of leafs of data item attributes.
Definition: BaseTLeafPropertyRule.h:28
std::string getAttributeName() const
method allowing to retrieve attribute name into derived class
Definition: RuleLeafProperty.h:85
boost::enable_if< typename boost::is_same< boost::mpl::int_< LeafType::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_Leaf > >::type, typename LeafType::ValueType >::type ValueType
Value type associated to leaf.
Definition: RuleLeafProperty.h:43
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: RuleLeafProperty.h:38