Dynamic scope: child position is MAX_INT
[babeltrace.git] / include / babeltrace / types.h
index ed2aae87f054727342629f30121d8c08fd44af5d..21dd66f246f0c9d71845858320bb359d7313ae60 100644 (file)
@@ -105,6 +105,15 @@ struct definition_scope {
        /* Hash table mapping field name GQuark to "struct definition" */
        GHashTable *definitions;
        struct definition_scope *parent_scope;
+       /*
+        * Complete "path" leading to this definition scope.
+        * Includes dynamic scope name '.' field name '.' field name '.' ....
+        * Array of GQuark elements (which are each separated by dots).
+        * The dynamic scope name can contain dots, and is encoded into
+        * a single GQuark. Thus, scope_path[0] returns the GQuark
+        * identifying the dynamic scope.
+        */
+       GArray *scope_path;     /* array of GQuark */
 };
 
 enum ctf_type_id {
@@ -131,7 +140,8 @@ struct declaration {
        void (*declaration_free)(struct declaration *declaration);
        struct definition *
                (*definition_new)(struct declaration *declaration,
-                                 struct definition_scope *parent_scope);
+                                 struct definition_scope *parent_scope,
+                                 GQuark field_name, int index);
        /*
         * definition_free called with definition ref is decremented to 0.
         */
@@ -147,6 +157,7 @@ struct declaration {
 
 struct definition {
        struct declaration *declaration;
+       int index;              /* Position of the definition in its container */
        int ref;                /* number of references to the definition */
 };
 
@@ -360,13 +371,18 @@ void free_declaration_scope(struct declaration_scope *scope);
  * definition scopes.
  */
 struct definition *
-       lookup_field_definition(GQuark field_name,
-                               struct definition_scope *scope);
+       lookup_definition(GArray *cur_path,     /* array of GQuark */
+                         GArray *lookup_path,  /* array of GQuark */
+                         struct definition_scope *scope);
 int register_field_definition(GQuark field_name,
                              struct definition *definition,
                              struct definition_scope *scope);
 struct definition_scope *
-       new_definition_scope(struct definition_scope *parent_scope);
+       new_definition_scope(struct definition_scope *parent_scope,
+                            GQuark field_name);
+void set_dynamic_definition_scope(struct definition *definition,
+                                 struct definition_scope *scope,
+                                 GQuark root_name);
 void free_definition_scope(struct definition_scope *scope);
 
 void declaration_ref(struct declaration *declaration);
This page took 0.025108 seconds and 4 git commands to generate.