Fennel: MockSegPageEntryIterSource Class Reference (original) (raw)

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 }