123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915 |
- /** \substrate
- Define the substrate dispatch table and functions
- These functions end up calling functions in one of the dispatch layers
- (netCDF-4, dap server, etc) using the substrate field of struct NC.
- Copyright 2010 University Corporation for Atmospheric
- Research/Unidata. See COPYRIGHT file for more info.
- */
- #include "netcdf.h"
- #include "ncdispatch.h"
- /* forward */
- static NC_Dispatch NCSUBSTRATE_dispatch_base;
- /*
- Note that because many of the signatures differ
- from the netcdf API, we need to break
- the abstraction and invoke the
- substrate dispatch table directly.
- */
- int
- NCSUBSTRATE_initialize(void)
- {
- NCSUBSTRATE_dispatch_table = &NCSUBSTRATE_dispatch_base;
- return NC_NOERR;
- }
- static int
- NCSUB_new_nc(NC** ncp)
- {
- NC* nc;
- /* Allocate memory for this info. */
- if (!(nc = calloc(1, sizeof(struct NC))))
- return NC_ENOMEM;
- if(ncp) *ncp = nc;
- return NC_NOERR;
- }
- static int
- NCSUB_redef(int ncid)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate,&ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->redef(nc->substrate);
- }
- static int
- NCSUB__enddef(int ncid, size_t a1, size_t a2, size_t a3, size_t a4)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->_enddef(nc->substrate,a1,a2,a3,a4);
- }
- static int
- NCSUB_sync(int ncid)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->sync(nc->substrate);
- }
- static int
- NCSUB_abort(int ncid)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->abort(nc->substrate);
- }
- static int
- NCSUB_close(int ncid)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->close(nc->substrate);
- }
- static int
- NCSUB_set_fill(int ncid, int a1, int* a2)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->set_fill(nc->substrate,a1,a2);
- }
- static int
- NCSUB_inq_base_pe(int ncid, int* a1)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_base_pe(nc->substrate,a1);
- }
- static int
- NCSUB_set_base_pe(int ncid, int a1)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->set_base_pe(nc->substrate,a1);
- }
- static int
- NCSUB_inq_format(int ncid, int* a1)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_format(nc->substrate,a1);
- }
- static int
- NCSUB_inq(int ncid, int* a1, int* a2, int* a3, int* a4)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq(nc->substrate,a1,a2,a3,a4);
- }
- static int
- NCSUB_inq_type(int ncid, nc_type a1, char* a2, size_t* a3)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_type(nc->substrate,a1,a2,a3);
- }
- static int
- NCSUB_def_dim(int ncid, const char* a1, size_t a2, int* a3)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_dim(nc->substrate,a1,a2,a3);
- }
- static int
- NCSUB_inq_dimid(int ncid, const char* a1, int* a2)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_dimid(nc->substrate,a1,a2);
- }
- static int
- NCSUB_inq_dim(int ncid, int a1, char* a2, size_t* a3)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_dim(nc->substrate,a1,a2,a3);
- }
- static int
- NCSUB_inq_unlimdim(int ncid, int* a1)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_unlimdim(nc->substrate,a1);
- }
- static int
- NCSUB_rename_dim(int ncid, int a1, const char* a2)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->rename_dim(nc->substrate,a1,a2);
- }
- static int
- NCSUB_inq_att(int ncid, int a1, const char* a2, nc_type* a3, size_t* a4)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_att(nc->substrate,a1,a2,a3,a4);
- }
- static int
- NCSUB_inq_attid(int ncid, int a1, const char* a2, int* a3)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_attid(nc->substrate,a1,a2,a3);
- }
- static int
- NCSUB_inq_attname(int ncid, int a1, int a2, char* a3)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_attname(nc->substrate,a1,a2,a3);
- }
- static int
- NCSUB_rename_att(int ncid, int a1, const char* a2, const char* a3)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->rename_att(nc->substrate,a1,a2,a3);
- }
- static int
- NCSUB_del_att(int ncid, int a1, const char* a2)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->del_att(nc->substrate,a1,a2);
- }
- static int
- NCSUB_get_att(int ncid, int a1, const char* a2, void* a3, nc_type a4)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->get_att(nc->substrate,a1,a2,a3,a4);
- }
- static int
- NCSUB_put_att(int ncid, int a1, const char* a2, nc_type a3, size_t a4, const void* a5, nc_type a6)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->put_att(nc->substrate,a1,a2,a3,a4,a5,a6);
- }
- static int
- NCSUB_def_var(int ncid, const char* a1, nc_type a2, int a3, const int* a4, int* a5)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_var(nc->substrate,a1,a2,a3,a4,a5);
- }
- static int
- NCSUB_inq_varid(int ncid, const char* a1, int* a2)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_varid(nc->substrate,a1,a2);
- }
- static int
- NCSUB_rename_var(int ncid, int a1, const char* a2)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->rename_var(nc->substrate,a1,a2);
- }
- static int
- NCSUB_get_vara(int ncid, int a1, const size_t* a2, const size_t* a3, void* a4, nc_type a5)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->get_vara(nc->substrate,a1,a2,a3,a4,a5);
- }
- static int
- NCSUB_put_vara(int ncid, int a1, const size_t* a2, const size_t* a3, const void* a4, nc_type a5)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->put_vara(nc->substrate,a1,a2,a3,a4,a5);
- }
- /* Added to solve Ferret performance problem with Opendap */
- static int
- NCSUB_get_vars(int ncid, int a1, const size_t* a2, const size_t* a3, const ptrdiff_t* a4, void* a5, nc_type a6)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->get_vars(nc->substrate,a1,a2,a3,a4,a5,a6);
- }
- static int
- NCSUB_put_vars(int ncid, int a1, const size_t* a2, const size_t* a3, const ptrdiff_t* a4, const void* a5, nc_type a6)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->put_vars(nc->substrate,a1,a2,a3,a4,a5,a6);
- }
- static int
- NCSUB_get_varm(int ncid, int a1, const size_t* a2, const size_t* a3, const ptrdiff_t* a4, const ptrdiff_t* a5, void* a6, nc_type a7)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->get_varm(nc->substrate,a1,a2,a3,a4,a5,a6,a7);
- }
- static int
- NCSUB_put_varm(int ncid, int a1, const size_t* a2, const size_t* a3, const ptrdiff_t* a4, const ptrdiff_t* a5, const void* a6, nc_type a7)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->put_varm(nc->substrate,a1,a2,a3,a4,a5,a6,a7);
- }
- static int
- NCSUB_inq_var_all(int ncid, int varid, char* name, nc_type* xtypep,
- int* ndimsp, int* dimidsp, int* nattsp,
- int* shufflep, int* deflatep, int* deflate_levelp,
- int* fletcher32p, int* contiguousp, size_t* chunksizesp,
- int* no_fill, void* fill_valuep, int* endiannessp,
- int* options_maskp, int* pixels_per_blockp)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_var_all(nc->substrate,varid,name,xtypep,
- ndimsp,dimidsp,nattsp,shufflep,
- deflatep,deflate_levelp,fletcher32p,
- contiguousp,chunksizesp,
- no_fill,fill_valuep,
- endiannessp,
- options_maskp,pixels_per_blockp);
- }
- #ifdef USE_NETCDF4
- static int
- NCSUB_show_metadata(int ncid)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->show_metadata(nc->substrate);
- }
- static int
- NCSUB_inq_unlimdims(int ncid, int* a1, int* a2)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_unlimdims(nc->substrate,a1,a2);
- }
- static int
- NCSUB_var_par_access(int ncid, int a1, int a2)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->var_par_access(nc->substrate,a1,a2);
- }
- static int
- NCSUB_inq_ncid(int ncid, const char* a1, int* a2)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_ncid(nc->substrate,a1,a2);
- }
- static int
- NCSUB_inq_grps(int ncid, int* a1, int* a2)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_grps(nc->substrate,a1,a2);
- }
- static int
- NCSUB_inq_grpname(int ncid, char* a1)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_grpname(nc->substrate,a1);
- }
- static int
- NCSUB_inq_grpname_full(int ncid, size_t* a1, char* a2)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_grpname_full(nc->substrate,a1,a2);
- }
- static int
- NCSUB_inq_grp_parent(int ncid, int* a1)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_grp_parent(nc->substrate,a1);
- }
- static int
- NCSUB_inq_grp_full_ncid(int ncid, const char* a1, int* a2)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_grp_full_ncid(nc->substrate,a1,a2);
- }
- static int
- NCSUB_inq_varids(int ncid, int* a1, int* a2)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_varids(nc->substrate,a1,a2);
- }
- static int
- NCSUB_inq_dimids(int ncid, int* a1, int* a2, int a3)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_dimids(nc->substrate,a1,a2,a3);
- }
- static int
- NCSUB_inq_typeids(int ncid, int* a1, int* a2)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_typeids(nc->substrate,a1,a2);
- }
- static int
- NCSUB_inq_type_equal(int ncid, nc_type a1, int a2, nc_type a3, int* a4)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_type_equal(nc->substrate,a1,a2,a3,a4);
- }
- static int
- NCSUB_def_grp(int ncid, const char* a1, int* a2)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_grp(nc->substrate,a1,a2);
- }
- static int
- NCSUB_inq_user_type(int ncid, nc_type a1, char* a2, size_t* a3, nc_type* a4, size_t* a5, int* a6)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_user_type(nc->substrate,a1,a2,a3,a4,a5,a6);
- }
- static int
- NCSUB_inq_typeid(int ncid, const char* a1, nc_type* a2)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_typeid(nc->substrate,a1,a2);
- }
- static int
- NCSUB_def_compound(int ncid, size_t a1, const char* a2, nc_type* a3)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_compound(nc->substrate,a1,a2,a3);
- }
- static int
- NCSUB_insert_compound(int ncid, nc_type a1, const char* a2, size_t a3, nc_type a4)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->insert_compound(nc->substrate,a1,a2,a3,a4);
- }
- static int
- NCSUB_insert_array_compound(int ncid, nc_type a1, const char* a2, size_t a3, nc_type a4, int a5, const int* a6)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->insert_array_compound(nc->substrate,a1,a2,a3,a4,a5,a6);
- }
- static int
- NCSUB_inq_compound_field(int ncid, nc_type a1, int a2, char* a3, size_t* a4, nc_type* a5, int* a6, int* a7)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_compound_field(nc->substrate,a1,a2,a3,a4,a5,a6,a7);
- }
- static int
- NCSUB_inq_compound_fieldindex(int ncid, nc_type a1, const char* a2, int* a3)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_compound_fieldindex(nc->substrate,a1,a2,a3);
- }
- static int
- NCSUB_def_vlen(int ncid, const char* a1, nc_type a2, nc_type* a3)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_vlen(nc->substrate,a1,a2,a3);
- }
- static int
- NCSUB_put_vlen_element(int ncid, int a1, void* a2, size_t a3, const void* a4)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->put_vlen_element(nc->substrate,a1,a2,a3,a4);
- }
- static int
- NCSUB_get_vlen_element(int ncid, int a1, const void* a2, size_t* a3, void* a4)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->get_vlen_element(nc->substrate,a1,a2,a3,a4);
- }
- static int
- NCSUB_def_enum(int ncid, nc_type a1, const char* a2, nc_type* a3)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_enum(nc->substrate,a1,a2,a3);
- }
- static int
- NCSUB_insert_enum(int ncid, nc_type a1, const char* a2, const void* a3)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->insert_enum(nc->substrate,a1,a2,a3);
- }
- static int
- NCSUB_inq_enum_member(int ncid, nc_type a1, int a2, char* a3, void* a4)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_enum_member(nc->substrate,a1,a2,a3,a4);
- }
- static int
- NCSUB_inq_enum_ident(int ncid, nc_type a1, long long a2, char* a3)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->inq_enum_ident(nc->substrate,a1,a2,a3);
- }
- static int
- NCSUB_def_opaque(int ncid, size_t a1, const char* a2, nc_type* a3)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_opaque(nc->substrate,a1,a2,a3);
- }
- static int
- NCSUB_def_var_deflate(int ncid, int a1, int a2, int a3, int a4)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_var_deflate(nc->substrate,a1,a2,a3,a4);
- }
- static int
- NCSUB_def_var_fletcher32(int ncid, int a1, int a2)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_var_fletcher32(nc->substrate,a1,a2);
- }
- static int
- NCSUB_def_var_chunking(int ncid, int a1, int a2, const size_t* a3)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_var_chunking(nc->substrate,a1,a2,a3);
- }
- static int
- NCSUB_def_var_fill(int ncid, int a1, int a2, const void* a3)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_var_fill(nc->substrate,a1,a2,a3);
- }
- static int
- NCSUB_def_var_endian(int ncid, int a1, int a2)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->def_var_endian(nc->substrate,a1,a2);
- }
- static int
- NCSUB_set_var_chunk_cache(int ncid, int a1, size_t a2, size_t a3, float a4)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->set_var_chunk_cache(nc->substrate,a1,a2,a3,a4);
- }
- static int
- NCSUB_get_var_chunk_cache(int ncid, int a1, size_t* a2, size_t* a3, float* a4)
- {
- NC *nc, *ncsub;
- int ncstat = NC_check_id(ncid, &nc);
- if(ncstat != NC_NOERR) return ncstat;
- ncstat = NC_check_id(nc->substrate, &ncsub);
- if(ncstat != NC_NOERR) return ncstat;
- return ncsub->dispatch->get_var_chunk_cache(nc->substrate,a1,a2,a3,a4);
- }
- #endif /*USE_NETCDF4*/
- /* Declare here to avoid having a bunch of static forward declarations */
- static NC_Dispatch NCSUBSTRATE_dispatch_base = {
- 0,
- NCSUB_new_nc,
- NULL, /*NC_create*/
- NULL, /*NC_open*/
- NCSUB_redef,
- NCSUB__enddef,
- NCSUB_sync,
- NCSUB_abort,
- NCSUB_close,
- NCSUB_set_fill,
- NCSUB_inq_base_pe,
- NCSUB_set_base_pe,
- NCSUB_inq_format,
- NCSUB_inq,
- NCSUB_inq_type,
- NCSUB_def_dim,
- NCSUB_inq_dimid,
- NCSUB_inq_dim,
- NCSUB_inq_unlimdim,
- NCSUB_rename_dim,
- NCSUB_inq_att,
- NCSUB_inq_attid,
- NCSUB_inq_attname,
- NCSUB_rename_att,
- NCSUB_del_att,
- NCSUB_get_att,
- NCSUB_put_att,
- NCSUB_def_var,
- NCSUB_inq_varid,
- NCSUB_rename_var,
- NCSUB_get_vara,
- NCSUB_put_vara,
- NCSUB_get_vars,
- NCSUB_put_vars,
- NCSUB_get_varm,
- NCSUB_put_varm,
- NCSUB_inq_var_all,
- #ifdef USE_NETCDF4
- NCSUB_show_metadata,
- NCSUB_inq_unlimdims,
- NCSUB_var_par_access,
- NCSUB_inq_ncid,
- NCSUB_inq_grps,
- NCSUB_inq_grpname,
- NCSUB_inq_grpname_full,
- NCSUB_inq_grp_parent,
- NCSUB_inq_grp_full_ncid,
- NCSUB_inq_varids,
- NCSUB_inq_dimids,
- NCSUB_inq_typeids,
- NCSUB_inq_type_equal,
- NCSUB_def_grp,
- NCSUB_inq_user_type,
- NCSUB_inq_typeid,
- NCSUB_def_compound,
- NCSUB_insert_compound,
- NCSUB_insert_array_compound,
- NCSUB_inq_compound_field,
- NCSUB_inq_compound_fieldindex,
- NCSUB_def_vlen,
- NCSUB_put_vlen_element,
- NCSUB_get_vlen_element,
- NCSUB_def_enum,
- NCSUB_insert_enum,
- NCSUB_inq_enum_member,
- NCSUB_inq_enum_ident,
- NCSUB_def_opaque,
- NCSUB_def_var_deflate,
- NCSUB_def_var_fletcher32,
- NCSUB_def_var_chunking,
- NCSUB_def_var_fill,
- NCSUB_def_var_endian,
- NCSUB_set_var_chunk_cache,
- NCSUB_get_var_chunk_cache
- #endif /*USE_NETCDF4*/
- };
- NC_Dispatch* NCSUBSTRATE_dispatch_table = NULL; /*Moved here from ddispatch.c*/
|