netcdf-c/include/ncmodel.h
Dennis Heimbigner f1506d552e Change (again), and hopefully simplify, the file model inference algorithm.
* For URL paths, the new approach essentially centralizes all information
  in the URL into the "#mode=" fragment key and uses that value
  to determine the dispatcher for (most) URLs.

* The new approach has the following steps:

  1. canonicalize the path if it is a URL.
  2. use the mode= fragment key to determine the dispatcher
  3. if dispatcher still not determined, then use the mode flags
     argument to nc_open/nc_create to determine the dispatcher.
  4. if the path points to something readable, attempt to read the
     magic number at the front, and use that to determine the dispatcher.
     this case may override all previous cases.

* Misc changes.

  1. Update documentation
  2. Moved some unit tests from libdispatch to unit_test directory.
  3. Fixed use of wrong #ifdef macro in test_filter_reg.c
     [I think this may fix an previously reported esupport query].
2019-09-29 12:59:28 -06:00

38 lines
1.1 KiB
C

/* Copyright 2018-2018 University Corporation for Atmospheric
Research/Unidata. */
/**
* Functions for inferring dataset model
* @author Dennis Heimbigner
*/
#ifndef NCINFERMODEL_H
#define NCINFERMODEL_H
/* Track the information hat will help us
infer how to access the data defined by
path + omode + (sometimes) file content.
*/
typedef struct NCmodel {
int impl; /* NC_FORMATX_XXX value */
int format; /* NC_FORMAT_XXX value; Used to remember extra info; */
} NCmodel;
/* Keep compiler quiet */
struct NCURI;
struct NC_dispatch;
/* Infer model implementation */
EXTERNL int NC_infermodel(const char* path, int* omodep, int iscreate, int useparallel, void* params, NCmodel* model, char** newpathp);
/**
* Provide a hidden interface to allow utilities
* to check if a given path name is really a url.
* If not, put null in basenamep, else put basename of the url
* minus any extension into basenamep; caller frees.
* Return 1 if it looks like a url, 0 otherwise.
*/
EXTERNL int nc__testurl(const char* path, char** basenamep);
#endif /*NCINFERMODEL_H*/