lib: strictly type function return status enumerations
[babeltrace.git] / src / bindings / python / bt2 / bt2 / native_bt.i
index bf20edc71b0ef107a2d4a72961a691496177e943..f9fb451218a53166fe91d97a8ef5361b909f78af 100644 (file)
 %module native_bt
 
 %{
-#define BT_LOG_TAG "PY-NATIVE"
+#define BT_LOG_TAG "BT2-PY"
 #include "logging.h"
 
 #include <babeltrace2/babeltrace.h>
-#include <babeltrace2/property.h>
+
+/*
+ * This is not part of the API, but because those bindings reside within
+ * the project, we take the liberty to use them.
+ */
+#define __BT_FUNC_STATUS_ENABLE
+#include <babeltrace2/func-status.h>
+#undef __BT_FUNC_STATUS_ENABLE
+
 #include "common/assert.h"
+#include "py-common/py-common.h"
 
 typedef const uint8_t *bt_uuid;
 %}
@@ -61,11 +70,11 @@ typedef int bt_bool;
  * functions on which we apply this typemap don't guarantee that the value of
  * `temp_value` will be unchanged or valid.
  */
-%typemap(in, numinputs=0) (const char **OUT) (char *temp_value = (void *) 1) {
+%typemap(in, numinputs=0) (const char **) (char *temp_value = (void *) 1) {
        $1 = &temp_value;
 }
 
-%typemap(argout) (const char **OUT) {
+%typemap(argout) (const char **) {
        if (*$1) {
                /* SWIG_Python_AppendOutput() steals the created object */
                $result = SWIG_Python_AppendOutput($result, SWIG_Python_str_FromChar(*$1));
@@ -77,11 +86,11 @@ typedef int bt_bool;
 }
 
 /* Output argument typemap for value output (always appends) */
-%typemap(in, numinputs=0) (bt_value **OUT) (struct bt_value *temp_value = NULL) {
+%typemap(in, numinputs=0) (bt_value **) (struct bt_value *temp_value = NULL) {
        $1 = &temp_value;
 }
 
-%typemap(argout) (bt_value **OUT) {
+%typemap(argout) (bt_value **) {
        if (*$1) {
                /* SWIG_Python_AppendOutput() steals the created object */
                $result = SWIG_Python_AppendOutput($result,
@@ -95,41 +104,33 @@ typedef int bt_bool;
 }
 
 /* Output argument typemap for initialized uint64_t output parameter (always appends) */
-%typemap(in, numinputs=0) (uint64_t *OUT) (uint64_t temp) {
+%typemap(in, numinputs=0) (uint64_t *) (uint64_t temp) {
        $1 = &temp;
 }
 
-%typemap(argout) uint64_t *OUT {
+%typemap(argout) uint64_t * {
        $result = SWIG_Python_AppendOutput(resultobj,
                        SWIG_From_unsigned_SS_long_SS_long((*$1)));
 }
 
 /* Output argument typemap for initialized int64_t output parameter (always appends) */
-%typemap(in, numinputs=0) (int64_t *OUT) (int64_t temp) {
+%typemap(in, numinputs=0) (int64_t *) (int64_t temp) {
        $1 = &temp;
 }
 
-%typemap(argout) (int64_t *OUT) {
+%typemap(argout) (int64_t *) {
        $result = SWIG_Python_AppendOutput(resultobj, SWIG_From_long_SS_long((*$1)));
 }
 
 /* Output argument typemap for initialized unsigned int output parameter (always appends) */
-%typemap(in, numinputs=0) (unsigned int *OUT) (unsigned int temp) {
+%typemap(in, numinputs=0) (unsigned int *) (unsigned int temp) {
        $1 = &temp;
 }
 
-%typemap(argout) (unsigned int *OUT) {
+%typemap(argout) (unsigned int *) {
        $result = SWIG_Python_AppendOutput(resultobj,
                        SWIG_From_unsigned_SS_long_SS_long((uint64_t) (*$1)));
 }
-/* Output argument typemap for initialized double output parameter (always appends) */
-%typemap(in, numinputs=0) (double *OUT) (double temp) {
-       $1 = &temp;
-}
-
-%typemap(argout) (double *OUT) {
-       $result = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*$1)));
-}
 
 /* Input argument typemap for UUID bytes */
 %typemap(in) bt_uuid {
@@ -179,12 +180,12 @@ typedef int bt_bool;
        $result = $1;
 }
 
-/* From property.h */
+/* Property enumeration */
+%include <babeltrace2/property.h>
 
-typedef enum bt_property_availability {
-       BT_PROPERTY_AVAILABILITY_AVAILABLE,
-       BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE,
-} bt_property_availability;
+/* Common function status codes */
+#define __BT_FUNC_STATUS_ENABLE
+%include <babeltrace2/func-status.h>
 
 /* Per-module interface files */
 %include "native_bt_clock_class.i"
@@ -200,7 +201,7 @@ typedef enum bt_property_availability {
 %include "native_bt_graph.i"
 %include "native_bt_logging.i"
 %include "native_bt_message.i"
-%include "native_bt_notifier.i"
+%include "native_bt_message_iterator.i"
 %include "native_bt_packet.i"
 %include "native_bt_plugin.i"
 %include "native_bt_port.i"
This page took 0.024921 seconds and 4 git commands to generate.