X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=include%2Fbabeltrace%2Fctf-ir%2Fvisitor-internal.h;h=3f8d80929d72aa81eaa170610225f383e8068318;hp=8243dfec4fbd9d49e33c462105d2b051924e9089;hb=c800eb3790218d2f33df01e77ec38cbd43cc02a1;hpb=d146339dfd3a1861da0959f40cd622373c966007 diff --git a/include/babeltrace/ctf-ir/visitor-internal.h b/include/babeltrace/ctf-ir/visitor-internal.h index 8243dfec..3f8d8092 100644 --- a/include/babeltrace/ctf-ir/visitor-internal.h +++ b/include/babeltrace/ctf-ir/visitor-internal.h @@ -4,7 +4,7 @@ /* * BabelTrace - CTF IR: Visitor internal * - * Copyright 2015 Jérémie Galarneau + * Copyright 2016 Jérémie Galarneau * * Author: Jérémie Galarneau * @@ -27,61 +27,25 @@ * SOFTWARE. */ -#include -#include +#include #include -#include -struct ctf_type_stack_frame { - struct bt_ctf_field_type *type; - int index; -}; - -typedef GPtrArray ctf_type_stack; +typedef void *(*bt_child_accessor)(void *object, int index); +typedef int64_t (*bt_child_count_accessor)(void *object); +typedef int (*bt_child_visitor)(void *object, bt_visitor visitor, + void *data); -struct ctf_type_visitor_context { - struct bt_ctf_trace *trace; - struct bt_ctf_stream_class *stream_class; - struct bt_ctf_event_class *event_class; - /* Root node being visited */ - enum bt_ctf_node root_node; - ctf_type_stack *stack; +struct bt_visitor_object { + enum bt_visitor_object_type type; + void *object; }; -typedef int (*ctf_type_visitor_func)(struct bt_ctf_field_type *, - struct ctf_type_visitor_context *); - -BT_HIDDEN -ctf_type_stack *ctf_type_stack_create(void); - -BT_HIDDEN -void ctf_type_stack_destroy(ctf_type_stack *stack); - -BT_HIDDEN -int ctf_type_stack_push(ctf_type_stack *stack, - struct ctf_type_stack_frame *entry); - -BT_HIDDEN -struct ctf_type_stack_frame *ctf_type_stack_peek( - ctf_type_stack *stack); - -BT_HIDDEN -struct ctf_type_stack_frame *ctf_type_stack_pop(ctf_type_stack *stack); - -BT_HIDDEN -int bt_ctf_trace_visit(struct bt_ctf_trace *trace, - ctf_type_visitor_func func); - -BT_HIDDEN -int bt_ctf_trace_resolve_types(struct bt_ctf_trace *trace); - -BT_HIDDEN -int bt_ctf_stream_class_resolve_types(struct bt_ctf_stream_class *stream_class, - struct bt_ctf_trace *trace); - BT_HIDDEN -int bt_ctf_event_class_resolve_types(struct bt_ctf_event_class *event_class, - struct bt_ctf_trace *trace, - struct bt_ctf_stream_class *stream_class); +int visitor_helper(struct bt_visitor_object *root, + bt_child_count_accessor child_counter, + bt_child_accessor child_accessor, + bt_child_visitor child_visitor, + bt_visitor visitor, + void *data); #endif /* BABELTRACE_CTF_IR_VISITOR_INTERNAL_H */