Normalize C/C++ include guards
[babeltrace.git] / src / cpp-common / bt2 / graph.hpp
index 787888af2e4c930e30dcd332bbd4ff675036f01e..e2bcf77ce5ced33692f25c807b3f5f60c619b808 100644 (file)
@@ -57,7 +57,7 @@ public:
     ConstSourceComponent addComponent(const ConstSourceComponentClass componentClass,
                                       const bt2c::CStringView name,
                                       const OptionalBorrowedObject<ConstMapValue> params = {},
-                                      const LoggingLevel loggingLevel = LoggingLevel::NONE) const
+                                      const LoggingLevel loggingLevel = LoggingLevel::None) const
     {
         return this->_addComponent<ConstSourceComponent>(
             componentClass, name, params, static_cast<void *>(nullptr), loggingLevel,
@@ -66,9 +66,9 @@ public:
 
     template <typename InitDataT>
     ConstSourceComponent addComponent(const ConstSourceComponentClass componentClass,
-                                      const bt2c::CStringView name, InitDataT& initData,
+                                      const bt2c::CStringView name, InitDataT&& initData,
                                       const OptionalBorrowedObject<ConstMapValue> params = {},
-                                      const LoggingLevel loggingLevel = LoggingLevel::NONE) const
+                                      const LoggingLevel loggingLevel = LoggingLevel::None) const
     {
         return this->_addComponent<ConstSourceComponent>(
             componentClass, name, params, &initData, loggingLevel,
@@ -78,7 +78,7 @@ public:
     ConstFilterComponent addComponent(const ConstFilterComponentClass componentClass,
                                       const bt2c::CStringView name,
                                       const OptionalBorrowedObject<ConstMapValue> params = {},
-                                      const LoggingLevel loggingLevel = LoggingLevel::NONE) const
+                                      const LoggingLevel loggingLevel = LoggingLevel::None) const
     {
         return this->_addComponent<ConstFilterComponent>(
             componentClass, name, params, static_cast<void *>(nullptr), loggingLevel,
@@ -87,9 +87,9 @@ public:
 
     template <typename InitDataT>
     ConstFilterComponent addComponent(const ConstFilterComponentClass componentClass,
-                                      const bt2c::CStringView name, InitDataT& initData,
+                                      const bt2c::CStringView name, InitDataT&& initData,
                                       const OptionalBorrowedObject<ConstMapValue> params = {},
-                                      const LoggingLevel loggingLevel = LoggingLevel::NONE) const
+                                      const LoggingLevel loggingLevel = LoggingLevel::None) const
     {
         return this->_addComponent<ConstFilterComponent>(
             componentClass, name, params, &initData, loggingLevel,
@@ -99,7 +99,7 @@ public:
     ConstSinkComponent addComponent(const ConstSinkComponentClass componentClass,
                                     const bt2c::CStringView name,
                                     const OptionalBorrowedObject<ConstMapValue> params = {},
-                                    const LoggingLevel loggingLevel = LoggingLevel::NONE) const
+                                    const LoggingLevel loggingLevel = LoggingLevel::None) const
     {
         return this->_addComponent<ConstSinkComponent>(
             componentClass, name, params, static_cast<void *>(nullptr), loggingLevel,
@@ -108,16 +108,16 @@ public:
 
     template <typename InitDataT>
     ConstSinkComponent addComponent(const ConstSinkComponentClass componentClass,
-                                    const bt2c::CStringView name, InitDataT& initData,
+                                    const bt2c::CStringView name, InitDataT&& initData,
                                     const OptionalBorrowedObject<ConstMapValue> params = {},
-                                    const LoggingLevel loggingLevel = LoggingLevel::NONE) const
+                                    const LoggingLevel loggingLevel = LoggingLevel::None) const
     {
         return this->_addComponent<ConstSinkComponent>(
             componentClass, name, params, &initData, loggingLevel,
             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.024946 seconds and 4 git commands to generate.