MCPcopy Create free account
hub / github.com/ceph/ceph / iterator

Class iterator

src/include/interval_set.h:59–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57 class const_iterator;
58
59 class iterator
60 {
61 public:
62 using difference_type = ssize_t;
63 using value_type = typename Map::value_type;
64 using pointer = typename Map::value_type*;
65 using reference = typename Map::value_type&;
66 using iterator_category = std::forward_iterator_tag;
67
68 explicit iterator(typename Map::iterator iter)
69 : _iter(iter)
70 { }
71
72 // For the copy constructor and assignment operator, the compiler-generated functions, which
73 // perform simple bitwise copying, should be fine.
74
75 bool operator==(const iterator& rhs) const {
76 return (_iter == rhs._iter);
77 }
78
79 bool operator!=(const iterator& rhs) const {
80 return (_iter != rhs._iter);
81 }
82
83 // Dereference this iterator to get a pair.
84 reference operator*() const {
85 return *_iter;
86 }
87
88 // Return the interval start.
89 offset_type get_start() const {
90 return _iter->first;
91 }
92
93 // Return the interval length.
94 length_type get_len() const {
95 return _iter->second;
96 }
97
98 offset_type get_end() const {
99 return _iter->first + _iter->second;
100 }
101
102 // Set the interval length.
103 void set_len(const length_type& len) {
104 _iter->second = len;
105 }
106
107 // Preincrement
108 iterator& operator++()
109 {
110 ++_iter;
111 return *this;
112 }
113
114 // Postincrement
115 iterator operator++(int)
116 {

Callers 4

beginMethod · 0.70
lower_boundMethod · 0.70
endMethod · 0.70
eraseMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected