GDAL

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

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

`#include <gdal_dataset.h>`

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

## Friends
class | GDALDataset

## Detailed Description

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

## Member Function Documentation

## ◆ begin()

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

Return beginning of band iterator.

Since
  GDAL 3.12

## ◆ end()

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

Return end of band iterator.

Since
  GDAL 3.12

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

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

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 3.12

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

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

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 3.12

## ◆ size()

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

Get the number of raster bands in this dataset.

Returns
  raster band count.

Since
  GDAL 3.12

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

- gdal_dataset.h
- gdaldataset.cpp