lib: add bt_field_class_variant_borrow_option_by_{index,name}()
[babeltrace.git] / include / babeltrace2 / trace-ir / field-class.h
index 8da8acde7a2435e0c9267a1de514624190bf6734..083facbe7b3d6fa79313bb2e6b4d428a6ce224a4 100644 (file)
@@ -1,9 +1,8 @@
-#ifndef BABELTRACE_TRACE_IR_FIELD_CLASSES_H
-#define BABELTRACE_TRACE_IR_FIELD_CLASSES_H
+#ifndef BABELTRACE2_TRACE_IR_FIELD_CLASS_H
+#define BABELTRACE2_TRACE_IR_FIELD_CLASS_H
 
 /*
- * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
- *
- * The Common Trace Format (CTF) Specification is available at
- * http://www.efficios.com/ctf
  */
 
-/* For bt_bool, bt_field_class, bt_trace_class */
-#include <babeltrace2/types.h>
-
-/*
- * For bt_field_class_status,
- * bt_field_class_integer_preferred_display_base
- */
-#include <babeltrace2/trace-ir/field-class-const.h>
+#ifndef __BT_IN_BABELTRACE_H
+# error "Please include <babeltrace2/babeltrace.h> instead."
+#endif
 
 #include <stdint.h>
 #include <stddef.h>
 
+#include <babeltrace2/types.h>
+#include <babeltrace2/trace-ir/field-class-const.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-extern bt_field_class *bt_field_class_unsigned_integer_create(
+extern bt_field_class *bt_field_class_bool_create(
+               bt_trace_class *trace_class);
+
+extern bt_field_class *bt_field_class_bit_array_create(
+               bt_trace_class *trace_class, uint64_t length);
+
+extern bt_field_class *bt_field_class_integer_unsigned_create(
                bt_trace_class *trace_class);
 
-extern bt_field_class *bt_field_class_signed_integer_create(
+extern bt_field_class *bt_field_class_integer_signed_create(
                bt_trace_class *trace_class);
 
 extern void bt_field_class_integer_set_field_value_range(
@@ -62,19 +62,26 @@ extern void bt_field_class_real_set_is_single_precision(
                bt_field_class *field_class,
                bt_bool is_single_precision);
 
-extern bt_field_class *bt_field_class_unsigned_enumeration_create(
+extern bt_field_class *bt_field_class_enumeration_unsigned_create(
                bt_trace_class *trace_class);
 
-extern bt_field_class *bt_field_class_signed_enumeration_create(
+extern bt_field_class *bt_field_class_enumeration_signed_create(
                bt_trace_class *trace_class);
 
-extern bt_field_class_status bt_field_class_unsigned_enumeration_map_range(
+typedef enum bt_field_class_enumeration_add_mapping_status {
+       BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_MEMORY_ERROR      = __BT_FUNC_STATUS_MEMORY_ERROR,
+       BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_OK                = __BT_FUNC_STATUS_OK,
+} bt_field_class_enumeration_add_mapping_status;
+
+extern bt_field_class_enumeration_add_mapping_status
+bt_field_class_enumeration_unsigned_add_mapping(
                bt_field_class *field_class, const char *label,
-               uint64_t range_lower, uint64_t range_upper);
+               const bt_integer_range_set_unsigned *range_set);
 
-extern bt_field_class_status bt_field_class_signed_enumeration_map_range(
+extern bt_field_class_enumeration_add_mapping_status
+bt_field_class_enumeration_signed_add_mapping(
                bt_field_class *field_class, const char *label,
-               int64_t range_lower, int64_t range_upper);
+               const bt_integer_range_set_signed *range_set);
 
 extern bt_field_class *bt_field_class_string_create(
                bt_trace_class *trace_class);
@@ -82,7 +89,13 @@ extern bt_field_class *bt_field_class_string_create(
 extern bt_field_class *bt_field_class_structure_create(
                bt_trace_class *trace_class);
 
-extern bt_field_class_status bt_field_class_structure_append_member(
+typedef enum bt_field_class_structure_append_member_status {
+       BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_MEMORY_ERROR      = __BT_FUNC_STATUS_MEMORY_ERROR,
+       BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_OK                = __BT_FUNC_STATUS_OK,
+} bt_field_class_structure_append_member_status;
+
+extern bt_field_class_structure_append_member_status
+bt_field_class_structure_append_member(
                bt_field_class *struct_field_class,
                const char *name, bt_field_class *field_class);
 
@@ -94,32 +107,53 @@ extern bt_field_class_structure_member *
 bt_field_class_structure_borrow_member_by_name(
                bt_field_class *field_class, const char *name);
 
-extern bt_field_class *bt_field_class_static_array_create(
+extern bt_field_class *bt_field_class_array_static_create(
                bt_trace_class *trace_class,
                bt_field_class *elem_field_class, uint64_t length);
 
-extern bt_field_class *bt_field_class_dynamic_array_create(
+extern bt_field_class *bt_field_class_array_dynamic_create(
                bt_trace_class *trace_class,
-               bt_field_class *elem_field_class);
+               bt_field_class *elem_field_class,
+               bt_field_class *length_field_class);
 
 extern bt_field_class *bt_field_class_array_borrow_element_field_class(
                bt_field_class *field_class);
 
-extern bt_field_class_status
-bt_field_class_dynamic_array_set_length_field_class(
-               bt_field_class *field_class,
-               bt_field_class *length_field_class);
+extern bt_field_class *bt_field_class_option_create(
+               bt_trace_class *trace_class,
+               bt_field_class *content_field_class,
+               bt_field_class *selector_field_class);
 
 extern bt_field_class *bt_field_class_variant_create(
-               bt_trace_class *trace_class);
-
-extern bt_field_class_status
-bt_field_class_variant_set_selector_field_class(bt_field_class *field_class,
+               bt_trace_class *trace_class,
                bt_field_class *selector_field_class);
 
-extern bt_field_class_status bt_field_class_variant_append_option(
-               bt_field_class *var_field_class,
-               const char *name, bt_field_class *field_class);
+typedef enum bt_field_class_variant_without_selector_append_option_status {
+       BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_APPEND_OPTION_STATUS_MEMORY_ERROR       = __BT_FUNC_STATUS_MEMORY_ERROR,
+       BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_APPEND_OPTION_STATUS_OK                 = __BT_FUNC_STATUS_OK,
+} bt_field_class_variant_without_selector_append_option_status;
+
+extern bt_field_class_variant_without_selector_append_option_status
+bt_field_class_variant_without_selector_append_option(
+               bt_field_class *var_field_class, const char *name,
+               bt_field_class *field_class);
+
+typedef enum bt_field_class_variant_with_selector_append_option_status {
+       BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_APPEND_OPTION_STATUS_MEMORY_ERROR  = __BT_FUNC_STATUS_MEMORY_ERROR,
+       BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_APPEND_OPTION_STATUS_OK            = __BT_FUNC_STATUS_OK,
+} bt_field_class_variant_with_selector_append_option_status;
+
+extern bt_field_class_variant_with_selector_append_option_status
+bt_field_class_variant_with_selector_unsigned_append_option(
+               bt_field_class *var_field_class, const char *name,
+               bt_field_class *field_class,
+               const bt_integer_range_set_unsigned *range_set);
+
+extern bt_field_class_variant_with_selector_append_option_status
+bt_field_class_variant_with_selector_signed_append_option(
+               bt_field_class *var_field_class, const char *name,
+               bt_field_class *field_class,
+               const bt_integer_range_set_signed *range_set);
 
 extern bt_field_class_variant_option *
 bt_field_class_variant_borrow_option_by_index(
@@ -129,11 +163,8 @@ extern bt_field_class_variant_option *
 bt_field_class_variant_borrow_option_by_name(
                bt_field_class *field_class, const char *name);
 
-extern bt_field_class *bt_field_class_variant_option_borrow_field_class(
-               bt_field_class_variant_option *option);
-
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* BABELTRACE_TRACE_IR_FIELD_CLASSES_H */
+#endif /* BABELTRACE2_TRACE_IR_FIELD_CLASS_H */
This page took 0.027663 seconds and 4 git commands to generate.