50 CubeBsqHandler::CubeBsqHandler(QFile * dataFile,
51 const QList<int> *virtualBandList,
const Pvl &labels,
bool alreadyOnDisk)
52 :
CubeIoHandler(dataFile, virtualBandList, labels, alreadyOnDisk) {
54 int numLinesInChunk = 1;
58 int sizeLimit = 1024 * 1024 * 1024;
59 int maxNumLines = (sizeLimit) / (
SizeOf(
pixelType()) * numSamplesInChunk);
79 void CubeBsqHandler::updateLabels(
Pvl &label) {
82 PvlContainer::Replace);
92 if(dataFile->seek(startByte)) {
93 QByteArray binaryData = dataFile->read(chunkToFill.
getByteCount());
102 IString msg =
"Reading from the file [" + dataFile->fileName() +
"] "
103 "failed with reading [" +
105 "] bytes at position [" + QString::number(startByte) +
"]";
114 bool success =
false;
117 if(dataFile->seek(startByte)) {
118 BigInt dataWritten = dataFile->write(chunkToWrite.
getRawData());
126 IString msg =
"Writing to the file [" + dataFile->fileName() +
"] "
127 "failed with writing [" +
129 "] bytes at position [" + QString::number(startByte) +
"]";
145 int chunkDimensionSize;
147 if (dimensionSize <= maxSize) {
148 chunkDimensionSize = dimensionSize;
152 int greatestDivisor = maxSize;
153 while (dimensionSize % greatestDivisor > 0) {
156 chunkDimensionSize = greatestDivisor;
158 return chunkDimensionSize;
virtual void readRaw(RawCubeChunk &chunkToFill)
This needs to populate the chunkToFill with unswapped raw bytes from the disk.
void setRawData(QByteArray rawData)
Sets the chunk's raw data.
BigInt getDataStartByte() const
void setChunkSizes(int numSamples, int numLines, int numBands)
This should be called once from the child constructor.
BigInt getBytesPerChunk() const
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
int SizeOf(Isis::PixelType pixelType)
Returns the number of bytes of the specified PixelType.
~CubeBsqHandler()
The destructor writes all cached data to disk.
void addKeyword(const PvlKeyword &keyword, const InsertMode mode=Append)
Add a keyword to the container.
A type of error that occurred when performing an actual I/O operation.
Handles converting buffers to and from disk.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
int getChunkIndex(const RawCubeChunk &) const
Given a chunk, what's its index in the file.
int findGoodSize(int maxSize, int dimensionSize) const
This method attempts to compute a good chunk line size.
QByteArray & getRawData() const
#define _FILEINFO_
Macro for the filename and line number.
A single keyword-value pair.
A section of raw data on the disk.
void clearCache(bool blockForWriteCache=true) const
Free all cube chunks (cached cube data) from memory and write them to disk.
virtual void writeRaw(const RawCubeChunk &chunkToWrite)
This needs to write the chunkToWrite directly to disk with no modifications to the data itself...
Container for cube-like labels.
PixelType pixelType() const
Adds specific functionality to C++ strings.
BigInt getChunkStartByte(const RawCubeChunk &chunk) const
This is a helper method that goes from chunk to file position.
Contains Pvl Groups and Pvl Objects.