SegPageIter.h

Go to the documentation of this file.
00001 /*
00002 // $Id: //open/dev/fennel/segment/SegPageIter.h#11 $
00003 // Fennel is a library of data storage and processing components.
00004 // Copyright (C) 2005-2009 The Eigenbase Project
00005 // Copyright (C) 2005-2009 SQLstream, Inc.
00006 // Copyright (C) 2005-2009 LucidEra, Inc.
00007 // Portions Copyright (C) 1999-2009 John V. Sichi
00008 //
00009 // This program is free software; you can redistribute it and/or modify it
00010 // under the terms of the GNU General Public License as published by the Free
00011 // Software Foundation; either version 2 of the License, or (at your option)
00012 // any later version approved by The Eigenbase Project.
00013 //
00014 // This program is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with this program; if not, write to the Free Software
00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 */
00023 
00024 #ifndef Fennel_SegPageIter_Included
00025 #define Fennel_SegPageIter_Included
00026 
00027 #include <vector>
00028 #include "fennel/segment/SegmentAccessor.h"
00029 
00030 FENNEL_BEGIN_NAMESPACE
00031 
00032 class Segment;
00033 
00044 class FENNEL_SEGMENT_EXPORT SegPageIter
00045 {
00049     uint prefetchPagesMax;
00050 
00055     uint prefetchThrottleRate;
00056 
00060     uint currPageSlot;
00061 
00065     bool noPrefetch;
00066 
00071     uint throttleCount;
00072 
00076     bool forceReject;
00077 
00078 protected:
00082     SegmentAccessor segmentAccessor;
00083 
00087     PageId endPageId;
00088 
00092     std::vector<PageId> prefetchQueue;
00093 
00097     uint iFetch;
00098 
00103     bool atEnd;
00104 
00108     uint queueSize;
00109 
00114     int nFreePageSlots;
00115 
00120     void initPrefetchQueue();
00121 
00127     void prefetchPage(PageId pageId);
00128 
00129 public:
00133     explicit SegPageIter();
00134 
00148     void mapRange(
00149         SegmentAccessor const &segmentAccessor,
00150         PageId beginPageId,
00151         PageId endPageId = NULL_PAGE_ID);
00152 
00156     PageId operator *() const
00157     {
00158         assert(!isSingular());
00159         return prefetchQueue[iFetch];
00160     }
00161 
00166     void operator ++ ();
00167 
00172     void forcePrefetchReject();
00173 
00177     void makeSingular()
00178     {
00179         segmentAccessor.reset();
00180     }
00181 
00185     bool isSingular() const
00186     {
00187         return segmentAccessor.pSegment ? false : true;
00188     }
00189 };
00190 
00191 FENNEL_END_NAMESPACE
00192 
00193 #endif
00194 
00195 // End SegPageIter.h

Generated on Mon Jun 22 04:00:20 2009 for Fennel by  doxygen 1.5.1