Rename: type_class, type -> type, declaration
[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 *
c054553d 9 * Copyright 2010, 2011 - 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
4c8bfb7e 22#include <babeltrace/types.h>
fc93b2bd
MD
23#include <stdint.h>
24#include <glib.h>
25
26struct format {
27 GQuark name;
28
bed864a7 29 uint64_t (*uint_read)(struct stream_pos *pos,
e19c3d69 30 const struct type_integer *integer_type);
bed864a7 31 int64_t (*int_read)(struct stream_pos *pos,
e19c3d69 32 const struct type_integer *integer_type);
bed864a7 33 void (*uint_write)(struct stream_pos *pos,
e19c3d69 34 const struct type_integer *integer_type,
bed864a7
MD
35 uint64_t v);
36 void (*int_write)(struct stream_pos *pos,
e19c3d69 37 const struct type_integer *integer_type,
bed864a7 38 int64_t v);
fc93b2bd 39
4c8bfb7e
MD
40 void (*float_copy)(struct stream_pos *destp,
41 struct stream_pos *srcp,
e19c3d69 42 const struct type_float *float_type);
bed864a7 43 double (*double_read)(struct stream_pos *pos,
e19c3d69 44 const struct type_float *float_type);
bed864a7 45 void (*double_write)(struct stream_pos *pos,
e19c3d69 46 const struct type_float *float_type,
bed864a7 47 double v);
fc93b2bd 48
bed864a7 49 void (*string_copy)(struct stream_pos *dest, struct stream_pos *src,
e19c3d69 50 const struct type_string *string_type);
47e0f2e2 51 void (*string_read)(char **dest, struct stream_pos *src,
e19c3d69 52 const struct type_string *string_type);
47e0f2e2 53 void (*string_write)(struct stream_pos *dest, const char *src,
e19c3d69 54 const struct type_string *string_type);
47e0f2e2 55 void (*string_free_temp)(char *string);
fc93b2bd 56
47e0f2e2
MD
57 /*
58 * enum_read returns a GArray of GQuark. Must be released with
59 * g_array_unref().
60 */
61 GArray *(*enum_read)(struct stream_pos *pos,
e19c3d69 62 const struct type_enum *src);
bed864a7 63 void (*enum_write)(struct stream_pos *pos,
e19c3d69 64 const struct type_enum *dest,
bed864a7 65 GQuark q);
11796b96 66 void (*struct_begin)(struct stream_pos *pos,
e19c3d69 67 const struct type_struct *struct_type);
11796b96 68 void (*struct_end)(struct stream_pos *pos,
e19c3d69 69 const struct type_struct *struct_type);
c054553d 70 void (*variant_begin)(struct stream_pos *pos,
e19c3d69 71 const struct type_variant *variant_type);
c054553d 72 void (*variant_end)(struct stream_pos *pos,
e19c3d69 73 const struct type_variant *variant_type);
d06d03db 74 void (*array_begin)(struct stream_pos *pos,
e19c3d69 75 const struct type_array *array_type);
d06d03db 76 void (*array_end)(struct stream_pos *pos,
e19c3d69 77 const struct type_array *array_type);
d06d03db 78 void (*sequence_begin)(struct stream_pos *pos,
e19c3d69 79 const struct type_sequence *sequence_type);
d06d03db 80 void (*sequence_end)(struct stream_pos *pos,
e19c3d69 81 const struct type_sequence *sequence_type);
fc93b2bd
MD
82};
83
84struct format *bt_lookup_format(GQuark qname);
4c8bfb7e 85int bt_register_format(struct format *format);
fc93b2bd
MD
86
87/* TBD: format unregistration */
88
89#endif /* _BABELTRACE_FORMAT_H */
This page took 0.027416 seconds and 4 git commands to generate.