souffle  2.0.2-371-g6315b36
Public Types | Public Member Functions | Private Attributes
souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::iterator Class Reference

The iterator type to be utilized for scanning through btree instances. More...

#include <BTree.h>

Collaboration diagram for souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::iterator:
Collaboration graph

Public Types

using difference_type = ptrdiff_t
 
using iterator_category = std::forward_iterator_tag
 
using pointer = value_type *
 
using reference = value_type &
 
using value_type = Key
 

Public Member Functions

 iterator ()
 
 iterator (const iterator &other)
 
 iterator (node const *cur, field_index_type pos)
 
bool operator!= (const iterator &other) const
 
const Key & operator* () const
 
iteratoroperator++ ()
 
iteratoroperator= (const iterator &other)
 
bool operator== (const iterator &other) const
 
void print (std::ostream &out=std::cout) const
 

Private Attributes

node const * cur
 
field_index_type pos = 0
 

Detailed Description

template<typename Key, typename Comparator, typename Allocator, unsigned blockSize, typename SearchStrategy, bool isSet, typename WeakComparator = Comparator, typename Updater = detail::updater<Key>>
class souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::iterator

The iterator type to be utilized for scanning through btree instances.

Definition at line 1114 of file BTree.h.

Member Typedef Documentation

◆ difference_type

template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator = Comparator, typename Updater = detail::updater<Key>>
using souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::iterator::difference_type = ptrdiff_t

Definition at line 1124 of file BTree.h.

◆ iterator_category

template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator = Comparator, typename Updater = detail::updater<Key>>
using souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::iterator::iterator_category = std::forward_iterator_tag

Definition at line 1122 of file BTree.h.

◆ pointer

template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator = Comparator, typename Updater = detail::updater<Key>>
using souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::iterator::pointer = value_type*

Definition at line 1125 of file BTree.h.

◆ reference

template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator = Comparator, typename Updater = detail::updater<Key>>
using souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::iterator::reference = value_type&

Definition at line 1126 of file BTree.h.

◆ value_type

template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator = Comparator, typename Updater = detail::updater<Key>>
using souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::iterator::value_type = Key

Definition at line 1123 of file BTree.h.

Constructor & Destructor Documentation

◆ iterator() [1/3]

template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator = Comparator, typename Updater = detail::updater<Key>>
souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::iterator::iterator ( )
inline

Definition at line 1129 of file BTree.h.

1131 {

◆ iterator() [2/3]

template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator = Comparator, typename Updater = detail::updater<Key>>
souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::iterator::iterator ( node const *  cur,
field_index_type  pos 
)
inline

Definition at line 1132 of file BTree.h.

1136 {

◆ iterator() [3/3]

template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator = Comparator, typename Updater = detail::updater<Key>>
souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::iterator::iterator ( const iterator other)
inline

Definition at line 1135 of file BTree.h.

1136 {

Member Function Documentation

◆ operator!=()

template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator = Comparator, typename Updater = detail::updater<Key>>
bool souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::iterator::operator!= ( const iterator other) const
inline

Definition at line 1150 of file BTree.h.

1155  {

◆ operator*()

template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator = Comparator, typename Updater = detail::updater<Key>>
const Key& souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::iterator::operator* ( ) const
inline

◆ operator++()

template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator = Comparator, typename Updater = detail::updater<Key>>
iterator& souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::iterator::operator++ ( )
inline

Definition at line 1160 of file BTree.h.

1163  {
1164  return *this;
1165  }
1166  }
1167 
1168  // B) we are at the right-most element of a leaf => go to next inner node
1169  assert(cur->isLeaf());
1170  assert(pos == cur->getNumElements());
1171 
1172  while (cur != nullptr && pos == cur->getNumElements()) {
1174  cur = cur->getParent();
1175  }
1176  return *this;
1177  }
1178 
1179  // prints a textual representation of this iterator to the given stream (mainly for debugging)
1180  void print(std::ostream& out = std::cout) const {
1181  out << cur << "[" << (int)pos << "]";
1182  }
1183  };
1184 
1185  /**
1186  * A collection of operation hints speeding up some of the involved operations
1187  * by exploiting temporal locality.
1188  */
1189  template <unsigned size = 1>
1190  struct btree_operation_hints {
1191  using node_cache = LRUCache<node*, size>;

◆ operator=()

template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator = Comparator, typename Updater = detail::updater<Key>>
iterator& souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::iterator::operator= ( const iterator other)
inline

Definition at line 1138 of file BTree.h.

1141  {
1142  return cur->keys[pos];

◆ operator==()

template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator = Comparator, typename Updater = detail::updater<Key>>
bool souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::iterator::operator== ( const iterator other) const
inline

◆ print()

template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator = Comparator, typename Updater = detail::updater<Key>>
void souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::iterator::print ( std::ostream &  out = std::cout) const
inline

Definition at line 1194 of file BTree.h.

1209  {

Field Documentation

◆ cur

template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator = Comparator, typename Updater = detail::updater<Key>>
node const* souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::iterator::cur
private

Definition at line 1116 of file BTree.h.

◆ pos

template<typename Key , typename Comparator , typename Allocator , unsigned blockSize, typename SearchStrategy , bool isSet, typename WeakComparator = Comparator, typename Updater = detail::updater<Key>>
field_index_type souffle::detail::btree< Key, Comparator, Allocator, blockSize, SearchStrategy, isSet, WeakComparator, Updater >::iterator::pos = 0
private

Definition at line 1119 of file BTree.h.


The documentation for this class was generated from the following file:
souffle::detail::btree::base::getNumElements
size_type getNumElements() const
Definition: BTree.h:369
souffle::detail::btree::base::getParent
node * getParent() const
Definition: BTree.h:361
souffle::detail::btree::iterator::print
void print(std::ostream &out=std::cout) const
Definition: BTree.h:1194
souffle::detail::btree::node::getChildren
node ** getChildren()
Obtains a pointer to the array of child-pointers of this node – if it is an inner node.
Definition: BTree.h:508
souffle::detail::btree::node::keys
Key keys[maxKeys]
Definition: BTree.h:393
souffle::detail::btree::base::isLeaf
bool isLeaf() const
Definition: BTree.h:353
souffle::detail::btree::base::getPositionInParent
field_index_type getPositionInParent() const
Definition: BTree.h:365
souffle::detail::btree::iterator::cur
node const * cur
Definition: BTree.h:1116
souffle::detail::btree::iterator::pos
field_index_type pos
Definition: BTree.h:1119