GDAL

Public Member Functions | Static Public Member Functions | List of all members
GDALExtendedDataType Class Reference

Class used to represent potentially complex data types. More...

`#include <gdal_multidim.h>`

## Public Member Functions
| GDALExtendedDataType (GDALExtendedDataType &&)
| Move constructor.
| GDALExtendedDataType (const GDALExtendedDataType &)
| Copy constructor.
GDALExtendedDataType & | operator= (const GDALExtendedDataType &)
| Copy assignment.
GDALExtendedDataType & | operator= (GDALExtendedDataType &&)
| Move assignment.
bool | operator== (const GDALExtendedDataType &) const
| Equality operator.
bool | operator!= (const GDALExtendedDataType &other) const
| Non-equality operator.
const std::string & | GetName () const
| Return type name.
GDALExtendedDataTypeClass | GetClass () const
| Return type class.
GDALDataType | GetNumericDataType () const
| Return numeric data type (only valid when GetClass() == GEDTC_NUMERIC)
GDALExtendedDataTypeSubType | GetSubType () const
| Return subtype.
const std::vector< std::unique_ptr< GDALEDTComponent > > & | GetComponents () const
| Return the components of the data type (only valid when GetClass() == GEDTC_COMPOUND)
size_t | GetSize () const
| Return data type size in bytes.
size_t | GetMaxStringLength () const
| Return the maximum length of a string in bytes.
const GDALRasterAttributeTable * | GetRAT () const
| Return associated raster attribute table, when there is one.
bool | CanConvertTo (const GDALExtendedDataType &other) const
| Return whether this data type can be converted to the other one.
bool | NeedsFreeDynamicMemory () const
| Return whether the data type holds dynamically allocated memory, that needs to be freed with FreeDynamicMemory().
void | FreeDynamicMemory (void *pBuffer) const
| Release the dynamic memory (strings typically) from a raw value.

## Static Public Member Functions
static GDALExtendedDataType | Create (GDALDataType eType)
| Return a new GDALExtendedDataType of class GEDTC_NUMERIC.
static GDALExtendedDataType | Create (const std::string &osName, GDALDataType eBaseType, std::unique_ptr< GDALRasterAttributeTable >)
| Return a new GDALExtendedDataType from a raster attribute table.
static GDALExtendedDataType | Create (const std::string &osName, size_t nTotalSize, std::vector< std::unique_ptr< GDALEDTComponent > > &&components)
| Return a new GDALExtendedDataType of class GEDTC_COMPOUND.
static GDALExtendedDataType | CreateString (size_t nMaxStringLength=0, GDALExtendedDataTypeSubType eSubType=GEDTST_NONE)
| Return a new GDALExtendedDataType of class GEDTC_STRING.
static bool | CopyValue (const void *pSrc, const GDALExtendedDataType &srcType, void *pDst, const GDALExtendedDataType &dstType)
| Convert a value from a source type to a destination type.
static bool | CopyValues (const void *pSrc, const GDALExtendedDataType &srcType, GPtrDiff_t nSrcStrideInElts, void *pDst, const GDALExtendedDataType &dstType, GPtrDiff_t nDstStrideInElts, size_t nValues)
| Convert several values from a source type to a destination type.

## Detailed Description

Class used to represent potentially complex data types.

Several classes of data types are supported: numeric (based on GDALDataType), compound or string.

Since
  GDAL 3.1

## Member Function Documentation

## ◆ CanConvertTo()

bool GDALExtendedDataType::CanConvertTo | ( | const GDALExtendedDataType & | other | ) | const

Return whether this data type can be converted to the other one.

This is the same as the C function GDALExtendedDataTypeCanConvertTo().

Parameters

  other | Target data type for the conversion being considered.

## ◆ CopyValue()

bool GDALExtendedDataType::CopyValue | ( | const void * | pSrc,
|  | const GDALExtendedDataType & | srcType,
|  | void * | pDst,
|  | const GDALExtendedDataType & | dstType
| ) |  |
| static

Convert a value from a source type to a destination type.

If dstType is GEDTC_STRING, the written value will be a pointer to a char*, that must be freed with CPLFree().

## ◆ CopyValues()

bool GDALExtendedDataType::CopyValues | ( | const void * | pSrc,
|  | const GDALExtendedDataType & | srcType,
|  | GPtrDiff_t | nSrcStrideInElts,
|  | void * | pDst,
|  | const GDALExtendedDataType & | dstType,
|  | GPtrDiff_t | nDstStrideInElts,
|  | size_t | nValues
| ) |  |
| static

Convert several values from a source type to a destination type.

If dstType is GEDTC_STRING, the written value will be a pointer to a char*, that must be freed with CPLFree().

## ◆ Create() [1/3]

GDALExtendedDataType GDALExtendedDataType::Create | ( | const std::string & | osName,
|  | GDALDataType | eBaseType,
|  | std::unique_ptr< GDALRasterAttributeTable > | poRAT
| ) |  |
| static

Return a new GDALExtendedDataType from a raster attribute table.

Parameters

  osName | Type name
  eBaseType | Base integer data type.
  poRAT | Raster attribute table. Must not be NULL.

Since
  3.12

## ◆ Create() [2/3]

GDALExtendedDataType GDALExtendedDataType::Create | ( | const std::string & | osName,
|  | size_t | nTotalSize,
|  | std::vector< std::unique_ptr< GDALEDTComponent > > && | components
| ) |  |
| static

Return a new GDALExtendedDataType of class GEDTC_COMPOUND.

This is the same as the C function GDALExtendedDataTypeCreateCompound()

Parameters

  osName | Type name.
  nTotalSize | Total size of the type in bytes. Should be large enough to store all components.
  components | Components of the compound type.

## ◆ Create() [3/3]

GDALExtendedDataType GDALExtendedDataType::Create | ( | GDALDataType | eType | ) |
| static

Return a new GDALExtendedDataType of class GEDTC_NUMERIC.

This is the same as the C function GDALExtendedDataTypeCreate()

Parameters

  eType | Numeric data type. Must be different from GDT_Unknown and GDT_TypeCount

## ◆ CreateString()

GDALExtendedDataType GDALExtendedDataType::CreateString | ( | size_t | nMaxStringLength = `0`,
|  | GDALExtendedDataTypeSubType | eSubType = `GEDTST_NONE`
| ) |  |
| static

Return a new GDALExtendedDataType of class GEDTC_STRING.

This is the same as the C function GDALExtendedDataTypeCreateString().

Parameters

  nMaxStringLength | maximum length of a string in bytes. 0 if unknown/unlimited
  eSubType | Subtype.

## ◆ FreeDynamicMemory()

void GDALExtendedDataType::FreeDynamicMemory | ( | void * | pBuffer | ) | const

Release the dynamic memory (strings typically) from a raw value.

This is the same as the C function GDALExtendedDataTypeFreeDynamicMemory().

Parameters

  pBuffer | Raw buffer of a single element of an attribute or array value.

## ◆ GetClass()

GDALExtendedDataTypeClass GDALExtendedDataType::GetClass | ( |  | ) | const
| inline

Return type class.

This is the same as the C function GDALExtendedDataTypeGetClass()

## ◆ GetComponents()

const std::vector< std::unique_ptr< GDALEDTComponent > > & GDALExtendedDataType::GetComponents | ( |  | ) | const
| inline

Return the components of the data type (only valid when GetClass() == GEDTC_COMPOUND)

This is the same as the C function GDALExtendedDataTypeGetComponents()

## ◆ GetMaxStringLength()

size_t GDALExtendedDataType::GetMaxStringLength | ( |  | ) | const
| inline

Return the maximum length of a string in bytes.

0 indicates unknown/unlimited string.

## ◆ GetName()

const std::string & GDALExtendedDataType::GetName | ( |  | ) | const
| inline

Return type name.

This is the same as the C function GDALExtendedDataTypeGetName()

## ◆ GetNumericDataType()

GDALDataType GDALExtendedDataType::GetNumericDataType | ( |  | ) | const
| inline

Return numeric data type (only valid when GetClass() == GEDTC_NUMERIC)

This is the same as the C function GDALExtendedDataTypeGetNumericDataType()

## ◆ GetRAT()

const GDALRasterAttributeTable * GDALExtendedDataType::GetRAT | ( |  | ) | const
| inline

Return associated raster attribute table, when there is one.

For the netCDF driver, the RAT will capture enumerated types, with a "value" column with an integer value and a "name" column with the associated name.

This is the same as the C function GDALExtendedDataTypeGetRAT()

Since
  3.12

## ◆ GetSize()

size_t GDALExtendedDataType::GetSize | ( |  | ) | const
| inline

Return data type size in bytes.

For a string, this will be size of a char* pointer.

This is the same as the C function GDALExtendedDataTypeGetSize()

## ◆ GetSubType()

GDALExtendedDataTypeSubType GDALExtendedDataType::GetSubType | ( |  | ) | const
| inline

Return subtype.

This is the same as the C function GDALExtendedDataTypeGetSubType()

Since
  3.4

## ◆ operator==()

bool GDALExtendedDataType::operator== | ( | const GDALExtendedDataType & | other | ) | const

Equality operator.

This is the same as the C function GDALExtendedDataTypeEquals().

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

- gdal_multidim.h
- gdalmultidim.cpp