Add a generic get_value() implementation
[babeltrace.git] / bindings / python / python-complements.c
index a4ee37e23262f4c014527061a4016d0ea2d059f0..53b616b4ca42740010118f63101281f0e4b7517e 100644 (file)
@@ -44,16 +44,16 @@ void _bt_file_close(FILE *fp)
 */
 
 /* ctf-field-list */
-struct definition **_bt_python_field_listcaller(
+struct bt_definition **_bt_python_field_listcaller(
                const struct bt_ctf_event *ctf_event,
-               const struct definition *scope)
+               const struct bt_definition *scope)
 {
-       struct definition **list;
+       struct bt_definition **list;
        unsigned int count;
        int ret;
 
        ret = bt_ctf_get_field_list(ctf_event, scope,
-               (const struct definition * const **)&list, &count);
+               (const struct bt_definition * const **)&list, &count);
 
        if (ret < 0)    /* For python to know an error occured */
                list = NULL;
@@ -63,8 +63,8 @@ struct definition **_bt_python_field_listcaller(
        return list;
 }
 
-struct definition *_bt_python_field_one_from_list(
-               struct definition **list, int index)
+struct bt_definition *_bt_python_field_one_from_list(
+               struct bt_definition **list, int index)
 {
        return list[index];
 }
@@ -119,3 +119,21 @@ struct bt_ctf_field_decl *_bt_python_field_decl_one_from_list(
 {
        return list[index];
 }
+
+struct definition_array *_bt_python_get_array_from_def(
+               struct bt_definition *field)
+{
+       const struct bt_declaration *array_decl;
+       struct definition_array *array = NULL;
+
+       if (!field) {
+               goto end;
+       }
+
+       array_decl = bt_ctf_get_decl_from_def(field);
+       if (bt_ctf_field_type(array_decl) == CTF_TYPE_ARRAY) {
+               array = container_of(field, struct definition_array, p);
+       }
+end:
+       return array;
+}
This page took 0.031837 seconds and 4 git commands to generate.