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_priv.h>

Public Member Functions

 GDALExtendedDataType (const GDALExtendedDataType &)
 Copy constructor.
 
GDALExtendedDataTypeoperator= (const GDALExtendedDataType &)
 Copy assignment.
 
GDALExtendedDataTypeoperator= (GDALExtendedDataType &&)
 Move assignment.
 
bool operator== (const GDALExtendedDataType &) const
 Equality operator. More...
 
bool operator!= (const GDALExtendedDataType &other) const
 Non-equality operator.
 
const std::string & GetName () const
 Return type name. More...
 
GDALExtendedDataTypeClass GetClass () const
 Return type class. More...
 
GDALDataType GetNumericDataType () const
 Return numeric data type (only valid when GetClass() == GEDTC_NUMERIC) More...
 
GDALExtendedDataTypeSubType GetSubType () const
 Return subtype. More...
 
const std::vector< std::unique_ptr< GDALEDTComponent > > & GetComponents () const
 Return the components of the data type (only valid when GetClass() == GEDTC_COMPOUND) More...
 
size_t GetSize () const
 Return data type size in bytes. More...
 
size_t GetMaxStringLength () const
 Return the maximum length of a string in bytes. More...
 
bool CanConvertTo (const GDALExtendedDataType &other) const
 Return whether this data type can be converted to the other one. More...
 
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. More...
 

Static Public Member Functions

static GDALExtendedDataType Create (GDALDataType eType)
 Return a new GDALExtendedDataType of class GEDTC_NUMERIC. More...
 
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. More...
 
static GDALExtendedDataType CreateString (size_t nMaxStringLength=0, GDALExtendedDataTypeSubType eSubType=GEDTST_NONE)
 Return a new GDALExtendedDataType of class GEDTC_STRING. More...
 
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. More...
 
static bool CopyValues (const void *pSrc, const GDALExtendedDataType &srcType, GPtrDiff_t nSrcStrideInElts, void *pDst, const GDALExtendedDataType &dstType, GPtrDiff_t nDstStrideInElts, size_t nValues)
 Convert severals value from a source type to a destination type. More...
 

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
otherTarget 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 severals 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().

◆ Create() [1/2]

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
osNameType name.
nTotalSizeTotal size of the type in bytes. Should be large enough to store all components.
componentsComponents of the compound type.

◆ Create() [2/2]

GDALExtendedDataType GDALExtendedDataType::Create ( GDALDataType  eType)
static

Return a new GDALExtendedDataType of class GEDTC_NUMERIC.

This is the same as the C function GDALExtendedDataTypeCreate()

Parameters
eTypeNumeric data type.

◆ 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
nMaxStringLengthmaximum length of a string in bytes. 0 if unknown/unlimited
eSubTypeSubtype.

◆ 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
pBufferRaw 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()

◆ 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: