File failed to load: https://isis.astrogeology.usgs.gov/9.0.0/Object/assets/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
FilterCachingAlgorithm.cpp
1
5
6/* SPDX-License-Identifier: CC0-1.0 */
7
8#include "FilterCachingAlgorithm.h"
9
10#include <algorithm>
11#include <iostream>
12
13#include <QList>
14
15#include "Buffer.h"
16#include "Distance.h"
17#include "RawCubeChunk.h"
18#include "Statistics.h"
19
20using std::max;
21
22namespace Isis {
32 m_chunksToKeep = NULL;
34
35 while(m_chunksToKeep->size() < numParallelIOs)
37
38 m_currentIo = 0;
39 }
40
41
51
52
65 const Buffer &justRequested) {
66 QList<RawCubeChunk *> chunksToToss;
67 CacheResult result(chunksToToss);
68
69 // This read has different chunks than before...
70 if(!justUsed.size() ||
71 !(*m_chunksToKeep)[m_currentIo].size() ||
72 ((*m_chunksToKeep)[m_currentIo][0] != justUsed[0] &&
73 (*m_chunksToKeep)[m_currentIo] != justUsed)) {
74 (*m_chunksToKeep)[m_currentIo] = justUsed;
75
76 // We don't know if Cube tossed any of the chunks, so we really need to
77 // look in the allocated list for things to toss. Let's work this by
78 // getting a list of things to keep and then freeing everything
79 // that is not in that list.
80 QListIterator<RawCubeChunk *> allocatedIterator(allocated);
81
82 while(allocatedIterator.hasNext()) {
83 RawCubeChunk *chunk = allocatedIterator.next();
84
85 bool found = false;
86
87 foreach(QList<RawCubeChunk *> chunksForIo, *m_chunksToKeep) {
88 if(!found)
89 found = chunksForIo.indexOf(chunk) != -1;
90 }
91
92 if(!found) {
93 chunksToToss.append(chunk);
94 }
95 }
96
97 result = CacheResult(chunksToToss);
98 }
99
100 m_currentIo ++;
101
102 if(m_currentIo >= m_chunksToKeep->size())
103 m_currentIo = 0;
104
105 return result;
106 }
107}
108
Buffer for reading and writing cube data.
Definition Buffer.h:53
This stores the results of the caching algorithm.
int m_currentIo
This keeps track of our position inside of m_chunksToKeep.
QList< QList< RawCubeChunk * > > * m_chunksToKeep
This is stored from parallel read # -> list of chunks for that read.
virtual CacheResult recommendChunksToFree(QList< RawCubeChunk * > allocated, QList< RawCubeChunk * > justUsed, const Buffer &justRequested)
Please see the class description for how this algorithm works.
FilterCachingAlgorithm(int numParallelIOs)
Construct a new FilterCachingAlgorithm.
virtual ~FilterCachingAlgorithm()
Frees the memory allocated by this caching algorithm.
A section of raw data on the disk.
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