/* */ #ifndef _D_RANGE_H_ #define _D_RANGE_H_ #include "common.h" class Range { private: int64_t startByte; int64_t endByte; int64_t entityLength; public: Range():startByte(0), endByte(0), entityLength(0) {} Range(int64_t startByte, int64_t endByte, int64_t entityLength): startByte(startByte), endByte(endByte), entityLength(entityLength) {} bool operator==(const Range& range) const { return startByte == range.startByte && endByte == range.endByte && entityLength == range.entityLength; } bool operator!=(const Range& range) const { return !(*this == range); } int64_t getStartByte() const { return startByte; } int64_t getEndByte() const { return endByte; } int64_t getEntityLength() const { return entityLength; } int64_t getContentLength() const { if(endByte >= startByte) { return endByte-startByte+1; } else { return 0; } } }; typedef SharedHandle RangeHandle; #endif // _D_RANGE_H_