File: dopaque.c

package info (click to toggle)
netcdf 1%3A4.4.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 96,828 kB
  • ctags: 15,369
  • sloc: ansic: 163,650; sh: 9,294; yacc: 2,457; makefile: 1,208; lex: 1,161; xml: 173; f90: 7; fortran: 6; awk: 2
file content (70 lines) | stat: -rw-r--r-- 2,170 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*! \file
  Functions for Opaque Types

  Copyright 2011 University Corporation for Atmospheric
  Research/Unidata. See \ref copyright file for more info. */

#include "ncdispatch.h"

/** \name Opaque Types
    Functions to create and learn about opaque types. */
/*! \{ */ /* All these functions are part of this named group... */

/** \ingroup user_types
Create an opaque type. Provide a size and a name.

\param ncid \ref ncid
\param size The size of each opaque object in bytes.
\param name \ref object_name of the new type.
\param xtypep Pointer where the new typeid for this type is returned.

\returns ::NC_NOERR No error.
\returns ::NC_EBADID Bad \ref ncid.
\returns ::NC_EBADTYPE Bad type id.
\returns ::NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
\returns ::NC_EHDFERR An error was reported by the HDF5 layer.
\returns ::NC_ENAMEINUSE That name is in use.
\returns ::NC_EMAXNAME Name exceeds max length NC_MAX_NAME.
\returns ::NC_EBADNAME Name contains illegal characters.
\returns ::NC_EPERM Attempt to write to a read-only file.
\returns ::NC_ENOTINDEFINE Not in define mode. 
 */
int
nc_def_opaque(int ncid, size_t size, const char *name, nc_type *xtypep)
{
    NC* ncp;
    int stat = NC_check_id(ncid,&ncp);
    if(stat != NC_NOERR) return stat;
    return ncp->dispatch->def_opaque(ncid,size,name,xtypep);
}

/** \ingroup user_types
Learn about an opaque type.

\param ncid \ref ncid

\param xtype Typeid to inquire about.

\param name The \ref object_name of this type will be
copied here. \ref ignored_if_null.

\param sizep The size of the type will be copied here. \ref
ignored_if_null.

\returns ::NC_NOERR No error.
\returns ::NC_EBADID Bad \ref ncid.
\returns ::NC_EBADTYPE Bad type id.
\returns ::NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
\returns ::NC_EHDFERR An error was reported by the HDF5 layer.
 */
int
nc_inq_opaque(int ncid, nc_type xtype, char *name, size_t *sizep)
{
    int class = 0;
    int stat = nc_inq_user_type(ncid,xtype,name,sizep,NULL,NULL,&class);
    if(stat != NC_NOERR) return stat;
    if(class != NC_OPAQUE) stat = NC_EBADTYPE;
    return stat;
}

/*! \} */  /* End of named group ...*/