cdi_key.h 956 Bytes
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

26
void cdiDefVarKeyInt(cdi_keys_t *keysp, int key, int value);
27
28
void cdiDefVarKeyBytes(cdi_keys_t *keysp, int key, const unsigned char *bytes, int length);

29
30
31
32
void cdiCopyVarKeys(cdi_keys_t *keysp, int cdiID2, int varID2);
void cdiDeleteVarKeys(cdi_keys_t *keysp);
int cdiDeleteKeys(int cdiID, int varID);

33
34
35
36
37
38
39
40
41
42
43
#endif

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