Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Isis 3 Programmer Reference
BoxcarCachingAlgorithm.cpp
1
5
6/* SPDX-License-Identifier: CC0-1.0 */
7
8#include "BoxcarCachingAlgorithm.h"
9
10#include <algorithm>
11#include <iostream>
12
13#include <QList>
14#include <QQueue>
15
16#include "IException.h"
17#include "IString.h"
18#include "RawCubeChunk.h"
19
20namespace Isis {
30
31
37
38
50 QList <RawCubeChunk *> allocated, QList <RawCubeChunk *> justUsed,
51 const Buffer &justRequested) {
52 (void) justRequested; // unused, for fullfilling virtual function signiture
53 QList<RawCubeChunk *> chunksToToss;
54
55 if (justUsed.size() > 0) {
56 // TODO bands
57 int minLine = justUsed[0]->getStartLine();
58
59 QListIterator<RawCubeChunk *> justUsedIterator(justUsed);
60 while (justUsedIterator.hasNext()) {
61 RawCubeChunk *chunk = justUsedIterator.next();
62 int currentStart = chunk->getStartLine();
63 if (currentStart < minLine) minLine = currentStart;
64 }
65
66 if (minLine > m_minLine) {
67 m_minLine = minLine;
68 QListIterator<RawCubeChunk *> allocatedIterator(allocated);
69 while (allocatedIterator.hasNext()) {
70 RawCubeChunk *chunk = allocatedIterator.next();
71 int currentEnd = chunk->getStartLine() + chunk->lineCount() - 1;
72
73 if (currentEnd < minLine) {
74 chunksToToss.append(chunk);
75 }
76 }
77 }
78 }
79
80 return CacheResult(chunksToToss);
81 }
82}
BoxcarCachingAlgorithm()
Construct a new BoxcarCachingAlgorithm.
virtual CacheResult recommendChunksToFree(QList< RawCubeChunk * > allocated, QList< RawCubeChunk * > justUsed, const Buffer &justRequested)
Please see the class description for how this algorithm works.
virtual ~BoxcarCachingAlgorithm()
Frees the memory allocated by this caching algorithm.
int m_minLine
Used to calculate what lines to cache.
Buffer for reading and writing cube data.
Definition Buffer.h:53
This stores the results of the caching algorithm.
A section of raw data on the disk.
int getStartLine() const
int lineCount() const
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16