1 #ifndef _BABELTRACE_CTF_TEXT_TYPES_H
2 #define _BABELTRACE_CTF_TEXT_TYPES_H
5 * Common Trace Format (Text Output)
9 * Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
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:
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
27 #include <babeltrace/babeltrace-internal.h>
28 #include <babeltrace/types.h>
29 #include <babeltrace/format.h>
32 * Inherit from both struct stream_pos and struct trace_descriptor.
34 struct ctf_text_stream_pos
{
35 struct stream_pos parent
;
36 struct trace_descriptor trace_descriptor
;
37 FILE *fp
; /* File pointer. NULL if unset. */
39 int dummy
; /* disable output */
40 int print_names
; /* print field names */
42 uint64_t last_timestamp
; /* to print delta */
43 GString
*string
; /* Current string */
47 struct ctf_text_stream_pos
*ctf_text_pos(struct stream_pos
*pos
)
49 return container_of(pos
, struct ctf_text_stream_pos
, parent
);
53 * Write only is supported for now.
55 int ctf_text_integer_write(struct stream_pos
*pos
, struct definition
*definition
);
56 int ctf_text_float_write(struct stream_pos
*pos
, struct definition
*definition
);
57 int ctf_text_string_write(struct stream_pos
*pos
, struct definition
*definition
);
58 int ctf_text_enum_write(struct stream_pos
*pos
, struct definition
*definition
);
59 int ctf_text_struct_write(struct stream_pos
*pos
, struct definition
*definition
);
60 int ctf_text_variant_write(struct stream_pos
*pos
, struct definition
*definition
);
61 int ctf_text_array_write(struct stream_pos
*pos
, struct definition
*definition
);
62 int ctf_text_sequence_write(struct stream_pos
*pos
, struct definition
*definition
);
65 void print_pos_tabs(struct ctf_text_stream_pos
*pos
)
69 for (i
= 0; i
< pos
->depth
; i
++)
70 fprintf(pos
->fp
, "\t");
74 * Check if the field must be printed.
76 int print_field(struct definition
*definition
);
78 #endif /* _BABELTRACE_CTF_TEXT_TYPES_H */