taco-db  0.1.0
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
taco::Index::Iterator Class Referenceabstract

A forward-iterator for the items in the index. More...

#include <index/Index.h>

Inheritance diagram for taco::Index::Iterator:
taco::BTree::Iterator taco::VolatileTree::Iterator

Public Member Functions

 Iterator ()=default
 
 Iterator (const Iterator &)=delete
 
Iteratoroperator= (const Iterator &)=delete
 
 Iterator (Iterator &&it)=default
 Default move constructor. More...
 
Iteratoroperator= (Iterator &&it)=default
 Default move assignment. More...
 
virtual ~Iterator ()=default
 
constexpr const IndexGetIndex () const
 Returns the underlying index. More...
 
virtual bool Next ()=0
 Moves the iterator to the next indexed item if any. More...
 
virtual bool IsAtValidItem ()=0
 Returns whether the iterator is currently at a valid indexed item. More...
 
virtual const RecordGetCurrentItem ()=0
 Returns the current indexed item the iterator is currently at, where the GetData() and GetLength() pair describes a valid buffer that contains the key, and GetRecordId() is set to the record ID of the heap record (not the index record!). More...
 
virtual RecordId GetCurrentRecordId ()=0
 Returns the record id of the indexed item the iterator is currently at. More...
 
virtual void EndScan ()=0
 Ends the index scan. More...
 

Protected Member Functions

 Iterator (Index *index)
 
template<class T >
constexpr T * GetIndexAs () const
 Static casts the m_index pointer to T* type. More...
 

Private Attributes

Indexm_index
 

Detailed Description

A forward-iterator for the items in the index.

To move to the next item, one should call Next() and check if it returns true. It cannot go back to a previously returned item once another Next() is called.

Constructor & Destructor Documentation

◆ Iterator() [1/4]

taco::Index::Iterator::Iterator ( )
default

◆ Iterator() [2/4]

taco::Index::Iterator::Iterator ( const Iterator )
delete

◆ Iterator() [3/4]

taco::Index::Iterator::Iterator ( Iterator &&  it)
default

Default move constructor.

◆ ~Iterator()

virtual taco::Index::Iterator::~Iterator ( )
virtualdefault

Reimplemented in taco::BTree::Iterator.

◆ Iterator() [4/4]

taco::Index::Iterator::Iterator ( Index index)
inlineprotected

Member Function Documentation

◆ EndScan()

virtual void taco::Index::Iterator::EndScan ( )
pure virtual

Ends the index scan.

Implemented in taco::VolatileTree::Iterator, and taco::BTree::Iterator.

◆ GetCurrentItem()

virtual const Record& taco::Index::Iterator::GetCurrentItem ( )
pure virtual

Returns the current indexed item the iterator is currently at, where the GetData() and GetLength() pair describes a valid buffer that contains the key, and GetRecordId() is set to the record ID of the heap record (not the index record!).

Implemented in taco::VolatileTree::Iterator, and taco::BTree::Iterator.

◆ GetCurrentRecordId()

virtual RecordId taco::Index::Iterator::GetCurrentRecordId ( )
pure virtual

Returns the record id of the indexed item the iterator is currently at.

Implemented in taco::VolatileTree::Iterator, and taco::BTree::Iterator.

◆ GetIndex()

constexpr const Index* taco::Index::Iterator::GetIndex ( ) const
inlineconstexpr

Returns the underlying index.

◆ GetIndexAs()

template<class T >
constexpr T* taco::Index::Iterator::GetIndexAs ( ) const
inlineconstexprprotected

Static casts the m_index pointer to T* type.

This should only be used when the caller is sure about the index type, e.g., a subclass of Iterator that invoked the Index(Index*) constructor.

◆ IsAtValidItem()

virtual bool taco::Index::Iterator::IsAtValidItem ( )
pure virtual

Returns whether the iterator is currently at a valid indexed item.

Implemented in taco::VolatileTree::Iterator, and taco::BTree::Iterator.

◆ Next()

virtual bool taco::Index::Iterator::Next ( )
pure virtual

Moves the iterator to the next indexed item if any.

Returns true if there's one, or false if there's not.

Implemented in taco::VolatileTree::Iterator, and taco::BTree::Iterator.

◆ operator=() [1/2]

Iterator& taco::Index::Iterator::operator= ( const Iterator )
delete

◆ operator=() [2/2]

Iterator& taco::Index::Iterator::operator= ( Iterator &&  it)
default

Default move assignment.

Member Data Documentation

◆ m_index

Index* taco::Index::Iterator::m_index
private

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