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
Isis::ImageIoHandler Class Referenceabstract

Handles converting buffers to and from disk. More...

#include <ImageIoHandler.h>

Inheritance diagram for Isis::ImageIoHandler:
Inheritance graph
Collaboration diagram for Isis::ImageIoHandler:
Collaboration graph

Public Member Functions

 ImageIoHandler (const QList< int > *virtualBandList)
 
virtual void read (Buffer &bufferToFill) const =0
 
virtual void write (const Buffer &bufferToWrite)=0
 
virtual void addCachingAlgorithm (CubeCachingAlgorithm *algorithm)
 
virtual void clearCache (bool blockForWriteCache=true) const
 
virtual BigInt getDataSize () const =0
 
void setVirtualBands (const QList< int > *virtualBandList)
 This changes the virtual band list.
 
virtual void updateLabels (Pvl &labels)=0
 Function to update the labels with a Pvl object.
 
QMutex * dataFileMutex ()
 Get the mutex that this IO handler is using around I/Os on the given data file.
 

Protected Attributes

QMutex * m_writeThreadMutex
 This enables us to block while the write thread is working.
 
QList< int > * m_virtualBands
 Converts from virtual band to physical band.
 

Detailed Description

Handles converting buffers to and from disk.

This class handles converting buffers to and from disk. This class holds the cube chunks in memory and is capable of reading and writing them. It asks the caching algorithms to recommend cube chunks to not keep in memory. Children need to call setChunkSizes() in their constructor.

This class handles all of the virtual band conversions. This class also guarantees that unwritten cube data ends up read and written as NULLs. The default caching algorithm is a RegionalCachingAlgorithm.

Author
2011-??-?? Jai Rideout and Steven Lambright
History

2011-06-27 Steven Lambright - Added addCachingAlgorithm()

2011-07-18 Jai Rideout and Steven Lambright - Added unimplemented copy constructor and assignment operator.

2011-07-18 Jai Rideout and Steven Lambright - getDataFile() is no longer const, along with readRaw() and writeRaw().

2011-11-23 Jai Rideout - Added fix to findCubeChunks() and findIntersection() so that requested areas that are outside of the virtual bands of the cube will no longer fail, but instead will fill the buffer with nulls.

2012-02-17 Steven Lambright - The read() method is now const - the caching should be transparent to the API. It is still important to note that you cannot call read() and write() simultaneously - Cube is guaranteeing this. Backgrounded writes are now implemented and fully supported. Timing tests show results like this: Before: User: 358.71 Kernel: 38.29 Total Elapsed: 6:49.83 After: User: 380.01 Kernel: 44.97 Total Elapsed: 6:19.96 User- user-space CPU time consumed. Kernel- kernel-space CPU time consumed. The CPU consumption and kernel time consumption goes up, but the overall run time is lower. This makes the option perfectly viable for typical multi-core desktop solutions. Turning off the cube write optimization results in equivalent run times as before implementation. These time tests were run before the adaptive cache flush size was added, which improved performance further. References #727.

2012-06-06 Jeff Anderson - The read() method was modified to improve the speed for small buffer sizes as seen in ProcessByBoxcar and ProcessRubbersheet. The internal cache was always checked to be minimized which is slow for every read. Now the cache is only mimimized if it changed in size. Reference #894.

2014-04-07 Kimberly Oyama and Stuart Sides - Modified the findCubeChunks, writeIntoDouble, and writeIntoRaw methods to handle repeating virtual bands. Fixes #1927.

2014-09-30 Ian Humphrey - Modified read method to correctly access virtual bands when cube dimensions and buffer shape are same size. Fixes #1689.

2015-01-30 Ian Humphrey - Modified destructor to free m_writThreadMutex to prevent memory leaks upon destruction. Fixes #2082.

2016-04-21 Makayla Shepherd - Added UnsignedWord pixel type handling.

2016-06-21 Kris Becker - Properly forward declare QPair as struct not class

2016-08-28 Kelvin Rodriguez - updateLabels now a pure virtual, it had no implementation causing warnings in clang. Part of OS X 10.11 porting. QPair forward declaration now properly claims it as a struct.

2017-09-22 Cole Neubauer - Fixed documentation. References #4807

2018-07-20 Tyler Wilson - Added support for unsigned integer special pixel values. in functions writeIntoRaw(...) and writeIntoDouble(...) References #971.

2018-08-13 Summer Stapleton - Fixed incoming buffer comparison values for unsigned int type in writeIntoRaw(...).

Definition at line 99 of file ImageIoHandler.h.

Constructor & Destructor Documentation

◆ ImageIoHandler()

Isis::ImageIoHandler::ImageIoHandler ( const QList< int > * virtualBandList)

Definition at line 12 of file ImageIoHandler.cpp.

◆ ~ImageIoHandler()

Isis::ImageIoHandler::~ImageIoHandler ( )
virtual

Definition at line 20 of file ImageIoHandler.cpp.

Member Function Documentation

◆ addCachingAlgorithm()

void Isis::ImageIoHandler::addCachingAlgorithm ( CubeCachingAlgorithm * algorithm)
virtual

Reimplemented in Isis::CubeIoHandler.

Definition at line 28 of file ImageIoHandler.cpp.

◆ clearCache()

void Isis::ImageIoHandler::clearCache ( bool blockForWriteCache = true) const
virtual

Reimplemented in Isis::CubeIoHandler.

Definition at line 30 of file ImageIoHandler.cpp.

◆ dataFileMutex()

QMutex * Isis::ImageIoHandler::dataFileMutex ( )

Get the mutex that this IO handler is using around I/Os on the given data file.

A lock should be acquired before doing any reads/writes on the data file externally.

Returns
A mutex that can guarantee exclusive access to the data file

Definition at line 58 of file ImageIoHandler.cpp.

References m_writeThreadMutex.

◆ getDataSize()

virtual BigInt Isis::ImageIoHandler::getDataSize ( ) const
pure virtual

Implemented in Isis::CubeIoHandler.

◆ read()

virtual void Isis::ImageIoHandler::read ( Buffer & bufferToFill) const
pure virtual

Implemented in Isis::CubeIoHandler.

◆ setVirtualBands()

void Isis::ImageIoHandler::setVirtualBands ( const QList< int > * virtualBandList)

This changes the virtual band list.

Parameters
virtualBandListA list where the indices are the vbands and the values are the physical bands. The values are 1-based. This can be specified as NULL, in which case the vbands are the physical bands. The virtual band list is copied (the pointer provided isn't remembered).

Definition at line 41 of file ImageIoHandler.cpp.

References m_virtualBands.

◆ updateLabels()

virtual void Isis::ImageIoHandler::updateLabels ( Pvl & labels)
pure virtual

Function to update the labels with a Pvl object.

Parameters
labelsPvl object to update with

Implemented in Isis::CubeBsqHandler, Isis::CubeIoHandler, Isis::CubeTileHandler, and Isis::GdalIoHandler.

◆ write()

virtual void Isis::ImageIoHandler::write ( const Buffer & bufferToWrite)
pure virtual

Implemented in Isis::CubeIoHandler.

Member Data Documentation

◆ m_virtualBands

QList<int>* Isis::ImageIoHandler::m_virtualBands
protected

◆ m_writeThreadMutex

QMutex* Isis::ImageIoHandler::m_writeThreadMutex
protected

The documentation for this class was generated from the following files: