.gitignore: add some more IDE / tools related file
[babeltrace.git] / src / cpp-common / bt2 / self-component-port.hpp
index e2bbe80742af9a3350cebe23caf2b27c2a211316..10a73bb4bd3a021c58a5cd4722d4fa133a7ec3f5 100644 (file)
@@ -99,13 +99,14 @@ public:
     }
 
     template <typename T>
-    void data(T& obj) const noexcept
+    SelfComponent data(T& obj) const noexcept
     {
         bt_self_component_set_data(this->libObjPtr(),
                                    const_cast<void *>(static_cast<const void *>(&obj)));
+        return *this;
     }
 
-    bt2::TraceClass::Shared createTraceClass() const
+    TraceClass::Shared createTraceClass() const
     {
         const auto libObjPtr = bt_trace_class_create(this->libObjPtr());
 
@@ -113,10 +114,10 @@ public:
             throw MemoryError {};
         }
 
-        return bt2::TraceClass::Shared::createWithoutRef(libObjPtr);
+        return TraceClass::Shared::createWithoutRef(libObjPtr);
     }
 
-    bt2::ClockClass::Shared createClockClass() const
+    ClockClass::Shared createClockClass() const
     {
         const auto libObjPtr = bt_clock_class_create(this->libObjPtr());
 
@@ -124,7 +125,7 @@ public:
             throw MemoryError {};
         }
 
-        return bt2::ClockClass::Shared::createWithoutRef(libObjPtr);
+        return ClockClass::Shared::createWithoutRef(libObjPtr);
     }
 };
 
@@ -187,13 +188,7 @@ public:
         return this->_selfComponent().template data<T>();
     }
 
-    template <typename T>
-    void data(T& obj) const noexcept
-    {
-        this->_selfComponent().data(obj);
-    }
-
-private:
+protected:
     SelfComponent _selfComponent() const noexcept
     {
         return SelfComponent {this->libObjPtr()};
@@ -328,6 +323,8 @@ public:
 
 class SelfSourceComponent final : public internal::SelfSpecificComponent<bt_self_component_source>
 {
+    using _ThisSelfSpecificComponent = internal::SelfSpecificComponent<bt_self_component_source>;
+
 public:
     using OutputPorts = SelfComponentPorts<bt_self_component_source, bt_self_component_port_output,
                                            const bt_port_output>;
@@ -343,6 +340,15 @@ public:
             bt_self_component_source_as_component_source(this->libObjPtr())};
     }
 
+    using _ThisSelfSpecificComponent::data;
+
+    template <typename T>
+    SelfSourceComponent data(T& obj) const noexcept
+    {
+        this->_selfComponent().data(obj);
+        return *this;
+    }
+
     template <typename DataT>
     OutputPorts::Port addOutputPort(bt2c::CStringView name, DataT& data) const;
 
@@ -357,6 +363,8 @@ private:
 
 class SelfFilterComponent final : public internal::SelfSpecificComponent<bt_self_component_filter>
 {
+    using _ThisSelfSpecificComponent = internal::SelfSpecificComponent<bt_self_component_filter>;
+
 public:
     using InputPorts = SelfComponentPorts<bt_self_component_filter, bt_self_component_port_input,
                                           const bt_port_input>;
@@ -374,6 +382,15 @@ public:
             bt_self_component_filter_as_component_filter(this->libObjPtr())};
     }
 
+    using _ThisSelfSpecificComponent::data;
+
+    template <typename T>
+    SelfFilterComponent data(T& obj) const noexcept
+    {
+        this->_selfComponent().data(obj);
+        return *this;
+    }
+
     template <typename DataT>
     InputPorts::Port addInputPort(bt2c::CStringView name, DataT& data) const;
 
@@ -398,6 +415,8 @@ private:
 
 class SelfSinkComponent final : public internal::SelfSpecificComponent<bt_self_component_sink>
 {
+    using _ThisSelfSpecificComponent = internal::SelfSpecificComponent<bt_self_component_sink>;
+
 public:
     using InputPorts = SelfComponentPorts<bt_self_component_sink, bt_self_component_port_input,
                                           const bt_port_input>;
@@ -412,6 +431,15 @@ public:
         return ConstSinkComponent {bt_self_component_sink_as_component_sink(this->libObjPtr())};
     }
 
+    using _ThisSelfSpecificComponent::data;
+
+    template <typename T>
+    SelfSinkComponent data(T& obj) const noexcept
+    {
+        this->_selfComponent().data(obj);
+        return *this;
+    }
+
     MessageIterator::Shared createMessageIterator(InputPorts::Port port) const;
 
     bool isInterrupted() const noexcept
This page took 0.042058 seconds and 4 git commands to generate.