#include <DataAccessorImpl.h>
Public Member Functions | |
| DataAccessorImpl (char *pPage, DataRequest *pRequest, size_t concurrentRows, size_t interLineBytes, size_t concurrentColumns, size_t concurrentBands, size_t elementSize, RasterElement *pRasterElement) | |
| ~DataAccessorImpl () | |
| void * | getRow () |
| void | nextRow (bool resetColumn=true) |
| void | nextRow (int count, bool resetColumn=true) |
| void * | getColumn () |
| double | getColumnAsDouble (int iIndex=0, ComplexComponent component=COMPLEX_MAGNITUDE) const |
| int64_t | getColumnAsInteger (int iIndex=0, ComplexComponent component=COMPLEX_MAGNITUDE) const |
| void | nextColumn () |
| void | nextColumn (int count) |
| void | toPixel (int row, int column) |
| RasterElement * | getAssociatedRasterElement () |
| bool | isValid () const |
| int | incrementRefCount () |
| int | decrementRefCount () |
| size_t | getRowSize () const |
| size_t | getConcurrentColumns () const |
This class provides an efficient, generic interface to the raw dataset. To provide efficient access to the raw data, range checking can not occur within this class. It is up to the user of the DataAcessor to make sure the bounds of the dataset are not exceeded. This class provides row-major access to the data. All of the standard interleaves (BIP, BIL, or BSQ) are row-major, so this class doesn't provide column-major access.
The following is the in the order for the dataset: BIP: ( Maj, Mid, Min = Row, Col, Band ) BIL: ( Maj, Mid, Min = Row, Band, Col (NOT IMPLEMENTED)) BSQ: ( Maj, Mid, Min = Band, Row, Col )
This class is not instantiated by a plug-in directly. The plug-in developer can get access to this class through the RasterElement::getDataAccessor() method. One example is to call getDataAccessor() with a DataRequest with concurrentColumns == total columns, concurrentBands == 1, and the default interleave.
for each row for each column value = *getColumn() // Do something useful with the value. nextColumn() nextRow()
Definition at line 61 of file DataAccessorImpl.h.
| DataAccessorImpl::DataAccessorImpl | ( | char * | pPage, | |
| DataRequest * | pRequest, | |||
| size_t | concurrentRows, | |||
| size_t | interLineBytes, | |||
| size_t | concurrentColumns, | |||
| size_t | concurrentBands, | |||
| size_t | elementSize, | |||
| RasterElement * | pRasterElement | |||
| ) |
DataAcessorImpl constructor.
This is the constructor for the data accessor. This constructor should not be called directly from a plug-in. Use RasterElement::getDataAccessor() to get a DataAccessor instance.
| pPage | A pointer to a page of the raw dataset. The size and ownership of the data pointed to by mpPage is dependent on the interleave, the concurrent elements and whether the data is loaded into memory or not. | |
| pRequest | The DataRequest for this accessor. DataAccessorImpl takes ownership of the request. | |
| concurrentRows | The number of rows provided by the RasterPager. | |
| interLineBytes | The number of bytes following a row of data in the dataset. This includes bytes that come before the next line. | |
| concurrentColumns | The number of columns provided by the RasterPager. | |
| concurrentBands | The number of bands provided by the RasterPager. | |
| elementSize | The size of the individual type referenced in the dataset 'matrix'. For example, sizeof(long), sizeof(float), etc. | |
| pRasterElement | This is a reference to the RasterElement class "owning" this DataAccessor. |
Definition at line 93 of file DataAccessorImpl.h.
| DataAccessorImpl::~DataAccessorImpl | ( | ) |
| void* DataAccessorImpl::getRow | ( | ) |
Gets a row of values.
This method returns a pointer to the first element in an array that is guaranteed to be at least (concurrent columns * number of bands) in size for BIP data and (concurrent columns) in size for BSQ data.
Definition at line 144 of file DataAccessorImpl.h.
| void DataAccessorImpl::nextRow | ( | bool | resetColumn = true |
) |
Advances to the next row in the dataset.
This method increments to the next row based on the interleave BIP, BSQ, or BIL.
| resetColumn | Whether or not to reset the column to the beginning column of the accessor. |
Definition at line 158 of file DataAccessorImpl.h.
| void DataAccessorImpl::nextRow | ( | int | count, | |
| bool | resetColumn = true | |||
| ) |
Advances to a succeeding row in the dataset.
This method increments to a later row based on the interleave BIP, BSQ, or BIL.
| count | The number of rows to advance | |
| resetColumn | Whether or not to reset the column to the beginning column of the accessor. |
Definition at line 180 of file DataAccessorImpl.h.
| void* DataAccessorImpl::getColumn | ( | ) |
Gets a column of values.
This method returns a pointer to the first element in an array that is guaranteed to be at least the number of bands in size for BIP data and one in size for BSQ data.
Definition at line 207 of file DataAccessorImpl.h.
| double DataAccessorImpl::getColumnAsDouble | ( | int | iIndex = 0, |
|
| ComplexComponent | component = COMPLEX_MAGNITUDE | |||
| ) | const |
Returns the data for the current column position as a double.
| iIndex | The number of elements past the current column position to access. No bounds checking is performed on the provided index. | |
| component | For complex data, this specifies the component of the complex data that should be returned. If an invalid enum value is used for complex data, a value of 0 will be returned. For non-complex data, this value is ignored. |
Definition at line 225 of file DataAccessorImpl.h.
| int64_t DataAccessorImpl::getColumnAsInteger | ( | int | iIndex = 0, |
|
| ComplexComponent | component = COMPLEX_MAGNITUDE | |||
| ) | const |
Returns the data for the current column position as an integer.
This method will truncate the value if the underlying data is stored in floating point.
| iIndex | The number of elements past the current column position to access. No bounds checking is performed on the provided index. | |
| component | For complex data, this specifies the component of the complex data that should be returned. If an invalid enum value is used for complex data, a value of 0 will be returned. For non-complex data, this value is ignored. |
Definition at line 244 of file DataAccessorImpl.h.
| void DataAccessorImpl::nextColumn | ( | ) |
Advances to the next column in the dataset.
This method increments to the next column based on the interleave BIP, BSQ, or BIL.
Definition at line 255 of file DataAccessorImpl.h.
| void DataAccessorImpl::nextColumn | ( | int | count | ) |
Advances to a succeeding column in the dataset.
This method increments to a later column based on the interleave BIP, BSQ, or BIL.
| count | The number of columns to advance. |
Definition at line 270 of file DataAccessorImpl.h.
| void DataAccessorImpl::toPixel | ( | int | row, | |
| int | column | |||
| ) |
Jumps to the specified pixel in the current band.
This method updates the current offset to the given pixel at row, column in the current band.
| row | The row to access in the current band. This must be non-negative and less than the total number of rows. | |
| column | The column to access in the current band. This must be non-negative and less than the total number of columns. |
Definition at line 296 of file DataAccessorImpl.h.
| RasterElement* DataAccessorImpl::getAssociatedRasterElement | ( | ) |
Returns the RasterElement associated with this DataAccessor.
Definition at line 310 of file DataAccessorImpl.h.
| bool DataAccessorImpl::isValid | ( | ) | const |
Returns whether this is a valid data accessor.
A valid data accessor means that calls to getRow() and getColumn() will point to a valid location in memory. This method can be called between nextRow() and getRow() or getColumn() calls.
Definition at line 327 of file DataAccessorImpl.h.
| int DataAccessorImpl::incrementRefCount | ( | ) |
Increases the number of users of this data accessor.
This is simple reference counting mechanism to track the number of users of the data accessor.
Definition at line 340 of file DataAccessorImpl.h.
| int DataAccessorImpl::decrementRefCount | ( | ) |
Decreases the number of users of this data accessor.
This is simple reference counting mechanism to track the number of users of the data accessor.
Definition at line 354 of file DataAccessorImpl.h.
| size_t DataAccessorImpl::getRowSize | ( | ) | const |
Access the size in bytes of a row of data.
This includes the number of bytes of actual data in a row and excludes preline and postline bytes.
Definition at line 373 of file DataAccessorImpl.h.
| size_t DataAccessorImpl::getConcurrentColumns | ( | ) | const |
Access the number of columns available concurrently.
Definition at line 385 of file DataAccessorImpl.h.