MockSegPageEntryIterSource Class Reference

A mock SegPageEntryIterSource that pre-fetches every other page, returning each page twice. More...

#include <MockSegPageEntryIterSource.h>

Inheritance diagram for MockSegPageEntryIterSource:

SegPageEntryIterSource< int > List of all members.

Public Member Functions

 MockSegPageEntryIterSource (SegmentAccessor const &segmentAccessorInit, PageId beginPageId)
virtual ~MockSegPageEntryIterSource ()
virtual PageId getNextPageForPrefetch (int &entry, bool &found)
 Retrieves the next pageId to be pre-fetched, also filling in context- specific information associated with the page.
virtual void initPrefetchEntry (int &entry)
 Initializes a specific entry in the pre-fetch queue.

Private Attributes

int counter
PageId nextPageId
SegmentAccessor segmentAccessor

Detailed Description

A mock SegPageEntryIterSource that pre-fetches every other page, returning each page twice.

The context associated with each page returned is a sequencing counter, starting at 0.

Definition at line 39 of file MockSegPageEntryIterSource.h.


Constructor & Destructor Documentation

MockSegPageEntryIterSource::MockSegPageEntryIterSource ( SegmentAccessor const &  segmentAccessorInit,
PageId  beginPageId 
) [explicit]

Definition at line 30 of file MockSegPageEntryIterSource.cpp.

References counter, nextPageId, and segmentAccessor.

00033     : SegPageEntryIterSource<int>()
00034 {
00035     counter = 0;
00036     segmentAccessor = segmentAccessorInit;
00037     nextPageId = beginPageId;
00038 }

MockSegPageEntryIterSource::~MockSegPageEntryIterSource (  )  [virtual]

Definition at line 40 of file MockSegPageEntryIterSource.cpp.

00041 {
00042 }


Member Function Documentation

PageId MockSegPageEntryIterSource::getNextPageForPrefetch ( int &  entry,
bool &  found 
) [virtual]

Retrieves the next pageId to be pre-fetched, also filling in context- specific information associated with the page.

Parameters:
[in,out] entry the context-specific information to be filled in
[out] found true if a pageId has been found and should be added to the pre-fetch queue
Returns:
the prefetch pageId

Implements SegPageEntryIterSource< int >.

Definition at line 44 of file MockSegPageEntryIterSource.cpp.

References counter, nextPageId, NULL_PAGE_ID, SegmentAccessor::pSegment, and segmentAccessor.

00047 {
00048     found = true;
00049     entry = counter++;
00050     // Only need to figure out the next page on every other iteration
00051     if (counter % 2) {
00052         return nextPageId;
00053     }
00054     PageId currPageId = nextPageId;
00055     nextPageId = segmentAccessor.pSegment->getPageSuccessor(nextPageId);
00056     if (nextPageId != NULL_PAGE_ID) {
00057         nextPageId = segmentAccessor.pSegment->getPageSuccessor(nextPageId);
00058     }
00059     return currPageId;
00060 }

virtual void SegPageEntryIterSource< int >::initPrefetchEntry ( int &  entry  )  [inline, virtual, inherited]

Initializes a specific entry in the pre-fetch queue.

Parameters:
entry the entry that will be initialized

Definition at line 46 of file SegPageEntryIterSource.h.

00047     {
00048     }


Member Data Documentation

int MockSegPageEntryIterSource::counter [private]

Definition at line 42 of file MockSegPageEntryIterSource.h.

Referenced by getNextPageForPrefetch(), and MockSegPageEntryIterSource().

PageId MockSegPageEntryIterSource::nextPageId [private]

Definition at line 43 of file MockSegPageEntryIterSource.h.

Referenced by getNextPageForPrefetch(), and MockSegPageEntryIterSource().

SegmentAccessor MockSegPageEntryIterSource::segmentAccessor [private]

Definition at line 44 of file MockSegPageEntryIterSource.h.

Referenced by getNextPageForPrefetch(), and MockSegPageEntryIterSource().


The documentation for this class was generated from the following files:
Generated on Mon Jun 22 04:00:39 2009 for Fennel by  doxygen 1.5.1