Support getting the value of enums
authorXiaona Han <xiaonahappy13@163.com>
Fri, 26 Jul 2013 09:48:02 +0000 (17:48 +0800)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 12 Nov 2013 16:24:59 +0000 (11:24 -0500)
Use 'get_enum_str' to get the string matching the current enumeration.

Signed-off-by: Xiaona Han <xiaonahappy13@163.com>
Acked-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
bindings/python/babeltrace.i.in

index ee3e2bd0b8b44460bd109b7b07caee79adfbcc99..50cdd945e22c0c119db752193f54524c4a6debd8 100644 (file)
@@ -560,6 +560,8 @@ struct bt_ctf_event *bt_ctf_iter_read_event(struct bt_ctf_iter *iter);
 %rename("_bt_ctf_get_int_byte_order") bt_ctf_get_int_byte_order(
                const struct bt_declaration *field);
 %rename("_bt_ctf_get_int_len") bt_ctf_get_int_len(const struct bt_declaration *field);
+%rename("_bt_ctf_get_enum_int") bt_ctf_get_enum_int(const struct bt_definition *field);
+%rename("_bt_ctf_get_enum_str") bt_ctf_get_enum_str(const struct bt_definition *field);
 %rename("_bt_ctf_get_encoding") bt_ctf_get_encoding(const struct bt_declaration *field);
 %rename("_bt_ctf_get_array_len") bt_ctf_get_array_len(const struct bt_declaration *field);
 %rename("_bt_ctf_get_uint64") bt_ctf_get_uint64(const struct bt_definition *field);
@@ -591,6 +593,8 @@ int bt_ctf_get_int_signedness(const struct bt_declaration *field);
 int bt_ctf_get_int_base(const struct bt_declaration *field);
 int bt_ctf_get_int_byte_order(const struct bt_declaration *field);
 ssize_t bt_ctf_get_int_len(const struct bt_declaration *field);
+const struct bt_definition *bt_ctf_get_enum_int(const struct bt_definition *field);
+const char *bt_ctf_get_enum_str(const struct bt_definition *field);
 enum ctf_string_encoding bt_ctf_get_encoding(const struct bt_declaration *field);
 int bt_ctf_get_array_len(const struct bt_declaration *field);
 uint64_t bt_ctf_get_uint64(const struct bt_definition *field);
@@ -918,6 +922,13 @@ class ctf:
                        """
                        return _bt_ctf_get_int_len(_bt_ctf_get_decl_from_def(self._d))
 
+               def get_enum_str(self):
+                       """
+                       Return the string matching the current enumeration.
+                       Return None on error.
+                       """
+                       return _bt_ctf_get_enum_str(self._d)
+
                def get_encoding(self):
                        """
                        Return the encoding of an int or a string.
This page took 0.026902 seconds and 4 git commands to generate.