assert-pre-internal.h: add BT_ASSERT_PRE_VALID_INDEX()
[babeltrace.git] / include / babeltrace / ctf-ir / visitor-internal.h
index 8243dfec4fbd9d49e33c462105d2b051924e9089..3f8d80929d72aa81eaa170610225f383e8068318 100644 (file)
@@ -4,7 +4,7 @@
 /*
  * BabelTrace - CTF IR: Visitor internal
  *
- * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
  *
  * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
  *
  * SOFTWARE.
  */
 
-#include <babeltrace/ctf-ir/event-types.h>
-#include <babeltrace/ctf-ir/event-types-internal.h>
+#include <babeltrace/ctf-ir/visitor.h>
 #include <babeltrace/babeltrace-internal.h>
-#include <glib.h>
 
-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 */
This page took 0.024136 seconds and 4 git commands to generate.