Common Trace Format - initial commit
[babeltrace.git] / include / ctf / ctf-types.h
1 #ifndef _CTF_TYPES_H
2 #define _CTF_TYPES_H
3
4 /*
5 * Common Trace Format
6 *
7 * Type header
8 *
9 * Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 *
11 * Dual LGPL v2.1/GPL v2 license.
12 */
13
14 #include <stdint.h>
15 #include <glib.h>
16
17 /*
18 * All write primitives,(as well as read for dynamically sized entities, can
19 * receive a NULL ptr/dest parameter. In this case, no write is performed, but
20 * the size is returned.
21 */
22
23 uint64_t ctf_uint_read(const uint8_t *ptr, int byte_order, size_t len);
24 int64_t ctf_int_read(const uint8_t *ptr, int byte_order, size_t len);
25 size_t ctf_uint_write(uint8_t *ptr, int byte_order, size_t len, uint64_t v);
26 size_t ctf_int_write(uint8_t *ptr, int byte_order, size_t len, int64_t v);
27
28 /*
29 * ctf-types-bitfield.h declares:
30 *
31 * ctf_bitfield_unsigned_read
32 * ctf_bitfield_signed_read
33 * ctf_bitfield_unsigned_write
34 * ctf_bitfield_signed_write
35 */
36 #include <ctf/ctf-types-bitfield.h>
37
38 double ctf_float_read(const uint8_t *ptr, int byte_order, size_t len);
39 size_t ctf_float_write(uint8_t *ptr, int byte_order, size_t len, double v);
40
41 size_t ctf_string_copy(char *dest, const char *src);
42
43 /*
44 * A GQuark can be translated to/from strings with g_quark_from_string() and
45 * g_quark_to_string().
46 */
47 GQuark ctf_enum_uint_to_quark(const struct enum_table *table, uint64_t v);
48 GQuark ctf_enum_int_to_quark(const struct enum_table *table, uint64_t v);
49 uint64_t ctf_enum_quark_to_uint(size_t len, int byte_order, GQuark q);
50 int64_t ctf_enum_quark_to_int(size_t len, int byte_order, GQuark q);
51 void ctf_enum_signed_insert(struct enum_table *table, int64_t v, GQuark q);
52 void ctf_enum_unsigned_insert(struct enum_table *table, uint64_t v, GQuark q);
53 struct enum_table *ctf_enum_new(void);
54 void ctf_enum_destroy(struct enum_table *table);
55
56 #endif /* _CTF_TYPES_H */
This page took 0.042062 seconds and 4 git commands to generate.