#ifndef _LOG_ITERATORS_H_ #define _LOG_ITERATORS_H_ #include #include #undef begin #undef end template class DataPage; ////////////////////////////////////////////////////////////// // memTreeIterator ///////////////////////////////////////////////////////////// template class memTreeIterator { private: typedef typename MEMTREE::const_iterator MTITER; public: memTreeIterator( MEMTREE *s ) : first_(true), it_(s->begin()), itend_(s->end()) { } memTreeIterator( MEMTREE *s, TUPLE &key ) : first_(true), it_(s->find(key)), itend_(s->end()) { } ~memTreeIterator() { } TUPLE* getnext() { if(it_==itend_) { return NULL; } if(first_) { first_ = 0;} else { it_++; } TUPLE *t = new TUPLE(); t->clone(*it_); return t; } private: explicit memTreeIterator() { abort(); } void operator=(memTreeIterator & t) { abort(); } int operator-(memTreeIterator & t) { abort(); } private: bool first_; MTITER it_; MTITER itend_; }; ///////////////////////////////////////////////////////////////// template class treeIterator { public: explicit treeIterator(recordid tree); explicit treeIterator(recordid tree,TUPLE &key); ~treeIterator(); TUPLE * getnext(); private: inline void init_helper(); explicit treeIterator() { abort(); } void operator=(treeIterator & t) { abort(); } int operator-(treeIterator & t) { abort(); } private: recordid tree_; //root of the tree lladdIterator_t * lsmIterator_; //logtree iterator pageid_t curr_pageid; //current page id DataPage *curr_page; //current page typedef typename DataPage::RecordIterator DPITR_T; DPITR_T *dp_itr; TUPLE *curr_tuple; //current tuple }; #endif