GDAL

Public Member Functions | Protected Member Functions | List of all members
GDALIHasAttribute Class Reference

Interface used to get a single GDALAttribute or a set of GDALAttribute. More...

`#include <gdal_priv.h>`

Inheritance diagram for GDALIHasAttribute:

## Public Member Functions
virtual std::shared_ptr< GDALAttribute > | GetAttribute (const std::string &osName) const
| Return an attribute by its name. More...
virtual std::vector< std::shared_ptr< GDALAttribute > > | GetAttributes (CSLConstList papszOptions=nullptr) const
| Return the list of attributes contained in a GDALMDArray or GDALGroup. More...
virtual std::shared_ptr< GDALAttribute > | CreateAttribute (const std::string &osName, const std::vector< GUInt64 > &anDimensions, const GDALExtendedDataType &oDataType, CSLConstList papszOptions=nullptr)
| Create an attribute within a GDALMDArray or GDALGroup. More...

## Protected Member Functions
std::shared_ptr< GDALAttribute > | GetAttributeFromAttributes (const std::string &osName) const
| Possible fallback implementation for GetAttribute() using GetAttributes().

## Detailed Description

Interface used to get a single GDALAttribute or a set of GDALAttribute.

Since
  GDAL 3.1

## Member Function Documentation

## ◆ CreateAttribute()

std::shared_ptr< GDALAttribute > GDALIHasAttribute::CreateAttribute | ( | const std::string & | osName,
|  | const std::vector< GUInt64 > & | anDimensions,
|  | const GDALExtendedDataType & | oDataType,
|  | CSLConstList | papszOptions = `nullptr`
| ) |  |
| virtual

Create an attribute within a GDALMDArray or GDALGroup.

The attribute might not be "physically" created until a value is written into it.

Optionally implemented.

Drivers known to implement it: MEM, netCDF

This is the same as the C function GDALGroupCreateAttribute() or GDALMDArrayCreateAttribute()

Parameters

  osName | Attribute name.
  anDimensions | List of dimension sizes, ordered from the slowest varying dimension first to the fastest varying dimension last. Empty for a scalar attribute (common case)
  oDataType | Attribute data type.
  papszOptions | Driver specific options determining how the attribute. should be created.

Returns
  the new attribute, or nullptr if case of error

## ◆ GetAttribute()

std::shared_ptr< GDALAttribute > GDALIHasAttribute::GetAttribute | ( | const std::string & | osName | ) | const
| virtual

Return an attribute by its name.

If the attribute does not exist, nullptr should be silently returned.

Note
  Driver implementation: this method will fallback to GetAttributeFromAttributes() is not explicitly implemented

Drivers known to implement it for groups and arrays: MEM, netCDF.

This is the same as the C function GDALGroupGetAttribute() or GDALMDArrayGetAttribute().

Parameters

  osName | Attribute name

Returns
  the attribute, or nullptr if it does not exist or an error occurred.

## ◆ GetAttributes()

std::vector< std::shared_ptr< GDALAttribute > > GDALIHasAttribute::GetAttributes | ( | CSLConstList | papszOptions = `nullptr` | ) | const
| virtual

Return the list of attributes contained in a GDALMDArray or GDALGroup.

If the attribute does not exist, nullptr should be silently returned.

Note
  Driver implementation: optionally implemented. If implemented, GetAttribute() should also be implemented.

Drivers known to implement it for groups and arrays: MEM, netCDF.

This is the same as the C function GDALGroupGetAttributes() or GDALMDArrayGetAttributes().

Parameters

  papszOptions | Driver specific options determining how attributes should be retrieved. Pass nullptr for default behavior.

Returns
  the attributes.

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

- gdal_priv.h
- gdalmultidim.cpp