DataAccessorImpl Class Reference

Provides a generic interface to the dataset. More...

#include <DataAccessorImpl.h>

List of all members.

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)
RasterElementgetAssociatedRasterElement ()
bool isValid () const
int incrementRefCount ()
int decrementRefCount ()
size_t getRowSize () const
size_t getConcurrentColumns () const


Detailed Description

Provides a generic interface to the dataset.

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()

See also:
RasterElement::getDataAccessor()

Definition at line 61 of file DataAccessorImpl.h.


Constructor & Destructor Documentation

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.

Parameters:
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 (  ) 

DataAcessorImpl destructor.

Definition at line 127 of file DataAccessorImpl.h.


Member Function Documentation

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.

Returns:
Pointer to the raw block of row data from the dataset.

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.

Parameters:
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.

Parameters:
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.

Returns:
Pointer to the raw block of column data from the data set.

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.

Parameters:
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.
Returns:
The value at the given iIndex past the current column, returned as a double.

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.

Parameters:
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.
Returns:
The value at the given iIndex past the current column, returned as an integer.

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.

Parameters:
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.

Parameters:
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.

Returns:
Returns the RasterElement associated with this class.

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.

Returns:
Returns whether this data accessor is valid, and subsequent calls to getRow() or getColumn() are valid pointers in memory.
See also:
DataAccessor::isValid()

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.

Returns:
Returns the current number of users of this 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.

Returns:
Returns the current number of users of this 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.

Note:
If using this information to access an entire row of data with getRow(), you must ensure that the DataAccessor's concurrent columns (and concurrent bands if the accessor is BIP) is equal to the number of columns in the data set.
Returns:
The number of bytes in a row of data excluding preline and postline bytes.

Definition at line 373 of file DataAccessorImpl.h.

size_t DataAccessorImpl::getConcurrentColumns (  )  const

Access the number of columns available concurrently.

Returns:
The number of concurrent columns.
See also:
getRow()

Definition at line 385 of file DataAccessorImpl.h.


Software Development Kit - Opticks 4.9.0 Build 16218