IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
RuleMatchValueToImageSize.h
1 // RuleMatchValueToImageSize.h:
3 // ----------------------------
4 //
15 
16 #ifndef __IPSDKIMAGEPROCESSING_RULEMATCHVALUETOIMAGESIZE_H__
17 #define __IPSDKIMAGEPROCESSING_RULEMATCHVALUETOIMAGESIZE_H__
18 
19 #include <IPSDKImageProcessing/Rule/Image/ImageBinaryMixed/BaseRuleMatchScalarToImageSize.h>
20 #include <IPSDKImageProcessing/Attribute/Image/BaseImageAttribute.h>
21 
22 namespace ipsdk {
23 namespace imaproc {
24 
27 
28 template <typename AttributeType>
30 {
31 // predefined public types
32 public:
34  typedef AttributeType ValueAttributeType;
35 
36 public:
42 
43 // methods
44 public:
50  void init(const eMatchImageSizeType& matchImageSizeType,
51  const eMatchImageSizeScale& matchImageSizeScale,
52  const ImageAttributeConstWeakPtr& pImageAttribute,
53  const boost::weak_ptr<const AttributeType>& pValueAttribute);
54 
55 protected:
57  ipReal64 retrieveValue() const;
58 
60  std::string retrieveValueAttributeName() const;
61 
62 // attributes
63 protected:
64 
65 };
66 
69 
70 template <typename AttributeType>
71 inline void
73  const eMatchImageSizeScale& matchImageSizeScale,
74  const ImageAttributeConstWeakPtr& pImageAttribute,
75  const boost::weak_ptr<const AttributeType>& pValueAttribute)
76 {
77  // store dimensions considered in the size check in the image
78  _matchImageSizeType = matchImageSizeType;
79 
80  // store image size scale
81  _matchImageSizeScale = matchImageSizeScale;
82 
83  // call of base class initialization method
84  initBase(pImageAttribute, pValueAttribute);
85 }
86 
87 template <typename AttributeType>
88 inline ipReal64
90 {
91  // retrieve associated attribute
92  const AttributeType& valueAttribute = static_cast<const AttributeType&>(getAttribute2());
93 
94  return valueAttribute.getValue();
95 }
96 
97 template <typename AttributeType>
98 inline std::string
100 {
101  // retrieve associated attribute
102  const AttributeType& valueAttribute = static_cast<const AttributeType&>(getAttribute2());
103 
104  return valueAttribute.getObjectName();
105 }
106 
109 
110 } // end of namespace imaproc
111 } // end of namespace ipsdk
112 
113 #endif // __IPSDKIMAGEPROCESSING_RULEMATCHVALUETOIMAGESIZE_H__
eMatchImageSizeScale
enumerate used in comparison between scalar and image size, to determine whether scalar is compared t...
Definition: ImageBinaryMixedRuleTypes.h:59
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
AttributeType ValueAttributeType
Value attribute type.
Definition: RuleMatchValueToImageSize.h:34
boost::weak_ptr< const BaseImageAttribute > ImageAttributeConstWeakPtr
Definition: ImageAttributeTypes.h:38
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
std::string retrieveValueAttributeName() const
method allowing to retrieve value associated to attribute leaf in derived class
Definition: RuleMatchValueToImageSize.h:99
ipReal64 retrieveValue() const
method allowing to retrieve value associated to attribute leaf in derived class
Definition: RuleMatchValueToImageSize.h:89
void init(const eMatchImageSizeType &matchImageSizeType, const eMatchImageSizeScale &matchImageSizeScale, const ImageAttributeConstWeakPtr &pImageAttribute, const boost::weak_ptr< const AttributeType > &pValueAttribute)
initialization of object
Definition: RuleMatchValueToImageSize.h:72
Base class for rules allowing to check that a value is lower than the smallest dimension of an image...
Definition: BaseRuleMatchScalarToImageSize.h:31
eMatchImageSizeType
enumerate describing image comparison on image size rule operation type
Definition: ImageRuleTypes.h:50
Rule class allowing to check that a value is lower than or equals to image size in given dimension(s)...
Definition: RuleMatchValueToImageSize.h:29