XRootD
Loading...
Searching...
No Matches
XrdCephBuffer::Extent Class Reference

#include <BufferUtils.hh>

+ Collaboration diagram for XrdCephBuffer::Extent:

Public Member Functions

 Extent (off_t offset, size_t len)
 Ecapsulates an offsets and length, with added functionaliyu Class that represents an offset possition and a length. Simplest usecase is to avoid passing two values around, however this class provides additional funcationality for manipulation of extends (e.g. merging, splitting) which may prove useful.
 
bool allInExtent (off_t pos, size_t len) const
 is all the range in this extent
 
off_t begin () const
 Same as offset, but a bit more stl container like.
 
Extent containedExtent (const Extent &in) const
 
Extent containedExtent (off_t pos, size_t len) const
 return the subset of range that is in this extent
 
bool empty () const
 
off_t end () const
 similar to stl vector end.
 
bool in_extent (off_t pos) const
 is this position within the range of this extent
 
bool isContiguous (const Extent &rhs) const
 
off_t last_pos () const
 last real position
 
size_t len () const
 
off_t offset () const
 
bool operator< (const Extent &rhs) const
 
bool operator== (const Extent &rhs) const
 
bool someInExtent (off_t pos, size_t len) const
 is some of the range in this extent
 

Detailed Description

Definition at line 53 of file BufferUtils.hh.

Constructor & Destructor Documentation

◆ Extent()

XrdCephBuffer::Extent::Extent ( off_t offset,
size_t len )
inline

Ecapsulates an offsets and length, with added functionaliyu Class that represents an offset possition and a length. Simplest usecase is to avoid passing two values around, however this class provides additional funcationality for manipulation of extends (e.g. merging, splitting) which may prove useful.

Definition at line 64 of file BufferUtils.hh.

64: m_offset(offset), m_len(len){}
off_t offset() const
size_t len() const

Referenced by containedExtent().

+ Here is the caller graph for this function:

Member Function Documentation

◆ allInExtent()

bool Extent::allInExtent ( off_t pos,
size_t len ) const

is all the range in this extent

Definition at line 28 of file BufferUtils.cc.

29{
30 // is all the range in this extent
31 if ((pos < begin()) || (pos >= end()))
32 return false;
33
34 if (off_t(pos + len) > end())
35 return false;
36 return true;
37}
off_t end() const
similar to stl vector end.
off_t begin() const
Same as offset, but a bit more stl container like.

References begin(), end(), and len().

+ Here is the call graph for this function:

◆ begin()

off_t XrdCephBuffer::Extent::begin ( ) const
inline

Same as offset, but a bit more stl container like.

Definition at line 67 of file BufferUtils.hh.

Referenced by allInExtent(), containedExtent(), containedExtent(), in_extent(), isContiguous(), operator<(), operator==(), XrdCephBuffer::ExtentHolder::push_back(), and someInExtent().

+ Here is the caller graph for this function:

◆ containedExtent() [1/2]

Extent Extent::containedExtent ( const Extent & in) const

Definition at line 53 of file BufferUtils.cc.

54{
55 return containedExtent(rhs.begin(), rhs.len());
56}
Extent containedExtent(off_t pos, size_t len) const
return the subset of range that is in this extent

References begin(), containedExtent(), and len().

+ Here is the call graph for this function:

◆ containedExtent() [2/2]

Extent Extent::containedExtent ( off_t pos,
size_t len ) const

return the subset of range that is in this extent

Definition at line 45 of file BufferUtils.cc.

46{
47 // return the subset of input range that is in this extent
48 off_t subbeg = std::max(begin(), pos);
49 off_t subend = std::min(end(), off_t(pos + len));
50
51 return Extent(subbeg, subend - subbeg);
52}
Extent(off_t offset, size_t len)
Ecapsulates an offsets and length, with added functionaliyu Class that represents an offset possition...

References Extent(), begin(), end(), and len().

Referenced by containedExtent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ empty()

bool XrdCephBuffer::Extent::empty ( ) const
inline

Definition at line 69 of file BufferUtils.hh.

69{return m_len == 0;}

◆ end()

off_t XrdCephBuffer::Extent::end ( ) const
inline

similar to stl vector end.

Definition at line 68 of file BufferUtils.hh.

Referenced by allInExtent(), containedExtent(), in_extent(), isContiguous(), operator<(), operator==(), XrdCephBuffer::ExtentHolder::push_back(), and someInExtent().

+ Here is the caller graph for this function:

◆ in_extent()

bool Extent::in_extent ( off_t pos) const

is this position within the range of this extent

Definition at line 15 of file BufferUtils.cc.

16{
17 return ((pos > begin()) && (pos < end()));
18}

References begin(), and end().

+ Here is the call graph for this function:

◆ isContiguous()

bool Extent::isContiguous ( const Extent & rhs) const

Does the start of the rhs continue directly from the end of this Extent

Definition at line 20 of file BufferUtils.cc.

21{
22 // does the rhs connect directly to the end of the first
23 if (end() != rhs.begin())
24 return false;
25 return true;
26}

References begin(), and end().

+ Here is the call graph for this function:

◆ last_pos()

off_t XrdCephBuffer::Extent::last_pos ( ) const
inline

last real position

Definition at line 77 of file BufferUtils.hh.

◆ len()

size_t XrdCephBuffer::Extent::len ( ) const
inline

Definition at line 66 of file BufferUtils.hh.

66{ return m_len; }

Referenced by allInExtent(), XrdCephBuffer::ExtentHolder::bytesMissing(), containedExtent(), containedExtent(), and someInExtent().

+ Here is the caller graph for this function:

◆ offset()

off_t XrdCephBuffer::Extent::offset ( ) const
inline

Definition at line 65 of file BufferUtils.hh.

65{ return m_offset; }

◆ operator<()

bool Extent::operator< ( const Extent & rhs) const

Definition at line 58 of file BufferUtils.cc.

59{
60 // comparison primarily on begin values
61 // use end values if begin values are equal.
62
63 if (begin() > rhs.begin()) return false;
64 if (begin() < rhs.begin()) return true;
65 if (end() < rhs.end() ) return true;
66 return false;
67}

References begin(), and end().

+ Here is the call graph for this function:

◆ operator==()

bool Extent::operator== ( const Extent & rhs) const

Definition at line 68 of file BufferUtils.cc.

69{
70 // equivalence based only on start and end
71 if (begin() != rhs.begin())
72 return false;
73 if (end() != rhs.end())
74 return false;
75 return true;
76}

References begin(), and end().

+ Here is the call graph for this function:

◆ someInExtent()

bool Extent::someInExtent ( off_t pos,
size_t len ) const

is some of the range in this extent

Definition at line 38 of file BufferUtils.cc.

39{ // is some of the range in this extent
40 if ((off_t(pos + len) < begin()) || (pos >= end()))
41 return false;
42 return true;
43}

References begin(), end(), and len().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: