#include <MockSegPageEntryIterSource.h>
Inheritance diagram for MockSegPageEntryIterSource:
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 |
The context associated with each page returned is a sequencing counter, starting at 0.
Definition at line 39 of file MockSegPageEntryIterSource.h.
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] |
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.
[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 |
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.
entry | the entry that will be initialized |
Definition at line 46 of file SegPageEntryIterSource.h.
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().
Definition at line 44 of file MockSegPageEntryIterSource.h.
Referenced by getNextPageForPrefetch(), and MockSegPageEntryIterSource().