22template <
typename A>
class QList;
23template <
typename A,
typename B>
class QMap;
27 class CubeCachingAlgorithm;
112 const Pvl &label,
bool alreadyOnDisk);
115 virtual void read(
Buffer &bufferToFill)
const;
119 virtual void clearCache(
bool blockForWriteCache =
true)
const;
145 void setChunkSizes(
int numSamples,
int numLines,
int numBands);
183 class BufferToChunkWriter :
public QRunnable {
187 ~BufferToChunkWriter();
196 BufferToChunkWriter(
const BufferToChunkWriter & other);
202 BufferToChunkWriter & operator=(
const BufferToChunkWriter & rhs);
210 QElapsedTimer *m_timer;
230 void blockUntilThreadPoolEmpty()
const;
232 static bool bufferLessThan(
Buffer *
const &lhs,
Buffer *
const &rhs);
234 QPair< QList<RawCubeChunk *>,
QList<int> > findCubeChunks(
int startSample,
int numSamples,
235 int startLine,
int numLines,
236 int startBand,
int numBands)
const;
239 const Buffer &cube2,
int &startX,
int &startY,
int &startZ,
240 int &endX,
int &endY,
int &endZ)
const;
242 void flushWriteCache(
bool force =
false)
const;
246 RawCubeChunk *getChunk(
int chunkIndex,
bool allocateIfNecessary)
const;
248 int getChunkCount()
const;
250 void getChunkPlacement(
int chunkIndex,
251 int &startSample,
int &startLine,
int &startBand,
252 int &endSample,
int &endLine,
int &endBand)
const;
257 const Buffer &justRequested)
const;
259 void synchronousWrite(
const Buffer &bufferToWrite);
261 void writeIntoDouble(
const RawCubeChunk &chunk,
Buffer &output,
int startIndex)
const;
265 void writeNullDataToDisk()
const;
279 PixelType m_pixelType;
288 ByteOrder m_byteOrder;
313 int m_samplesInChunk;
328 mutable QByteArray *m_nullChunkData;
331 QPair< QMutex *, QList<Buffer *> > *m_writeCache;
338 mutable QThreadPool *m_ioThreadPool;
344 mutable bool m_lastOperationWasWrite;
349 bool m_useOptimizedCubeWrite;
352 mutable volatile int m_idealFlushSize;
355 mutable int m_consecutiveOverflowCount;
Buffer for reading and writing cube data.
Definition Buffer.h:53
This is the parent of the caching algorithms.
Definition CubeCachingAlgorithm.h:31
Handles converting buffers to and from disk.
Definition CubeIoHandler.h:109
virtual void clearCache(bool blockForWriteCache=true) const
Free all cube chunks (cached cube data) from memory and write them to disk.
Definition CubeIoHandler.cpp:370
int bandCount() const
Definition CubeIoHandler.cpp:422
virtual ~CubeIoHandler()
Cleans up all allocated memory.
Definition CubeIoHandler.cpp:152
virtual void addCachingAlgorithm(CubeCachingAlgorithm *algorithm)
This will add the given caching algorithm to the list of attempted caching algorithms.
Definition CubeIoHandler.cpp:355
PixelType pixelType() const
Definition CubeIoHandler.cpp:540
QFile * getDataFile()
Definition CubeIoHandler.cpp:515
int getChunkCountInLineDimension() const
Definition CubeIoHandler.cpp:461
void setChunkSizes(int numSamples, int numLines, int numBands)
This should be called once from the child constructor.
Definition CubeIoHandler.cpp:574
int getLineCountInChunk() const
Definition CubeIoHandler.cpp:532
int getChunkCountInSampleDimension() const
Definition CubeIoHandler.cpp:470
virtual void readRaw(RawCubeChunk &chunkToFill)=0
This needs to populate the chunkToFill with unswapped raw bytes from the disk.
int getChunkCountInBandDimension() const
Definition CubeIoHandler.cpp:452
CubeIoHandler(QFile *dataFile, const QList< int > *virtualBandList, const Pvl &label, bool alreadyOnDisk)
Creates a new CubeIoHandler using a RegionalCachingAlgorithm.
Definition CubeIoHandler.cpp:61
BigInt getBytesPerChunk() const
Definition CubeIoHandler.cpp:442
BigInt getDataStartByte() const
Definition CubeIoHandler.cpp:504
virtual void writeRaw(const RawCubeChunk &chunkToWrite)=0
This needs to write the chunkToWrite directly to disk with no modifications to the data itself.
int sampleCount() const
Definition CubeIoHandler.cpp:549
int lineCount() const
Definition CubeIoHandler.cpp:524
virtual void read(Buffer &bufferToFill) const
Read cube data from disk into the buffer.
Definition CubeIoHandler.cpp:217
virtual void write(const Buffer &bufferToWrite)
Write buffer data into the cube data on disk.
Definition CubeIoHandler.cpp:325
virtual void updateLabels(Pvl &labels)=0
Function to update the labels with a Pvl object.
int getSampleCountInChunk() const
Definition CubeIoHandler.cpp:557
virtual BigInt getDataSize() const
Definition CubeIoHandler.cpp:412
int getBandCountInChunk() const
Definition CubeIoHandler.cpp:430
int getChunkIndex(const RawCubeChunk &) const
Given a chunk, what's its index in the file.
Definition CubeIoHandler.cpp:486
Byte swapper.
Definition EndianSwapper.h:38
ImageIoHandler(const QList< int > *virtualBandList)
Definition ImageIoHandler.cpp:12
A section of raw data on the disk.
Definition RawCubeChunk.h:27
This is free and unencumbered software released into the public domain.
Definition BoxcarCachingAlgorithm.h:13
This is free and unencumbered software released into the public domain.
Definition CubeIoHandler.h:23
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16