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.
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35 #include <babeltrace/babeltrace-internal.h>
36 #include <babeltrace/types.h>
37 #include <babeltrace/format.h>
40 * Inherit from both struct bt_stream_pos and struct bt_trace_descriptor.
42 struct ctf_text_stream_pos
{
43 struct bt_stream_pos parent
;
44 struct bt_trace_descriptor trace_descriptor
;
45 FILE *fp
; /* File pointer. NULL if unset. */
47 int dummy
; /* disable output */
48 int print_names
; /* print field names */
50 uint64_t last_real_timestamp
; /* to print delta */
51 uint64_t last_cycles_timestamp
; /* to print delta */
52 GString
*string
; /* Current string */
56 struct ctf_text_stream_pos
*ctf_text_pos(struct bt_stream_pos
*pos
)
58 return container_of(pos
, struct ctf_text_stream_pos
, parent
);
62 * Write only is supported for now.
65 int ctf_text_integer_write(struct bt_stream_pos
*pos
, struct definition
*definition
);
67 int ctf_text_float_write(struct bt_stream_pos
*pos
, struct definition
*definition
);
69 int ctf_text_string_write(struct bt_stream_pos
*pos
, struct definition
*definition
);
71 int ctf_text_enum_write(struct bt_stream_pos
*pos
, struct definition
*definition
);
73 int ctf_text_struct_write(struct bt_stream_pos
*pos
, struct definition
*definition
);
75 int ctf_text_variant_write(struct bt_stream_pos
*pos
, struct definition
*definition
);
77 int ctf_text_array_write(struct bt_stream_pos
*pos
, struct definition
*definition
);
79 int ctf_text_sequence_write(struct bt_stream_pos
*pos
, struct definition
*definition
);
82 void print_pos_tabs(struct ctf_text_stream_pos
*pos
)
86 for (i
= 0; i
< pos
->depth
; i
++)
87 fprintf(pos
->fp
, "\t");
91 * Check if the field must be printed.
94 int print_field(struct definition
*definition
);
96 #endif /* _BABELTRACE_CTF_TEXT_TYPES_H */