cdi_key.h 1.13 KB
Newer Older
1 2
#ifndef  CDI_KEY_H
#define  CDI_KEY_H
3

Uwe Schulzweida's avatar
Uwe Schulzweida committed
4
#include "cdi_limits.h"
5

6
// CDI key
7 8
typedef struct {
  int       key;          // CDI key
9 10
  int       type;         // KEY_INT, KEY_FLOAT, KEY_BYTES
  int       length;       // number of bytes in v.s
11 12 13
  union {
    int i;
    double d;
14
    unsigned char *s;
15 16 17 18 19 20 21 22 23 24
  } v;
} cdi_key_t;


typedef struct {
  size_t     nalloc;		// number allocated >= nelems
  size_t     nelems;		// length of the array
  cdi_key_t  value[MAX_KEYS];
} cdi_keys_t;

25
enum  {KEY_INT = 1, KEY_FLOAT, KEY_BYTES};
26

27
void cdiDefVarKeyInt(cdi_keys_t *keysp, int key, int value);
28
void cdiDefVarKeyBytes(cdi_keys_t *keysp, int key, const unsigned char *bytes, int length);
29
cdi_key_t *find_key(cdi_keys_t *keysp, int key);
30
const char *cdiInqVarKeyStringPtr(cdi_keys_t *keysp, int key);
31

32 33
void cdiCopyVarKeys(cdi_keys_t *keysp, int cdiID2, int varID2);
void cdiDeleteVarKeys(cdi_keys_t *keysp);
34 35
void cdiDeleteKeys(int cdiID, int varID);
void cdiPrintKeys(int cdiID, int varID);
36

37 38 39 40 41 42 43 44 45 46 47
#endif

/*
 * Local Variables:
 * c-file-style: "Java"
 * c-basic-offset: 2
 * indent-tabs-mode: nil
 * show-trailing-whitespace: t
 * require-trailing-newline: t
 * End:
 */