GDAL

Classes | Public Member Functions | Friends | List of all members
GDALDataset::Bands Class Reference

Class returned by GetBands() that act as a container for raster bands. More...

`#include <gdal_priv.h>`

## Public Member Functions
const Iterator | begin () const
| Return beginning of band iterator. More...
const Iterator | end () const
| Return end of band iterator. More...
size_t | size () const
| Get the number of raster bands in this dataset. More...
GDALRasterBand * | operator[] (int iBand)
| Fetch a raster band by index. More...
GDALRasterBand * | operator[] (size_t iBand)
| Fetch a raster band by index. More...

## Friends
class | GDALDataset

## Detailed Description

Class returned by GetBands() that act as a container for raster bands.

## Member Function Documentation

## ◆ begin()

const GDALDataset::Bands::Iterator GDALDataset::Bands::begin | ( |  | ) | const

Return beginning of band iterator.

Since
  GDAL 2.3

## ◆ end()

const GDALDataset::Bands::Iterator GDALDataset::Bands::end | ( |  | ) | const

Return end of band iterator.

Since
  GDAL 2.3

## ◆ operator[]() [1/2]

GDALRasterBand * GDALDataset::Bands::operator[] | ( | int | iBand | ) |

Fetch a raster band by index.

The returned band remains owned by the GDALDataset and should not be deleted by the application.

Warning
  Contrary to GDALDataset::GetRasterBand(), the indexing here is consistent with the conventions of C/C++, i.e. starting at 0.

Parameters

  iBand | a band index between 0 and size()-1.

Returns
  the band, or nullptr if iBand is out of range or an error occurs.

Since
  GDAL 2.3

## ◆ operator[]() [2/2]

GDALRasterBand * GDALDataset::Bands::operator[] | ( | size_t | iBand | ) |

Fetch a raster band by index.

The returned band remains owned by the GDALDataset and should not be deleted by the application.

Warning
  Contrary to GDALDataset::GetRasterBand(), the indexing here is consistent with the conventions of C/C++, i.e. starting at 0.

Parameters

  iBand | a band index between 0 and size()-1.

Returns
  the band, or nullptr if iBand is out of range or an error occurs.

Since
  GDAL 2.3

## ◆ size()

size_t GDALDataset::Bands::size | ( |  | ) | const

Get the number of raster bands in this dataset.

Returns
  raster band count.

Since
  GDAL 2.3

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

- gdal_priv.h
- gdaldataset.cpp