enhance bitfield copy
[babeltrace.git] / include / babeltrace / types.h
CommitLineData
d79865b9
MD
1#ifndef _BABELTRACE_TYPES_H
2#define _BABELTRACE_TYPES_H
3
4/*
5 * BabelTrace
6 *
fc93b2bd 7 * Type Header
d79865b9
MD
8 *
9 * Copyright (c) 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
fc93b2bd
MD
26#include <babeltrace/format.h>
27
28struct type_class {
29 GQuark name; /* type name */
30 size_t alignment; /* type alignment, in bits */
31 /*
32 * Type copy function. Knows how to find the child type_class from the
33 * parent type_class.
34 */
35 size_t (*copy)(unsigned char *dest, const struct format *fdest,
36 const unsigned char *src, const struct format *fsrc,
37 const struct type_class *type_class);
38};
39
40struct type_class_integer {
41 struct type_class p;
42 size_t len; /* length, in bits. */
43 int byte_order; /* byte order */
44 int signedness;
45};
46
698f0fe4
MD
47int integer_type_new(const char *name, size_t len, int byte_order,
48 int signedness);
49
fc93b2bd
MD
50struct type_class_bitfield {
51 struct type_class_integer p;
52 size_t start_offset; /* offset from base address, in bits */
53};
54
698f0fe4
MD
55int bitfield_type_new(const char *name, size_t start_offset,
56 size_t len, int byte_order, int signedness);
57
fc93b2bd
MD
58struct type_class_float {
59 struct type_class p;
60 size_t mantissa_len;
61 size_t exp_len;
62 int byte_order;
63};
64
65struct type_class_enum {
66 struct type_class_bitfield; /* inherit from bitfield */
67 struct enum_table *table;
68};
69
70struct type_class_struct {
71 struct type_class p;
72 /* TODO */
73};
74
698f0fe4
MD
75struct type_class *ctf_lookup_type(GQuark qname);
76int ctf_register_type(struct type_class *type_class);
77
d79865b9 78#endif /* _BABELTRACE_TYPES_H */
This page took 0.025609 seconds and 4 git commands to generate.