lib: strictly type function return status enumerations
[babeltrace.git] / include / babeltrace2 / trace-ir / trace-const.h
index 98e7b526a3015fc1c29088477e75ca483d569296..a0ee825d6b791eee5254a69f1efa166169edf282 100644 (file)
  * http://www.efficios.com/ctf
  */
 
+#include <stdint.h>
+
 /*
  * For bt_bool, bt_uuid, bt_trace, bt_stream, bt_stream_class,
  * bt_field_class, bt_value
  */
 #include <babeltrace2/types.h>
 
-#include <stdint.h>
+/* For __BT_FUNC_STATUS_* */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-typedef enum bt_trace_status {
-       BT_TRACE_STATUS_OK = 0,
-       BT_TRACE_STATUS_NOMEM = -12,
-} bt_trace_status;
-
 typedef void (* bt_trace_destruction_listener_func)(
                const bt_trace *trace, void *data);
 
@@ -60,12 +60,22 @@ extern const bt_stream *bt_trace_borrow_stream_by_index_const(
 extern const bt_stream *bt_trace_borrow_stream_by_id_const(
                const bt_trace *trace, uint64_t id);
 
-extern bt_trace_status bt_trace_add_destruction_listener(
+typedef enum bt_trace_add_listener_status {
+       BT_TRACE_ADD_LISTENER_STATUS_MEMORY_ERROR       = __BT_FUNC_STATUS_MEMORY_ERROR,
+       BT_TRACE_ADD_LISTENER_STATUS_OK                 = __BT_FUNC_STATUS_OK,
+} bt_trace_add_listener_status;
+
+extern bt_trace_add_listener_status bt_trace_add_destruction_listener(
                const bt_trace *trace,
                bt_trace_destruction_listener_func listener,
                void *data, uint64_t *listener_id);
 
-extern bt_trace_status bt_trace_remove_destruction_listener(
+typedef enum bt_trace_remove_listener_status {
+       BT_TRACE_REMOVE_LISTENER_STATUS_MEMORY_ERROR    = __BT_FUNC_STATUS_MEMORY_ERROR,
+       BT_TRACE_REMOVE_LISTENER_STATUS_OK              = __BT_FUNC_STATUS_OK,
+} bt_trace_remove_listener_status;
+
+extern bt_trace_remove_listener_status bt_trace_remove_destruction_listener(
                const bt_trace *trace, uint64_t listener_id);
 
 extern void bt_trace_get_ref(const bt_trace *trace);
@@ -89,4 +99,6 @@ extern void bt_trace_put_ref(const bt_trace *trace);
 }
 #endif
 
+#include <babeltrace2/undef-func-status.h>
+
 #endif /* BABELTRACE_TRACE_IR_TRACE_CONST_H */
This page took 0.023632 seconds and 4 git commands to generate.