Fix: headers: make static inline upcasts compatible with C++
[babeltrace.git] / include / babeltrace / graph / self-component-port-input.h
index d25e114479890fd8077e9a04ec12c40b60a2c486..150499a2e14a3959efe59fdd0cc2040edbdcb5a0 100644 (file)
@@ -2,7 +2,7 @@
 #define BABELTRACE_GRAPH_SELF_COMPONENT_PORT_INPUT_H
 
 /*
- * Copyright 2017 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
  * SOFTWARE.
  */
 
-/* For enum bt_self_component_port_status */
-#include <babeltrace/graph/self-component-port.h>
+/*
+ * For bt_port_input, bt_self_component_port,
+ * bt_self_component_port_input, __BT_UPCAST, __BT_UPCAST_CONST
+ */
+#include <babeltrace/types.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-struct bt_port_input;
-struct bt_self_component_port;
-struct bt_self_component_port_input;
-
 static inline
-struct bt_self_component_port *
+bt_self_component_port *
 bt_self_component_port_input_as_self_component_port(
-               struct bt_self_component_port_input *self_component_port)
+               bt_self_component_port_input *self_component_port)
 {
-       return (void *) self_component_port;
+       return __BT_UPCAST(bt_self_component_port, self_component_port);
 }
 
 static inline
-struct bt_port_input *bt_self_component_port_input_as_port_input(
-               struct bt_self_component_port_input *self_component_port)
+const bt_port_input *bt_self_component_port_input_as_port_input(
+               const bt_self_component_port_input *self_component_port)
 {
-       return (void *) self_component_port;
+       return __BT_UPCAST_CONST(bt_port_input, self_component_port);
 }
 
 #ifdef __cplusplus
This page took 0.024548 seconds and 4 git commands to generate.