Use dynamic shared libraries, list formats
[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 23#include <stdint.h>
7fb21036 24#include <stdio.h>
fc93b2bd
MD
25#include <glib.h>
26
27struct format {
28 GQuark name;
29
bed864a7 30 uint64_t (*uint_read)(struct stream_pos *pos,
f6625916 31 const struct declaration_integer *integer_declaration);
bed864a7 32 int64_t (*int_read)(struct stream_pos *pos,
f6625916 33 const struct declaration_integer *integer_declaration);
bed864a7 34 void (*uint_write)(struct stream_pos *pos,
f6625916
MD
35 const struct declaration_integer *integer_declaration,
36 uint64_t v);
bed864a7 37 void (*int_write)(struct stream_pos *pos,
f6625916
MD
38 const struct declaration_integer *integer_declaration,
39 int64_t v);
fc93b2bd 40
4c8bfb7e 41 void (*float_copy)(struct stream_pos *destp,
f6625916
MD
42 struct stream_pos *srcp,
43 const struct declaration_float *float_declaration);
bed864a7 44 double (*double_read)(struct stream_pos *pos,
f6625916 45 const struct declaration_float *float_declaration);
bed864a7 46 void (*double_write)(struct stream_pos *pos,
f6625916
MD
47 const struct declaration_float *float_declaration,
48 double v);
fc93b2bd 49
bed864a7 50 void (*string_copy)(struct stream_pos *dest, struct stream_pos *src,
f6625916 51 const struct declaration_string *string_declaration);
47e0f2e2 52 void (*string_read)(char **dest, struct stream_pos *src,
f6625916 53 const struct declaration_string *string_declaration);
47e0f2e2 54 void (*string_write)(struct stream_pos *dest, const char *src,
f6625916 55 const struct declaration_string *string_declaration);
47e0f2e2 56 void (*string_free_temp)(char *string);
fc93b2bd 57
47e0f2e2
MD
58 /*
59 * enum_read returns a GArray of GQuark. Must be released with
60 * g_array_unref().
61 */
62 GArray *(*enum_read)(struct stream_pos *pos,
f6625916 63 const struct declaration_enum *src);
bed864a7 64 void (*enum_write)(struct stream_pos *pos,
f6625916
MD
65 const struct declaration_enum *dest,
66 GQuark q);
11796b96 67 void (*struct_begin)(struct stream_pos *pos,
f6625916 68 const struct declaration_struct *struct_declaration);
11796b96 69 void (*struct_end)(struct stream_pos *pos,
f6625916 70 const struct declaration_struct *struct_declaration);
c054553d 71 void (*variant_begin)(struct stream_pos *pos,
f6625916 72 const struct declaration_variant *variant_declaration);
c054553d 73 void (*variant_end)(struct stream_pos *pos,
f6625916 74 const struct declaration_variant *variant_declaration);
d06d03db 75 void (*array_begin)(struct stream_pos *pos,
f6625916 76 const struct declaration_array *array_declaration);
d06d03db 77 void (*array_end)(struct stream_pos *pos,
f6625916 78 const struct declaration_array *array_declaration);
d06d03db 79 void (*sequence_begin)(struct stream_pos *pos,
f6625916 80 const struct declaration_sequence *sequence_declaration);
d06d03db 81 void (*sequence_end)(struct stream_pos *pos,
f6625916 82 const struct declaration_sequence *sequence_declaration);
fc93b2bd
MD
83};
84
85struct format *bt_lookup_format(GQuark qname);
7fb21036 86void bt_fprintf_format_list(FILE *fp);
4c8bfb7e 87int bt_register_format(struct format *format);
fc93b2bd
MD
88
89/* TBD: format unregistration */
90
91#endif /* _BABELTRACE_FORMAT_H */
This page took 0.028172 seconds and 4 git commands to generate.