rasdaman client API  10.6.3
The Array Analytics Engine: Datacubes at Your Fingertips
Public Member Functions | Protected Attributes | List of all members
r_Band_Iterator Class Reference

This class abstracts away iteration over the cells of a (multi-band) array. More...

#include <banditerator.hh>

Public Member Functions

 r_Band_Iterator (const char *_data, const r_Base_Type *_type, r_Bytes _size, unsigned int _band, r_Band_Linearization _bandLinearization)
 
virtual ~r_Band_Iterator ()=default
 destructor More...
 
bool done () const
 
void advance ()
 Move to the next band cell. More...
 
void advance (r_Bytes cellCount)
 Move by cellCount cells in the band. More...
 
const char * get ()
 
const char * get (r_Bytes targetCell)
 
void reset ()
 
void copyBand (char *__restrict__ dst)
 Copy the band data to the given dst pointer; dst must not be null, and must be sufficiently large (use getBandSize() to determine the size). More...
 
r_Bytes getBandSize () const
 Return the size of band data in bytes. More...
 

Protected Attributes

const char * data {NULL}
 array data More...
 
const char * currCell {NULL}
 current cell in the array to be returned by dereferencing the iterator More...
 
const char * dataEnd {NULL}
 end of data = data + (size * cellSize) More...
 
const r_Base_Typetype {NULL}
 array cell type More...
 
r_Bytes size {}
 array size in number of cells More...
 
r_Bytes bandOffset {}
 offset in bytes to the first cell in data of the iterated band More...
 
unsigned int band {}
 the band to be iterated More...
 
unsigned int cellBandSize {}
 size of the band component of one cell in bytes More...
 
unsigned int cellSize {1}
 full cell size in bytes More...
 
r_Band_Linearization bandLinearization {r_Band_Linearization::PixelInterleaved}
 band linearization (pixel/channel) More...
 

Detailed Description

This class abstracts away iteration over the cells of a (multi-band) array.

Bands in pixel-interleaved and channel-interleaved linearizations are supported.

It's different from r_Miter* in raslib, which focuses on full cell/dimension iteration.

Constructor & Destructor Documentation

◆ r_Band_Iterator()

r_Band_Iterator::r_Band_Iterator ( const char *  _data,
const r_Base_Type _type,
r_Bytes  _size,
unsigned int  _band,
r_Band_Linearization  _bandLinearization 
)
Parameters
_datathe array cells
_typethe array base type
_sizenumber of cells in the array
_bandthe band to be iterated
_bandLinearizationthe band interleaving (pixel/channel)

◆ ~r_Band_Iterator()

virtual r_Band_Iterator::~r_Band_Iterator ( )
virtualdefault

destructor

Member Function Documentation

◆ advance() [1/2]

void r_Band_Iterator::advance ( )
inline

Move to the next band cell.

Calling this method when done() returns true leads to undefined behaviour.

References cellSize, currCell, and dataEnd.

◆ advance() [2/2]

void r_Band_Iterator::advance ( r_Bytes  cellCount)
inline

Move by cellCount cells in the band.

cellCount must be less than the remaining number of cells in this band.

References cellSize, currCell, and dataEnd.

◆ copyBand()

void r_Band_Iterator::copyBand ( char *__restrict__  dst)

Copy the band data to the given dst pointer; dst must not be null, and must be sufficiently large (use getBandSize() to determine the size).

◆ done()

bool r_Band_Iterator::done ( ) const
inline
Returns
true if all band cells have been iterated. If this method returns true, then calling advance() or get() is undefined behavior.

References currCell, and dataEnd.

◆ get() [1/2]

const char* r_Band_Iterator::get ( )
inline
Returns
a pointer to the current cell. No check is performed on whether the returned pointer is at the end of the array, so before calling make sure to check with a call to done().

References currCell, and dataEnd.

◆ get() [2/2]

const char* r_Band_Iterator::get ( r_Bytes  targetCell)
inline
Returns
a pointer to the targetCell in the band. targetCell must be less than the total number of cells in the array, otherwise this method will lead to undefined behavior.

References bandOffset, cellSize, data, and size.

◆ getBandSize()

r_Bytes r_Band_Iterator::getBandSize ( ) const

Return the size of band data in bytes.

◆ reset()

void r_Band_Iterator::reset ( )
inline

References bandOffset, currCell, and data.

Member Data Documentation

◆ band

unsigned int r_Band_Iterator::band {}
protected

the band to be iterated

◆ bandLinearization

r_Band_Linearization r_Band_Iterator::bandLinearization {r_Band_Linearization::PixelInterleaved}
protected

band linearization (pixel/channel)

◆ bandOffset

r_Bytes r_Band_Iterator::bandOffset {}
protected

offset in bytes to the first cell in data of the iterated band

Referenced by get(), and reset().

◆ cellBandSize

unsigned int r_Band_Iterator::cellBandSize {}
protected

size of the band component of one cell in bytes

◆ cellSize

unsigned int r_Band_Iterator::cellSize {1}
protected

full cell size in bytes

Referenced by advance(), and get().

◆ currCell

const char* r_Band_Iterator::currCell {NULL}
protected

current cell in the array to be returned by dereferencing the iterator

Referenced by advance(), done(), get(), and reset().

◆ data

const char* r_Band_Iterator::data {NULL}
protected

array data

Referenced by get(), and reset().

◆ dataEnd

const char* r_Band_Iterator::dataEnd {NULL}
protected

end of data = data + (size * cellSize)

Referenced by advance(), done(), and get().

◆ size

r_Bytes r_Band_Iterator::size {}
protected

array size in number of cells

Referenced by get().

◆ type

const r_Base_Type* r_Band_Iterator::type {NULL}
protected

array cell type


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