// Read swapped-out tuple data into readBuffer_ IoStatus SwapSpace::fetch(void) { IoStatus status = OK; ex_assert((ioPending_ == NONE), "fetch() invoked while I/O pending"); ex_assert((store_), "fetch() - temporary storage uninitialized"); ex_assert((numSwap_ > 0), "fetch() - no SwapSpace buffers to fetch"); ex_assert((swapRead_ < swapEnd_), "fetch() - can't fetch past end of file"); if (!readBuffer_) { readBuffer_ = memory_.getBuffer(true); ex_assert((readBuffer_), "fetch() - failed to get read buffer"); } ioPending_ = READ; readingFirstBuffer_ = false; // ScratchSapce blockNums are 1..N #if defined(NA_HAS_ANSI_CPP_CASTS) Int32 blockNum = static_cast<Int32>(swapRead_ / swapBufferSize_) + 1; #else Int32 blockNum = ((Int32) (swapRead_ / swapBufferSize_)) + 1; #endif status = mapStatus(store_->readThru(readBuffer_, blockNum, swapBufferSize_)); // status is OK if read was successfully initiated return status; }
IoStatus SwapSpace::swapOut(char* buffer) { IoStatus status = OK; if (!store_) { init(); // failure is fatal } else { status = checkIO(); } if (status == OK) { swapOutBuffer_ = buffer; // Initiate overflow of buffer to temporary storage ioPending_ = WRITE; DWORD ignoredBlockNum = 0; status = mapStatus(store_->writeThru(swapOutBuffer_, swapBufferSize_, ignoredBlockNum)); // status is OK if write was successfully initiated } return status; }
IoStatus SwapSpace::checkIOPending(bool* readCompleted) { IoStatus status = OK; ex_assert((ioPending_ != NONE), "checkIOPending not called via checkIO wrapper"); ex_assert((store_), "temporary storage uninitialized"); status = mapStatus(store_->checkIO()); if (status == OK) { // A read or a write operation has completed. if (ioPending_ == READ) { readingFirstBuffer_ = ((swapRead_ == swapStart_) && (swapRead_ != swapEnd_)); if (readCompleted) { *readCompleted = true; } } else { // A SwapSpace buffer has been written to temporary storage. // The swapOutBuffer_ is available for reuse. memory_.reuse(swapOutBuffer_); swapOutBuffer_ = NULL; ++numSwap_; swapEnd_ += swapBufferSize_; } ioPending_ = NONE; } return status; }
rtError pxAnimate::pxAnimationParams::status(rtString& v) const { v = mapStatus(mStatus); return RT_OK; };