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

index 74fa30473939440acf5266ce8353dabe7925827a..31cd2524d77570cc182dd030752fe00a3ac7feb6 100644 (file)
@@ -1906,6 +1906,46 @@ enum ctf_type_id bt_ctf_field_type_get_type_id(
        return type->declaration->id;
 }
 
+int bt_ctf_field_type_is_integer(struct bt_ctf_field_type *type)
+{
+       return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_INTEGER;
+}
+
+int bt_ctf_field_type_is_floating_point(struct bt_ctf_field_type *type)
+{
+       return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_FLOAT;
+}
+
+int bt_ctf_field_type_is_enumeration(struct bt_ctf_field_type *type)
+{
+       return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_ENUM;
+}
+
+int bt_ctf_field_type_is_string(struct bt_ctf_field_type *type)
+{
+       return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_STRING;
+}
+
+int bt_ctf_field_type_is_structure(struct bt_ctf_field_type *type)
+{
+       return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_STRUCT;
+}
+
+int bt_ctf_field_type_is_array(struct bt_ctf_field_type *type)
+{
+       return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_ARRAY;
+}
+
+int bt_ctf_field_type_is_sequence(struct bt_ctf_field_type *type)
+{
+       return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_SEQUENCE;
+}
+
+int bt_ctf_field_type_is_variant(struct bt_ctf_field_type *type)
+{
+       return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_VARIANT;
+}
+
 void bt_ctf_field_type_get(struct bt_ctf_field_type *type)
 {
        bt_get(type);
index d777ce6b40603c23ff438ea28ec38e45fd561c2b..059a5b84b821a3a1a3faa5ec34475d2a5da137a1 100644 (file)
@@ -751,6 +751,86 @@ extern int bt_ctf_field_type_set_byte_order(struct bt_ctf_field_type *type,
 extern enum ctf_type_id bt_ctf_field_type_get_type_id(
                struct bt_ctf_field_type *type);
 
+/*
+ * bt_ctf_field_type_is_integer: returns whether or not a given field
+ *     type is an integer type.
+ *
+ * @param type Field type.
+ *
+ * Returns 1 if the field type is an integer type, 0 otherwise.
+ */
+extern int bt_ctf_field_type_is_integer(struct bt_ctf_field_type *type);
+
+/*
+ * bt_ctf_field_type_is_floating_point: returns whether or not a given field
+ *     type is a floating point number type.
+ *
+ * @param type Field type.
+ *
+ * Returns 1 if the field type is a floating point number type, 0 otherwise.
+ */
+extern int bt_ctf_field_type_is_floating_point(struct bt_ctf_field_type *type);
+
+/*
+ * bt_ctf_field_type_is_enumeration: returns whether or not a given field
+ *     type is an enumeration type.
+ *
+ * @param type Field type.
+ *
+ * Returns 1 if the field type is an enumeration type, 0 otherwise.
+ */
+extern int bt_ctf_field_type_is_enumeration(struct bt_ctf_field_type *type);
+
+/*
+ * bt_ctf_field_type_is_string: returns whether or not a given field
+ *     type is a string type.
+ *
+ * @param type Field type.
+ *
+ * Returns 1 if the field type is a string type, 0 otherwise.
+ */
+extern int bt_ctf_field_type_is_string(struct bt_ctf_field_type *type);
+
+/*
+ * bt_ctf_field_type_is_structure: returns whether or not a given field
+ *     type is a structure type.
+ *
+ * @param type Field type.
+ *
+ * Returns 1 if the field type is a structure type, 0 otherwise.
+ */
+extern int bt_ctf_field_type_is_structure(struct bt_ctf_field_type *type);
+
+/*
+ * bt_ctf_field_type_is_array: returns whether or not a given field
+ *     type is an array type.
+ *
+ * @param type Field type.
+ *
+ * Returns 1 if the field type is an array type, 0 otherwise.
+ */
+extern int bt_ctf_field_type_is_array(struct bt_ctf_field_type *type);
+
+/*
+ * bt_ctf_field_type_is_sequence: returns whether or not a given field
+ *     type is a sequence type.
+ *
+ * @param type Field type.
+ *
+ * Returns 1 if the field type is a sequence type, 0 otherwise.
+ */
+extern int bt_ctf_field_type_is_sequence(struct bt_ctf_field_type *type);
+
+/*
+ * bt_ctf_field_type_is_variant: returns whether or not a given field
+ *     type is a variant type.
+ *
+ * @param type Field type.
+ *
+ * Returns 1 if the field type is a variant type, 0 otherwise.
+ */
+extern int bt_ctf_field_type_is_variant(struct bt_ctf_field_type *type);
+
 /*
  * bt_ctf_field_type_get and bt_ctf_field_type_put: increment and decrement
  * the field type's reference count.
This page took 0.0272 seconds and 4 git commands to generate.