Skip to content

Commit

Permalink
Support no-op dispatch functions
Browse files Browse the repository at this point in the history
re: Unidata#1693

1. Add functions to libdispatch/dnotnc4.c to support
   dispatch table operations that should work for any
   dispatch table, even if they do not do anything.
   Functions such as nc_inq_var_filter.
2. Modify selected dispatch tables to utilize
   the noop functions.
3. Extend nc_test/tst_formats.c to test.

This is an extension of Ed's work to do this for
chunking and deflate and szip. See PRs
Unidata#1697
and
Unidata#1692

As a side effect, elide libdispatch/dnotnc3.c since
it is no longer used.
  • Loading branch information
DennisHeimbigner committed Apr 15, 2020
1 parent a8732ca commit f0cd7f8
Show file tree
Hide file tree
Showing 10 changed files with 421 additions and 369 deletions.
19 changes: 8 additions & 11 deletions include/netcdf_dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,6 @@ extern "C" {
EXTERNL int NC_RO_rename_dim(int ncid, int dimid, const char *name);
EXTERNL int NC_RO_set_fill(int ncid, int fillmode, int *old_modep);

/* These functions are for dispatch layers that don't implement
* these legacy functions. They return NC_ENOTNC3. */
EXTERNL int NC_NOTNC3_put_varm(int ncid, int varid, const size_t * start,
const size_t *edges, const ptrdiff_t *stride,
const ptrdiff_t *imapp, const void *value0,
nc_type memtype);
EXTERNL int NC_NOTNC3_get_varm(int ncid, int varid, const size_t *start,
const size_t *edges, const ptrdiff_t *stride,
const ptrdiff_t *imapp, void *value0, nc_type memtype);

/* These functions are for dispatch layers that don't implement
* the enhanced model. They return NC_ENOTNC4. */
EXTERNL int NC_NOTNC4_def_var_filter(int, int, unsigned int, size_t,
Expand Down Expand Up @@ -230,9 +220,16 @@ extern "C" {
EXTERNL int NC_NOTNC4_inq_typeids(int, int *, int *);
EXTERNL int NC_NOTNC4_inq_user_type(int, nc_type, char *, size_t *,
nc_type *, size_t *, int *);
EXTERNL int NC_NOTNC4_inq_typeid(int, const char *, nc_type *);
EXTERNL int NC_NOTNC4_filter_actions(int, int, int, struct NC_Filterobject*);

/* These functions are for dispatch layers that don't implement
* the enhanced model, but want to succeed anyway.
* They return NC_NOERR plus properly set the out parameters.
* In some cases (filter actions), some cases may succeed and some
* will fail.
*/
EXTERNL int NC_NOOP_filter_actions(int, int, int, struct NC_Filterobject*);

#if defined(__cplusplus)
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion libdap2/ncd2dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ NCD2_def_var_filter,
NCD2_set_var_chunk_cache,
NCD2_get_var_chunk_cache,

NC_NOTNC4_filter_actions,
NC_NOOP_filter_actions,

};

Expand Down
10 changes: 1 addition & 9 deletions libdap4/ncd4dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,6 @@ NCD4_set_var_chunk_cache(int ncid, int p2, size_t p3, size_t p4, float p5)
return (NC_EPERM);
}

struct NC_FILTER_ACTION;

static int
NCD4_filter_actions(int ncid, int varid, int action, struct NC_Filterobject* spec)
{
return (NC_EPERM);
}

/**************************************************/
/*
Following functions basically return the netcdf-4 value WRT to the nc4id.
Expand Down Expand Up @@ -870,7 +862,7 @@ NCD4_def_var_filter,
NCD4_set_var_chunk_cache,
NCD4_get_var_chunk_cache,

NCD4_filter_actions,
NC_NOOP_filter_actions,
};


2 changes: 1 addition & 1 deletion libdispatch/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ libdispatch_la_SOURCES = dparallel.c dcopy.c dfile.c ddim.c datt.c \
dattinq.c dattput.c dattget.c derror.c dvar.c dvarget.c dvarput.c \
dvarinq.c dinternal.c ddispatch.c dutf8.c nclog.c dstring.c ncuri.c \
nclist.c ncbytes.c nchashmap.c nctime.c nc.c nclistmgr.c \
dauth.c doffsets.c dwinpath.c dutil.c dreadonly.c dnotnc4.c dnotnc3.c \
dauth.c doffsets.c dwinpath.c dutil.c dreadonly.c dnotnc4.c \
crc32.c crc32.h daux.c dinfermodel.c

# Add the utf8 codebase
Expand Down
Loading

0 comments on commit f0cd7f8

Please sign in to comment.