ir: add field instance type ID helpers
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 27 Jul 2015 13:02:25 +0000 (09:02 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 30 Jul 2015 13:47:23 +0000 (09:47 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
formats/ctf/ir/event-fields.c
include/babeltrace/ctf-ir/event-fields.h

index 4538d8e03317b26dd8008234384299727989841a..829a44758c4a2d55224879d4f946dd88afdd78e8 100644 (file)
@@ -295,6 +295,46 @@ end:
        return ret;
 }
 
+int bt_ctf_field_is_integer(struct bt_ctf_field *field)
+{
+       return bt_ctf_field_get_type_id(field) == CTF_TYPE_INTEGER;
+}
+
+int bt_ctf_field_is_floating_point(struct bt_ctf_field *field)
+{
+       return bt_ctf_field_get_type_id(field) == CTF_TYPE_FLOAT;
+}
+
+int bt_ctf_field_is_enumeration(struct bt_ctf_field *field)
+{
+       return bt_ctf_field_get_type_id(field) == CTF_TYPE_ENUM;
+}
+
+int bt_ctf_field_is_string(struct bt_ctf_field *field)
+{
+       return bt_ctf_field_get_type_id(field) == CTF_TYPE_STRING;
+}
+
+int bt_ctf_field_is_structure(struct bt_ctf_field *field)
+{
+       return bt_ctf_field_get_type_id(field) == CTF_TYPE_STRUCT;
+}
+
+int bt_ctf_field_is_array(struct bt_ctf_field *field)
+{
+       return bt_ctf_field_get_type_id(field) == CTF_TYPE_ARRAY;
+}
+
+int bt_ctf_field_is_sequence(struct bt_ctf_field *field)
+{
+       return bt_ctf_field_get_type_id(field) == CTF_TYPE_SEQUENCE;
+}
+
+int bt_ctf_field_is_variant(struct bt_ctf_field *field)
+{
+       return bt_ctf_field_get_type_id(field) == CTF_TYPE_VARIANT;
+}
+
 struct bt_ctf_field *bt_ctf_field_sequence_get_length(
                struct bt_ctf_field *field)
 {
index a1e1351aae2dc648b510503d20133117917fff7e..898fee981e353c730b8883fa0303552b6ca9288f 100644 (file)
@@ -366,6 +366,86 @@ extern struct bt_ctf_field_type *bt_ctf_field_get_type(
  */
 extern enum ctf_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field);
 
+/*
+ * bt_ctf_field_is_integer: returns whether or not a given field
+ *     is an integer type.
+ *
+ * @param field Field instance.
+ *
+ * Returns 1 if the field instance is an integer type, 0 otherwise.
+ */
+extern int bt_ctf_field_is_integer(struct bt_ctf_field *field);
+
+/*
+ * bt_ctf_field_is_floating_point: returns whether or not a given field
+ *     is a floating point number type.
+ *
+ * @param field Field instance.
+ *
+ * Returns 1 if the field instance is a floating point number type, 0 otherwise.
+ */
+extern int bt_ctf_field_is_floating_point(struct bt_ctf_field *field);
+
+/*
+ * bt_ctf_field_is_enumeration: returns whether or not a given field
+ *     is an enumeration type.
+ *
+ * @param field Field instance.
+ *
+ * Returns 1 if the field instance is an enumeration type, 0 otherwise.
+ */
+extern int bt_ctf_field_is_enumeration(struct bt_ctf_field *field);
+
+/*
+ * bt_ctf_field_is_string: returns whether or not a given field
+ *     is a string type.
+ *
+ * @param field Field instance.
+ *
+ * Returns 1 if the field instance is a string type, 0 otherwise.
+ */
+extern int bt_ctf_field_is_string(struct bt_ctf_field *field);
+
+/*
+ * bt_ctf_field_is_structure: returns whether or not a given field
+ *     is a structure type.
+ *
+ * @param field Field instance.
+ *
+ * Returns 1 if the field instance is a structure type, 0 otherwise.
+ */
+extern int bt_ctf_field_is_structure(struct bt_ctf_field *field);
+
+/*
+ * bt_ctf_field_is_array: returns whether or not a given field
+ *     is an array type.
+ *
+ * @param field Field instance.
+ *
+ * Returns 1 if the field instance is an array type, 0 otherwise.
+ */
+extern int bt_ctf_field_is_array(struct bt_ctf_field *field);
+
+/*
+ * bt_ctf_field_is_sequence: returns whether or not a given field
+ *     is a sequence type.
+ *
+ * @param field Field instance.
+ *
+ * Returns 1 if the field instance is a sequence type, 0 otherwise.
+ */
+extern int bt_ctf_field_is_sequence(struct bt_ctf_field *field);
+
+/*
+ * bt_ctf_field_is_variant: returns whether or not a given field
+ *     is a variant type.
+ *
+ * @param field Field instance.
+ *
+ * Returns 1 if the field instance is a variant type, 0 otherwise.
+ */
+extern int bt_ctf_field_is_variant(struct bt_ctf_field *field);
+
 /*
  * bt_ctf_field_copy: get a field's deep copy.
  *
This page took 0.026937 seconds and 4 git commands to generate.