~ubuntu-branches/ubuntu/precise/openwalnut/precise

« back to all changes in this revision

Viewing changes to src/modules/data/ext/libeep/eep/val.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Eichelbaum
  • Date: 2011-06-21 10:26:54 UTC
  • Revision ID: james.westby@ubuntu.com-20110621102654-rq0zf436q949biih
Tags: upstream-1.2.5
ImportĀ upstreamĀ versionĀ 1.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
**  OSSP val - Value Access
 
3
**  Copyright (c) 2002-2004 Ralf S. Engelschall <rse@engelschall.com>
 
4
**  Copyright (c) 2002-2004 The OSSP Project <http://www.ossp.org/>
 
5
**  Copyright (c) 2002-2004 Cable & Wireless <http://www.cw.com/>
 
6
**
 
7
**  This file is part of OSSP val, a value access library which
 
8
**  can be found at http://www.ossp.org/pkg/lib/val/.
 
9
**
 
10
**  Permission to use, copy, modify, and distribute this software for
 
11
**  any purpose with or without fee is hereby granted, provided that
 
12
**  the above copyright notice and this permission notice appear in all
 
13
**  copies.
 
14
**
 
15
**  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 
16
**  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 
17
**  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 
18
**  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
 
19
**  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 
20
**  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 
21
**  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 
22
**  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 
23
**  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 
24
**  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 
25
**  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 
26
**  SUCH DAMAGE.
 
27
**
 
28
**  val.h: library API
 
29
*/
 
30
 
 
31
#ifndef __VAL_H__
 
32
#define __VAL_H__
 
33
 
 
34
#include <stdarg.h>
 
35
 
 
36
/* maximum length of a structured value name */
 
37
#define VAL_MAXNAME 1024
 
38
 
 
39
/* the set of distinct value types */
 
40
enum {
 
41
    VAL_TYPE_VAL    = 1<<0,
 
42
    VAL_TYPE_PTR    = 1<<1,
 
43
    VAL_TYPE_CHAR   = 1<<2,
 
44
    VAL_TYPE_SHORT  = 1<<3,
 
45
    VAL_TYPE_INT    = 1<<4,
 
46
    VAL_TYPE_LONG   = 1<<5,
 
47
    VAL_TYPE_FLOAT  = 1<<6,
 
48
    VAL_TYPE_DOUBLE = 1<<7
 
49
};
 
50
 
 
51
/* the set of return codes */
 
52
typedef enum {
 
53
    VAL_OK,        /* everything ok */
 
54
    VAL_ERR_ARG,   /* error: invalid argument */
 
55
    VAL_ERR_USE,   /* error: invalid use */
 
56
    VAL_ERR_MEM,   /* error: no more memory */
 
57
    VAL_ERR_HSH,   /* error: hash table problem */
 
58
    VAL_ERR_INT,   /* error: internal error */
 
59
    VAL_ERR_SYS    /* error: system error (see errno) */
 
60
} val_rc_t;
 
61
 
 
62
/* the opaque data structure and type */
 
63
struct val_s;
 
64
typedef struct val_s val_t;
 
65
 
 
66
/* function type for use with val_apply() */
 
67
typedef val_rc_t (*val_cb_t)(void *, const char *, int, const char *, void *);
 
68
 
 
69
/* unique library identifier */
 
70
extern const char val_id[];
 
71
 
 
72
/* set of API functions */
 
73
val_rc_t val_create  (val_t **);
 
74
val_rc_t val_destroy (val_t *);
 
75
val_rc_t val_reg     (val_t *, const char *, int, const char *, void *);
 
76
val_rc_t val_unreg   (val_t *, const char *);
 
77
val_rc_t val_query   (val_t *, const char *, int *, char **, void **);
 
78
val_rc_t val_set     (val_t *, const char *, ...);
 
79
val_rc_t val_get     (val_t *, const char *, ...);
 
80
val_rc_t val_vset    (val_t *, const char *, va_list);
 
81
val_rc_t val_vget    (val_t *, const char *, va_list);
 
82
val_rc_t val_apply   (val_t *, const char *, int, val_cb_t, void *);
 
83
 
 
84
#endif /* __VAL_H__ */
 
85