source: XIOS/dev/dev_cmip6_omp/extern/src_netcdf4/nchashmap.h @ 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: 1.7 KB
Line 
1/*********************************************************************
2 *   Copyright 1993, UCAR/Unidata
3 *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
4 *   $Header: /upc/share/CVS/netcdf-3/libncdap3/nchashmap.h,v 1.4 2009/09/23 22:26:08 dmh Exp $
5 *********************************************************************/
6#ifndef NCHASHMAP_H
7#define NCHASHMAP_H 1
8
9#include "nclist.h"
10
11/* Define the type of the elements in the hashmap*/
12
13#if defined(_CPLUSPLUS_) || defined(__CPLUSPLUS__)
14#define EXTERNC extern "C"
15#else
16#define EXTERNC extern
17#endif
18
19typedef unsigned long nchashid;
20
21EXTERNC int nchashnull(ncelem);
22
23typedef struct NChashmap {
24  int alloc;
25  int size; /* # of pairs still in table*/
26  NClist** table;
27} NChashmap;
28
29EXTERNC NChashmap* nchashnew(void);
30EXTERNC NChashmap* nchashnew0(int);
31EXTERNC int nchashfree(NChashmap*);
32
33/* Insert a (ncnchashid,ncelem) pair into the table*/
34/* Fail if already there*/
35EXTERNC int nchashinsert(NChashmap*, nchashid nchash, ncelem value);
36
37/* Insert a (nchashid,ncelem) pair into the table*/
38/* Overwrite if already there*/
39EXTERNC int nchashreplace(NChashmap*, nchashid nchash, ncelem value);
40
41/* lookup a nchashid and return found/notfound*/
42EXTERNC int nchashlookup(NChashmap*, nchashid nchash, ncelem* valuep);
43
44/* lookup a nchashid and return 0 or the value*/
45EXTERNC ncelem nchashget(NChashmap*, nchashid nchash);
46
47/* remove a nchashid*/
48EXTERNC int nchashremove(NChashmap*, nchashid nchash);
49
50/* Return the ith pair; order is completely arbitrary*/
51/* Can be expensive*/
52EXTERNC int nchashith(NChashmap*, int i, nchashid*, ncelem*);
53
54EXTERNC int nchashkeys(NChashmap* hm, nchashid** keylist);
55
56/* return the # of pairs in table*/
57#define nchashsize(hm) ((hm)?(hm)->size:0)
58
59#endif /*NCHASHMAP_H*/
60
Note: See TracBrowser for help on using the repository browser.