Relicense BabelTrace library to MIT (BSD-style)
[babeltrace.git] / include / babeltrace / format.h
CommitLineData
fc93b2bd
MD
1#ifndef _BABELTRACE_FORMAT_H
2#define _BABELTRACE_FORMAT_H
3
4/*
5 * BabelTrace
6 *
7 * Trace Format Header
8 *
ccd7e1c8 9 * Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
fc93b2bd 10 *
ccd7e1c8
MD
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
fc93b2bd 17 *
ccd7e1c8
MD
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
fc93b2bd
MD
20 */
21
22#include <stdint.h>
23#include <glib.h>
24
25struct format {
26 GQuark name;
27
bed864a7
MD
28 uint64_t (*uint_read)(struct stream_pos *pos,
29 const struct type_class_integer *int_class);
30 int64_t (*int_read)(struct stream_pos *pos,
31 const struct type_class_integer *int_class);
32 void (*uint_write)(struct stream_pos *pos,
33 const struct type_class_integer *int_class,
34 uint64_t v);
35 void (*int_write)(struct stream_pos *pos,
36 const struct type_class_integer *int_class,
37 int64_t v);
fc93b2bd 38
11d43b90
MD
39 void (*float_copy)(struct stream_pos *dest,
40 struct stream_pos *src,
bed864a7
MD
41 const struct type_class_float *src);
42 double (*double_read)(struct stream_pos *pos,
11d43b90 43 const struct type_class_float *float_class);
bed864a7 44 void (*double_write)(struct stream_pos *pos,
11d43b90 45 const struct type_class_float *float_class,
bed864a7 46 double v);
fc93b2bd 47
bed864a7
MD
48 void (*string_copy)(struct stream_pos *dest, struct stream_pos *src,
49 const struct type_class_string *string_class);
a52d7f6a
MD
50 void (*string_read)(unsigned char **dest, struct stream_pos *src,
51 const struct type_class_string *string_class);
52 void (*string_write)(struct stream_pos *dest, const unsigned char *src,
53 const struct type_class_string *string_class);
54 void (*string_free_temp)(unsigned char *string);
fc93b2bd 55
bed864a7 56 GQuark (*enum_read)(struct stream_pos *pos,
448d3cc7 57 const struct type_class_enum *src);
bed864a7
MD
58 void (*enum_write)(struct stream_pos *pos,
59 const struct type_class_enum *dest,
60 GQuark q);
11796b96
MD
61 void (*struct_begin)(struct stream_pos *pos,
62 const struct type_class_struct *struct_class);
63 void (*struct_end)(struct stream_pos *pos,
64 const struct type_class_struct *struct_class);
d06d03db
MD
65 void (*array_begin)(struct stream_pos *pos,
66 const struct type_class_array *array_class);
67 void (*array_end)(struct stream_pos *pos,
68 const struct type_class_array *array_class);
69 void (*sequence_begin)(struct stream_pos *pos,
70 const struct type_class_sequence *sequence_class);
71 void (*sequence_end)(struct stream_pos *pos,
72 const struct type_class_sequence *sequence_class);
fc93b2bd
MD
73};
74
75struct format *bt_lookup_format(GQuark qname);
76int bt_register_format(const struct format *format);
77
78/* TBD: format unregistration */
79
80#endif /* _BABELTRACE_FORMAT_H */
This page took 0.03702 seconds and 4 git commands to generate.