8#include "UniqueIOCachingAlgorithm.h"
16#include "IException.h"
18#include "RawCubeChunk.h"
31 m_uniqueIOs =
new QQueue < QList <RawCubeChunk *> >;
33 if (numUniqueIOs <= 0) {
34 IString msg =
"At least one unique IO must be used when using the unique "
35 "IO cube caching algorithm";
66 QList <RawCubeChunk *> allocated, QList <RawCubeChunk *> justUsed,
67 const Buffer &justRequested) {
68 QList <RawCubeChunk *> chunksToToss;
72 if (justUsed.size()) {
75 bool foundAHome =
false;
77 for (
int uniqueIONum = 0;
80 QList <RawCubeChunk *> &uniqueIO = (*m_uniqueIOs)[uniqueIONum];
82 if (uniqueIO.empty()) {
86 else if (uniqueIO == justUsed) {
99 QListIterator <RawCubeChunk *> allocatedIterator(allocated);
101 while (allocatedIterator.hasNext()) {
106 foreach (QList <RawCubeChunk *> chunksForIo, *
m_uniqueIOs) {
108 found = chunksForIo.indexOf(chunk) != -1;
112 chunksToToss.append(chunk);
Buffer for reading and writing cube data.
This stores the results of the caching algorithm.
@ Programmer
This error is for when a programmer made an API call that was illegal.
Adds specific functionality to C++ strings.
A section of raw data on the disk.
virtual CacheResult recommendChunksToFree(QList< RawCubeChunk * > allocated, QList< RawCubeChunk * > justUsed, const Buffer &justRequested)
Please see the class description for how this algorithm works.
UniqueIOCachingAlgorithm(int numUniqueIOs)
Construct a new UniqueIOCachingAlgorithm.
virtual ~UniqueIOCachingAlgorithm()
Frees the memory allocated by this caching algorithm.
QQueue< QList< RawCubeChunk * > > * m_uniqueIOs
This is the set of past unique IOs.
This is free and unencumbered software released into the public domain.