2016-01-15 07:02:00 +08:00
|
|
|
/*! \file netcdf_mem.h
|
|
|
|
*
|
|
|
|
* Main header file for in-memory (diskless) functionality.
|
|
|
|
*
|
2018-12-07 05:13:56 +08:00
|
|
|
* Copyright 2018 University Corporation for Atmospheric
|
2015-05-29 05:29:30 +08:00
|
|
|
* Research/Unidata. See COPYRIGHT file for more info.
|
|
|
|
*
|
|
|
|
* See \ref copyright file for more info.
|
2015-06-05 05:37:52 +08:00
|
|
|
*
|
2015-05-29 05:29:30 +08:00
|
|
|
*/
|
|
|
|
|
2019-10-29 00:29:39 +08:00
|
|
|
/*
|
|
|
|
* In order to use any of the netcdf_XXX.h files, it is necessary
|
|
|
|
* to include netcdf.h followed by any netcdf_XXX.h files.
|
|
|
|
* Various things (like EXTERNL) are defined in netcdf.h
|
|
|
|
* to make them available for use by the netcdf_XXX.h files.
|
|
|
|
*/
|
|
|
|
|
2015-05-29 05:29:30 +08:00
|
|
|
#ifndef NETCDF_MEM_H
|
|
|
|
#define NETCDF_MEM_H 1
|
|
|
|
|
2018-02-26 12:45:31 +08:00
|
|
|
typedef struct NC_memio {
|
|
|
|
size_t size;
|
|
|
|
void* memory;
|
|
|
|
int flags;
|
2018-09-05 01:27:47 +08:00
|
|
|
#define NC_MEMIO_LOCKED 1 /* Do not try to realloc or free provided memory */
|
2018-02-26 12:45:31 +08:00
|
|
|
} NC_memio;
|
|
|
|
|
2015-05-29 05:29:30 +08:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2019-09-18 10:27:43 +08:00
|
|
|
/* Treat a memory block as a file; read-only */
|
2016-01-15 07:02:00 +08:00
|
|
|
EXTERNL int nc_open_mem(const char* path, int mode, size_t size, void* memory, int* ncidp);
|
2015-05-29 05:29:30 +08:00
|
|
|
|
2018-02-26 12:45:31 +08:00
|
|
|
EXTERNL int nc_create_mem(const char* path, int mode, size_t initialsize, int* ncidp);
|
|
|
|
|
2019-09-18 10:27:43 +08:00
|
|
|
/* Alternative to nc_open_mem with extended capabilities
|
2018-02-26 12:45:31 +08:00
|
|
|
See docs/inmemory.md
|
|
|
|
*/
|
|
|
|
EXTERNL int nc_open_memio(const char* path, int mode, NC_memio* info, int* ncidp);
|
|
|
|
|
|
|
|
/* Close memory file and return the final memory state */
|
|
|
|
EXTERNL int nc_close_memio(int ncid, NC_memio* info);
|
|
|
|
|
2015-05-29 05:29:30 +08:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* NETCDF_MEM_H */
|