STX B+ Tree Template Classes
0.9
|
STL-like iterator object for B+ tree items. More...
#include <btree.h>
Public Types | |
typedef btree::key_type | key_type |
The key type of the btree. Returned by key(). | |
typedef btree::data_type | data_type |
The data type of the btree. Returned by data(). | |
typedef btree::value_type | value_type |
The value type of the btree. Returned by operator*(). | |
typedef btree::pair_type | pair_type |
The pair type of the btree. | |
typedef value_type & | reference |
Reference to the value_type. STL required. | |
typedef value_type * | pointer |
Pointer to the value_type. STL required. | |
typedef std::bidirectional_iterator_tag | iterator_category |
STL-magic iterator category. | |
typedef ptrdiff_t | difference_type |
STL-magic. | |
typedef iterator | self |
Our own type. | |
Public Member Functions | |
iterator () | |
Default-Constructor of a mutable iterator. | |
iterator (typename btree::leaf_node *l, unsigned short s) | |
Initializing-Constructor of a mutable iterator. | |
iterator (const reverse_iterator &it) | |
Copy-constructor from a reverse iterator. | |
reference | operator* () const |
Dereference the iterator, this is not a value_type& because key and value are not stored together. | |
pointer | operator-> () const |
Dereference the iterator. | |
const key_type & | key () const |
Key of the current slot. | |
data_type & | data () const |
Writable reference to the current data object. | |
self & | operator++ () |
Prefix++ advance the iterator to the next slot. | |
self | operator++ (int) |
Postfix++ advance the iterator to the next slot. | |
self & | operator-- () |
Prefix-- backstep the iterator to the last slot. | |
self | operator-- (int) |
Postfix-- backstep the iterator to the last slot. | |
bool | operator== (const self &x) const |
Equality of iterators. | |
bool | operator!= (const self &x) const |
Inequality of iterators. | |
Private Attributes | |
btree::leaf_node * | currnode |
The currently referenced leaf node of the tree. | |
unsigned short | currslot |
Current key/data slot referenced. | |
value_type | temp_value |
Evil! A temporary value_type to STL-correctly deliver operator* and operator-> | |
Friends | |
class | const_iterator |
Friendly to the const_iterator, so it may access the two data items directly. | |
class | reverse_iterator |
Also friendly to the reverse_iterator, so it may access the two data items directly. | |
class | const_reverse_iterator |
Also friendly to the const_reverse_iterator, so it may access the two data items directly. | |
class | btree< key_type, data_type, value_type, key_compare, traits, allow_duplicates, allocator_type, used_as_set > |
Also friendly to the base btree class, because erase_iter() needs to read the currnode and currslot values directly. |
STL-like iterator object for B+ tree items.
The iterator points to a specific slot number in a leaf.
typedef btree::data_type stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::data_type |
typedef ptrdiff_t stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::difference_type |
typedef std::bidirectional_iterator_tag stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::iterator_category |
typedef btree::key_type stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::key_type |
typedef btree::pair_type stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::pair_type |
typedef value_type* stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::pointer |
typedef value_type& stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::reference |
typedef iterator stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::self |
typedef btree::value_type stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::value_type |
The value type of the btree. Returned by operator*().
stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::iterator | ( | ) | [inline] |
stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::iterator | ( | typename btree::leaf_node * | l, |
unsigned short | s | ||
) | [inline] |
stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::iterator | ( | const reverse_iterator & | it | ) | [inline] |
data_type& stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::data | ( | ) | const [inline] |
Writable reference to the current data object.
Definition at line 536 of file btree.h.
References stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::currnode, stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::currslot, stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::leaf_node::slotdata, and stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::used_as_set.
Referenced by stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator*(), and stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator->().
const key_type& stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::key | ( | ) | const [inline] |
Key of the current slot.
Definition at line 530 of file btree.h.
References stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::currnode, stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::currslot, and stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::leaf_node::slotkey.
Referenced by stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator*(), and stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator->().
bool stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator!= | ( | const self & | x | ) | const [inline] |
Inequality of iterators.
Definition at line 624 of file btree.h.
References stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::currnode, and stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::currslot.
reference stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator* | ( | ) | const [inline] |
Dereference the iterator, this is not a value_type& because key and value are not stored together.
Definition at line 514 of file btree.h.
References stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::data(), stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::key(), and stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::temp_value.
self& stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator++ | ( | ) | [inline] |
Prefix++ advance the iterator to the next slot.
Definition at line 542 of file btree.h.
References stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::currnode, stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::currslot, stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::leaf_node::nextleaf, and stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::node::slotuse.
self stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator++ | ( | int | ) | [inline] |
Postfix++ advance the iterator to the next slot.
Definition at line 560 of file btree.h.
References stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::currnode, stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::currslot, stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::leaf_node::nextleaf, and stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::node::slotuse.
self& stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator-- | ( | ) | [inline] |
Prefix-- backstep the iterator to the last slot.
Definition at line 580 of file btree.h.
References stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::currnode, stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::currslot, stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::leaf_node::prevleaf, and stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::node::slotuse.
self stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator-- | ( | int | ) | [inline] |
Postfix-- backstep the iterator to the last slot.
Definition at line 598 of file btree.h.
References stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::currnode, stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::currslot, stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::leaf_node::prevleaf, and stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::node::slotuse.
pointer stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator-> | ( | ) | const [inline] |
Dereference the iterator.
Do not use this if possible, use key() and data() instead. The B+ tree does not stored key and data together.
Definition at line 523 of file btree.h.
References stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::data(), stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::key(), and stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::temp_value.
bool stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator== | ( | const self & | x | ) | const [inline] |
Equality of iterators.
Definition at line 618 of file btree.h.
References stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::currnode, and stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::currslot.
friend class btree< key_type, data_type, value_type, key_compare,traits, allow_duplicates, allocator_type, used_as_set > [friend] |
friend class const_iterator [friend] |
Friendly to the const_iterator, so it may access the two data items directly.
friend class const_reverse_iterator [friend] |
Also friendly to the const_reverse_iterator, so it may access the two data items directly.
friend class reverse_iterator [friend] |
Also friendly to the reverse_iterator, so it may access the two data items directly.
btree::leaf_node* stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::currnode [private] |
The currently referenced leaf node of the tree.
Definition at line 463 of file btree.h.
Referenced by stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::data(), stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::key(), stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator!=(), stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator++(), stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator--(), and stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator==().
unsigned short stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::currslot [private] |
Current key/data slot referenced.
Definition at line 466 of file btree.h.
Referenced by stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::data(), stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::key(), stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator!=(), stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator++(), stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator--(), and stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator==().
value_type stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::temp_value [mutable, private] |
Evil! A temporary value_type to STL-correctly deliver operator* and operator->
Definition at line 487 of file btree.h.
Referenced by stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator*(), and stx::btree< _Key, _Data, _Value, _Compare, _Traits, _Duplicates, _Alloc, _UsedAsSet >::iterator::operator->().