IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
RuleMatchLeafToImageRange.h
1 // RuleMatchLeafToImageRange.h:
3 // ----------------------------
4 //
15 
16 #ifndef __IPSDKIMAGEPROCESSING_RULEMATCHLEAFTOIMAGERANGE_H__
17 #define __IPSDKIMAGEPROCESSING_RULEMATCHLEAFTOIMAGERANGE_H__
18 
19 #include <IPSDKImageProcessing/Rule/Image/ImageBinaryMixed/BaseRuleMatchImageRange.h>
20 #include <IPSDKImageProcessing/Attribute/Image/BaseImageAttribute.h>
21 
22 namespace ipsdk {
23 namespace imaproc {
24 
27 
28 template <typename AttributeType, typename LeafType>
30 {
31 // predefined public types
32 public:
34  typedef AttributeType ValueAttributeType;
35 
37  typedef typename boost::enable_if<typename boost::is_same<boost::mpl::int_<AttributeType::g_attributeType>,
38  boost::mpl::int_<processor::eAttributeType::eAT_DataItem> >::type,
39  typename AttributeType::ValueType>::type DataItemType;
40 
42  typedef typename boost::enable_if<typename boost::is_same<boost::mpl::int_<LeafType::g_itemType>,
43  boost::mpl::int_<eDataItemType::eDIT_Leaf> >::type,
44  typename LeafType::ValueType>::type ValueType;
45 
46 public:
52 
53 // methods
54 public:
60  void init(const ImageAttributeConstWeakPtr& pImageAttribute,
61  const boost::weak_ptr<const AttributeType>& pValueAttribute);
62 
63 protected:
65  ipReal64 retrieveValue() const;
66 
68  std::string retrieveValueAttributeName() const;
69 
70 // attributes
71 protected:
72 
73 };
74 
77 
78 template <typename AttributeType, typename LeafType>
79 inline void
81  const boost::weak_ptr<const AttributeType>& pValueAttribute)
82 {
83  // call of base class initialization method
84  BaseRuleMatchImageRange::initBase(pImageAttribute, pValueAttribute);
85 }
86 
87 template <typename AttributeType, typename LeafType>
88 inline ipReal64
90 {
91  // retrieve associated attribute
92  const AttributeType& valueAttribute = static_cast<const AttributeType&>(getAttribute2());
93 
94  return valueAttribute.getNode().template getValue<LeafType>();
95 }
96 
97 template <typename AttributeType, typename LeafType>
98 inline std::string
100 {
101  return ValueAttributeType::getObjectNameStr() + "::" +
102  DataItemType::template getNodeNameStr<LeafType>();
103 }
104 
107 
108 } // end of namespace imaproc
109 } // end of namespace ipsdk
110 
111 #endif // __IPSDKIMAGEPROCESSING_RULEMATCHLEAFTOIMAGERANGE_H__
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
boost::weak_ptr< const BaseImageAttribute > ImageAttributeConstWeakPtr
Definition: ImageAttributeTypes.h:38
std::string retrieveValueAttributeName() const
method allowing to retrieve name associated to attribute leaf in derived class
Definition: RuleMatchLeafToImageRange.h:99
void init(const ImageAttributeConstWeakPtr &pImageAttribute, const boost::weak_ptr< const AttributeType > &pValueAttribute)
initialization of object
Definition: RuleMatchLeafToImageRange.h:80
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
void initBase()
base class initialization method
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: RuleMatchLeafToImageRange.h:44
ipReal64 retrieveValue() const
method allowing to retrieve value associated to attribute leaf in derived class
Definition: RuleMatchLeafToImageRange.h:89
Base class for rules allowing to check that a value is inside an image buffer type value range...
Definition: BaseRuleMatchImageRange.h:27
boost::enable_if< typename boost::is_same< boost::mpl::int_< AttributeType::g_attributeType >, boost::mpl::int_< processor::eAttributeType::eAT_DataItem > >::type, typename AttributeType::ValueType >::type DataItemType
retrieve DataItem node type associated to attribute
Definition: RuleMatchLeafToImageRange.h:39
Rule class allowing to check that a DataItem leaf value is inside an image buffer type value range...
Definition: RuleMatchLeafToImageRange.h:29
AttributeType ValueAttributeType
Value attribute type.
Definition: RuleMatchLeafToImageRange.h:34