source: XIOS/dev/dev_cmip6_omp/extern/src_netcdf4/dopaque.c @ 1606

Last change on this file since 1606 was 409, checked in by ymipsl, 11 years ago

Add improved nectdf internal library src

YM

  • Property svn:eol-style set to native
File size: 2.1 KB
Line 
1/*! \file
2  Functions for Opaque Types
3
4  Copyright 2011 University Corporation for Atmospheric
5  Research/Unidata. See \ref copyright file for more info. */
6
7#include "ncdispatch.h"
8
9/** \name Opaque Types
10    Functions to create and learn about opaque types. */
11/*! \{ */ /* All these functions are part of this named group... */
12
13/** \ingroup user_types
14Create an opaque type. Provide a size and a name.
15
16\param ncid \ref ncid
17\param size The size of each opaque object in bytes.
18\param name \ref object_name of the new type.
19\param xtypep Pointer where the new typeid for this type is returned.
20
21\returns ::NC_NOERR No error.
22\returns ::NC_EBADID Bad \ref ncid.
23\returns ::NC_EBADTYPE Bad type id.
24\returns ::NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
25\returns ::NC_EHDFERR An error was reported by the HDF5 layer.
26\returns ::NC_ENAMEINUSE That name is in use.
27\returns ::NC_EMAXNAME Name exceeds max length NC_MAX_NAME.
28\returns ::NC_EBADNAME Name contains illegal characters.
29\returns ::NC_EPERM Attempt to write to a read-only file.
30\returns ::NC_ENOTINDEFINE Not in define mode.
31 */
32int
33nc_def_opaque(int ncid, size_t size, const char *name, nc_type *xtypep)
34{
35    NC* ncp;
36    int stat = NC_check_id(ncid,&ncp);
37    if(stat != NC_NOERR) return stat;
38    return ncp->dispatch->def_opaque(ncid,size,name,xtypep);
39}
40
41/** \ingroup user_types
42Learn about an opaque type.
43
44\param ncid \ref ncid
45
46\param xtype Typeid to inquire about.
47
48\param name The \ref object_name of this type will be
49copied here. \ref ignored_if_null.
50
51\param sizep The size of the type will be copied here. \ref
52ignored_if_null.
53
54\returns ::NC_NOERR No error.
55\returns ::NC_EBADID Bad \ref ncid.
56\returns ::NC_EBADTYPE Bad type id.
57\returns ::NC_ENOTNC4 Not an netCDF-4 file, or classic model enabled.
58\returns ::NC_EHDFERR An error was reported by the HDF5 layer.
59 */
60int
61nc_inq_opaque(int ncid, nc_type xtype, char *name, size_t *sizep)
62{
63    int class = 0;
64    int stat = nc_inq_user_type(ncid,xtype,name,sizep,NULL,NULL,&class);
65    if(stat != NC_NOERR) return stat;
66    if(class != NC_OPAQUE) stat = NC_EBADTYPE;
67    return stat;
68}
69
70/*! \} */  /* End of named group ...*/
Note: See TracBrowser for help on using the repository browser.