IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
ElementsRange.h
1 // ElementsRange.h:
3 // ----------------
4 //
15 
16 #ifndef __IPSDKBASEDATA_ELEMENTSRANGE_H__
17 #define __IPSDKBASEDATA_ELEMENTSRANGE_H__
18 
20 #include <IPSDKSerialization/Engine/BaseSerializationObject.h>
21 
22 namespace ipsdk {
23 
26 
28 {
29  // declare serial class
31 
32 public:
35  ElementsRange();
36  ElementsRange(const ipUInt64 startOffset,
37  const ipUInt64 nbElements);
38  ~ElementsRange();
40 
41 // methods
42 public:
45  void init(const ipUInt64 startOffset,
46  const ipUInt64 nbElements);
47  void setStartOffset(const ipUInt64 startOffset);
48  void setNbElements(const ipUInt64 nbElements);
50 
52  ipUInt64 getStartOffset() const;
53 
55  ipUInt64 getNbElements() const;
56 
58  ipUInt64 getEndOffset() const;
59 
61  bool contains(const ipUInt64 index) const;
62 
65  bool operator== (const ElementsRange& elementsRange) const;
66  bool operator!= (const ElementsRange& elementsRange) const;
67  bool operator< (const ElementsRange& elementsRange) const;
69 
70 // attributes
71 protected:
74 
77 };
78 
81 
82 inline void
83 ElementsRange::init(const ipUInt64 startOffset,
84  const ipUInt64 nbElements)
85 {
86  _startOffset = startOffset;
87  _nbElements = nbElements;
88 }
89 
90 inline void
92 {
93  _startOffset = startOffset;
94 }
95 
96 inline void
98 {
99  _nbElements = nbElements;
100 }
101 
102 inline ipUInt64
104 {
105  return _startOffset;
106 }
107 
108 inline ipUInt64
110 {
111  return _nbElements;
112 }
113 
114 inline ipUInt64
116 {
117  return _startOffset + _nbElements;
118 }
119 
120 inline bool
122 {
123  return (index >= _startOffset) &&
124  (index < getEndOffset());
125 }
126 
129 
130 } // end of namespace ipsdk
131 
132 #endif // __IPSDKBASEDATA_ELEMENTSRANGE_H__
void setStartOffset(const ipUInt64 startOffset)
initialize elements range
Definition: ElementsRange.h:91
#define IPSDK_DECLARE_SERIAL_WITH_COPY(libraryName, className)
macro enabling serialization on class
Definition: SerializationHdrMacro.h:73
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
IPSDKBASEDATA_API bool operator==(const OffsetXY &offset1, const OffsetXY &offset2)
Comparison operators for offsets.
IPSDKBASEDATA_API bool operator<(const OffsetXY &offset1, const OffsetXY &offset2)
Comparison operators for offsets.
ipUInt64 _startOffset
elements start offset
Definition: ElementsRange.h:73
void init(const ipUInt64 startOffset, const ipUInt64 nbElements)
initialize elements range
Definition: ElementsRange.h:83
uint64_t ipUInt64
Base types definition.
Definition: BaseTypes.h:55
ipUInt64 getNbElements() const
retrieve number of elements
Definition: ElementsRange.h:109
ipUInt64 _nbElements
number of elements
Definition: ElementsRange.h:76
Definition of import/export macro for library.
boost::enable_if< typename boost::mpl::and_< typename boost::is_same< boost::mpl::int_< AttributeType1::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_Value > >::type, typename boost::is_same< boost::mpl::int_< AttributeType2::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_Value > >::type, typename boost::is_same< typename AttributeType1::ValueType, typename AttributeType2::ValueType >::type >::type, RulePtr >::type operator!=(const boost::shared_ptr< AttributeType1 > &pAttribute1, const boost::shared_ptr< AttributeType2 > &pAttribute2)
Rule allowing to check whether a value attribute is not equal another.
Definition: AttributeComparisonRuleOperators.h:77
Class allowing to store information about elements range (start offset and number of elements) ...
Definition: ElementsRange.h:27
bool contains(const ipUInt64 index) const
check whether a given index is contained by range
Definition: ElementsRange.h:121
void setNbElements(const ipUInt64 nbElements)
initialize elements range
Definition: ElementsRange.h:97
ipUInt64 getEndOffset() const
retrieve data end offset
Definition: ElementsRange.h:115
#define IPSDKBASEDATA_API
Import/Export macro for library IPSDKUtil.
Definition: IPSDKBaseDataExports.h:27
ipUInt64 getStartOffset() const
retrieve elements start offset
Definition: ElementsRange.h:103
Base class for serializable class.
Definition: BaseSerializationObject.h:33