cpp-common/bt2: don't use wrap in bindings code
[babeltrace.git] / src / cpp-common / bt2 / graph.hpp
index 787888af2e4c930e30dcd332bbd4ff675036f01e..c1c6ad09ca932c7fa4e02f23492aa1b14e4f2d4d 100644 (file)
@@ -117,7 +117,7 @@ public:
             bt_graph_add_sink_component_with_initialize_method_data);
     }
 
-    void connectPorts(const ConstOutputPort outputPort, const ConstInputPort inputPort) const
+    Graph connectPorts(const ConstOutputPort outputPort, const ConstInputPort inputPort) const
     {
         const auto status = bt_graph_connect_ports(this->libObjPtr(), outputPort.libObjPtr(),
                                                    inputPort.libObjPtr(), nullptr);
@@ -127,9 +127,11 @@ public:
         } else if (status == BT_GRAPH_CONNECT_PORTS_STATUS_MEMORY_ERROR) {
             throw MemoryError {};
         }
+
+        return *this;
     }
 
-    void runOnce() const
+    Graph runOnce() const
     {
         const auto status = bt_graph_run_once(this->libObjPtr());
 
@@ -140,9 +142,11 @@ public:
         } else if (status == BT_GRAPH_RUN_ONCE_STATUS_AGAIN) {
             throw TryAgain {};
         }
+
+        return *this;
     }
 
-    void run() const
+    Graph run() const
     {
         const auto status = bt_graph_run(this->libObjPtr());
 
@@ -153,6 +157,8 @@ public:
         } else if (status == BT_GRAPH_RUN_STATUS_AGAIN) {
             throw TryAgain {};
         }
+
+        return *this;
     }
 
 private:
@@ -176,7 +182,7 @@ private:
             throw MemoryError {};
         }
 
-        return wrap(libObjPtr);
+        return ConstComponentT {libObjPtr};
     }
 };
 
This page took 0.028274 seconds and 4 git commands to generate.