f1af40ee7ea5cb953e10ab5df315854bfd808a2a
[collectd.git] / src / meta_data.h
1 /**
2  * collectd - src/meta_data.h
3  * Copyright (C) 2008-2011  Florian octo Forster
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; only version 2 of the License is applicable.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
17  *
18  * Authors:
19  *   Florian octo Forster <octo at verplant.org>
20  **/
21
22 #ifndef META_DATA_H
23 #define META_DATA_H
24
25 #include "collectd.h"
26
27 /*
28  * Defines
29  */
30 #define MD_TYPE_STRING       1
31 #define MD_TYPE_SIGNED_INT   2
32 #define MD_TYPE_UNSIGNED_INT 3
33 #define MD_TYPE_DOUBLE       4
34 #define MD_TYPE_BOOLEAN      5
35
36 struct meta_data_s;
37 typedef struct meta_data_s meta_data_t;
38
39 meta_data_t *meta_data_create (void);
40 meta_data_t *meta_data_clone (meta_data_t *orig);
41 void meta_data_destroy (meta_data_t *md);
42
43 int meta_data_exists (meta_data_t *md, const char *key);
44 int meta_data_type (meta_data_t *md, const char *key);
45 int meta_data_toc (meta_data_t *md, char ***toc);
46 int meta_data_delete (meta_data_t *md, const char *key);
47
48 int meta_data_add_string (meta_data_t *md,
49     const char *key,
50     const char *value);
51 int meta_data_add_signed_int (meta_data_t *md,
52     const char *key,
53     int64_t value);
54 int meta_data_add_unsigned_int (meta_data_t *md,
55     const char *key,
56     uint64_t value);
57 int meta_data_add_double (meta_data_t *md,
58     const char *key,
59     double value);
60 int meta_data_add_boolean (meta_data_t *md,
61     const char *key,
62     _Bool value);
63
64 int meta_data_get_string (meta_data_t *md,
65     const char *key,
66     char **value);
67 int meta_data_get_signed_int (meta_data_t *md,
68     const char *key,
69     int64_t *value);
70 int meta_data_get_unsigned_int (meta_data_t *md,
71     const char *key,
72     uint64_t *value);
73 int meta_data_get_double (meta_data_t *md,
74     const char *key,
75     double *value);
76 int meta_data_get_boolean (meta_data_t *md,
77     const char *key,
78     _Bool *value);
79
80 #endif /* META_DATA_H */
81 /* vim: set sw=2 sts=2 et : */