NetCDF 4.9.3
Loading...
Searching...
No Matches
nc4type.c File Reference
#include "nc4internal.h"
#include "nc4dispatch.h"
#include <stddef.h>

Go to the source code of this file.

Functions

int nc4_get_typeclass (const NC_FILE_INFO_T *h5, nc_type xtype, int *type_class)
 
int NC4_inq_compound_field (int ncid, nc_type typeid1, int fieldid, char *name, size_t *offsetp, nc_type *field_typeidp, int *ndimsp, int *dim_sizesp)
 
int NC4_inq_compound_fieldindex (int ncid, nc_type typeid1, const char *name, int *fieldidp)
 
int NC4_inq_enum_ident (int ncid, nc_type xtype, long long value, char *identifier)
 
int NC4_inq_enum_member (int ncid, nc_type typeid1, int idx, char *identifier, void *value)
 
int NC4_inq_type (int ncid, nc_type typeid1, char *name, size_t *size)
 
int NC4_inq_type_fixed_size (int ncid, nc_type xtype, int *fixedsizep)
 
EXTERNL int NC4_inq_typeid (int ncid, const char *name, nc_type *typeidp)
 
int NC4_inq_typeids (int ncid, int *ntypes, int *typeids)
 
int NC4_inq_user_type (int ncid, nc_type typeid1, char *name, size_t *size, nc_type *base_nc_typep, size_t *nfieldsp, int *classp)
 
int NC4_recheck_varsize (NC_TYPE_INFO_T *parenttype, nc_type subtype)
 For types with one or more subtypes (e.g.
 
int NC4_set_varsize (NC_TYPE_INFO_T *typ)
 When creating a type, mark it as variable-sized if known for sure.
 
int NC4_var_varsized (NC_VAR_INFO_T *var)
 Test if a variable's type is fixed sized or not.
 

Detailed Description

This file is part of netcdf-4, a netCDF-like interface for HDF5, or a HDF5 backend for netCDF, depending on your point of view.

This file handles the nc4 user-defined type functions (i.e. compound and opaque types).

Author
Ed Hartnett

Definition in file nc4type.c.

Function Documentation

◆ nc4_get_typeclass()

int nc4_get_typeclass ( const NC_FILE_INFO_T * h5,
nc_type xtype,
int * type_class )

Get the class of a type

Parameters
h5Pointer to the HDF5 file info struct.
xtypeNetCDF type ID.
type_classPointer that gets class of type, NC_INT, NC_FLOAT, NC_CHAR, or NC_STRING, NC_ENUM, NC_VLEN, NC_COMPOUND, or NC_OPAQUE.
Returns
NC_NOERR No error.
Author
Ed Hartnett

Definition at line 568 of file nc4type.c.

◆ NC4_inq_compound_field()

int NC4_inq_compound_field ( int ncid,
nc_type typeid1,
int fieldid,
char * name,
size_t * offsetp,
nc_type * field_typeidp,
int * ndimsp,
int * dim_sizesp )

Given the ncid, typeid and fieldid, get info about the field.

Parameters
ncidFile and group ID.
typeid1Type ID.
fieldidField ID.
nameGets name of field.
offsetpGets offset of field.
field_typeidpGets field type ID.
ndimspGets number of dims for this field.
dim_sizespGets the dim sizes for this field.
Returns
NC_NOERR No error.
NC_EBADID Bad ncid.
Author
Ed Hartnett

Definition at line 214 of file nc4type.c.

◆ NC4_inq_compound_fieldindex()

int NC4_inq_compound_fieldindex ( int ncid,
nc_type typeid1,
const char * name,
int * fieldidp )

Given the typeid and the name, get the fieldid.

Parameters
ncidFile and group ID.
typeid1Type ID.
nameName of field.
fieldidpPointer that gets new field ID.
Returns
NC_NOERR No error.
NC_EBADID Bad ncid.
NC_EBADTYPE Type not found.
NC_EBADFIELD Field not found.
Author
Ed Hartnett

Definition at line 265 of file nc4type.c.

◆ NC4_inq_enum_ident()

int NC4_inq_enum_ident ( int ncid,
nc_type xtype,
long long value,
char * identifier )

Get enum name from enum value. Name size will be <= NC_MAX_NAME. If the value is not a legitimate enum identifier and the value is zero (the default HDF5 enum fill value), then return the identifier "_UNDEFINED".

Parameters
ncidFile and group ID.
xtypeType ID.
valueValue of enum.
identifierGets the identifier for this enum value.
Returns
NC_NOERR No error.
NC_EBADID Bad ncid.
NC_EBADTYPE Type not found.
NC_EINVAL Invalid type data or no matching enum value is found
Author
Ed Hartnett

Definition at line 328 of file nc4type.c.

◆ NC4_inq_enum_member()

int NC4_inq_enum_member ( int ncid,
nc_type typeid1,
int idx,
char * identifier,
void * value )

Get information about an enum member: an identifier and value. Identifier size will be <= NC_MAX_NAME.

Parameters
ncidFile and group ID.
typeid1Type ID.
idxEnum member index.
identifierGets the identifier.
valueGets the enum value.
Returns
NC_NOERR No error.
NC_EBADID Bad ncid.
NC_EBADTYPE Type not found.
NC_EINVAL Bad idx.
Author
Ed Hartnett

Definition at line 422 of file nc4type.c.

◆ NC4_inq_type()

int NC4_inq_type ( int ncid,
nc_type typeid1,
char * name,
size_t * size )

Get the name and size of a type. For VLEN the base type len is returned.

Parameters
ncidFile and group ID.
typeid1Type ID.
nameGets the name of the type.
sizeGets the size of one element of the type in bytes.
Returns
NC_NOERR No error.
NC_EBADID Bad ncid.
NC_EBADTYPE Type not found.
Author
Ed Hartnett

Definition at line 80 of file nc4type.c.

◆ NC4_inq_type_fixed_size()

int NC4_inq_type_fixed_size ( int ncid,
nc_type xtype,
int * fixedsizep )

return 1 if type is fixed size; 0 otherwise.

Parameters
ncidfile id
xtypetype id
fixedsizeppointer into which 1/0 is stored
Returns
NC_NOERR
NC_EBADTYPE if bad type
Author
Dennis Heimbigner

Definition at line 639 of file nc4type.c.

◆ NC4_inq_typeid()

EXTERNL int NC4_inq_typeid ( int ncid,
const char * name,
nc_type * typeidp )

Get the id of a type from the name.

Parameters
ncidFile and group ID.
nameName of type; might be fully qualified.
typeidpPointer that will get the type ID.
Returns
NC_NOERR No error.
NC_ENOMEM Out of memory.
NC_EINVAL Bad size.
NC_ENOTNC4 User types in netCDF-4 files only.
NC_EBADTYPE Type not found.
Author
Ed Hartnett

Definition at line 472 of file nc4type.c.

◆ NC4_inq_typeids()

int NC4_inq_typeids ( int ncid,
int * ntypes,
int * typeids )

Find all user-defined types for a location. This finds all user-defined types in a group.

Parameters
ncidFile and group ID.
ntypesPointer that gets the number of user-defined types. Ignored if NULL
typeidsArray that gets the typeids. Ignored if NULL.
Returns
NC_NOERR No error.
NC_EBADID Bad ncid.
Author
Ed Hartnett

Definition at line 32 of file nc4type.c.

◆ NC4_inq_user_type()

int NC4_inq_user_type ( int ncid,
nc_type typeid1,
char * name,
size_t * size,
nc_type * base_nc_typep,
size_t * nfieldsp,
int * classp )

Find info about any user defined type.

Parameters
ncidFile and group ID.
typeid1Type ID.
nameGets name of the type.
sizeGets size in bytes of one element of type.
base_nc_typepGets the base nc_type.
nfieldspGets the number of fields.
classpGets the type class (NC_COMPOUND, NC_ENUM, NC_VLEN).
Returns
NC_NOERR No error.
NC_EBADID Bad ncid.
NC_EBADTYPE Type not found.
Author
Ed Hartnett

Definition at line 135 of file nc4type.c.

◆ NC4_recheck_varsize()

int NC4_recheck_varsize ( NC_TYPE_INFO_T * parenttype,
nc_type subtype )

For types with one or more subtypes (e.g.

basetype or fieldtype), determine the varsizedness of the type based on the basetype. The idea is to inform the code of the fact that parenttype has addedtype "inserted" into it.

Parameters
parenttype
subtype

Definition at line 672 of file nc4type.c.

◆ NC4_set_varsize()

int NC4_set_varsize ( NC_TYPE_INFO_T * typ)

When creating a type, mark it as variable-sized if known for sure.

Parameters
typ

Definition at line 698 of file nc4type.c.

◆ NC4_var_varsized()

int NC4_var_varsized ( NC_VAR_INFO_T * var)

Test if a variable's type is fixed sized or not.

Parameters
var- to test
Returns
0 if fixed size, 1 otherwise.

Definition at line 718 of file nc4type.c.