cpp-common/bt2: make setters return `*this`
[babeltrace.git] / src / cpp-common / bt2 / graph.hpp
index 787888af2e4c930e30dcd332bbd4ff675036f01e..63199bf737de3897f1c0393cef84246beef7ecdf 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:
This page took 0.024022 seconds and 4 git commands to generate.