cpp-common/bt2: add C++ bindings around `bt_error *`
[babeltrace.git] / src / cpp-common / bt2 / component-class.hpp
index 51f7f470b736245c373b34d5e8e5e49f43a94481..e32ba34ae6811be0558401ce3f3f05de0b91b057 100644 (file)
@@ -12,6 +12,7 @@
 #include "cpp-common/bt2c/c-string-view.hpp"
 
 #include "borrowed-object.hpp"
+#include "component-class-dev.hpp"
 #include "shared-object.hpp"
 
 namespace bt2 {
@@ -51,6 +52,13 @@ public:
     using typename _ThisBorrowedObject::LibObjPtr;
     using Shared = SharedObject<CommonComponentClass, LibObjT, internal::ComponentClassRefFuncs>;
 
+    enum class Type
+    {
+        SOURCE = BT_COMPONENT_CLASS_TYPE_SOURCE,
+        FILTER = BT_COMPONENT_CLASS_TYPE_FILTER,
+        SINK = BT_COMPONENT_CLASS_TYPE_SINK,
+    };
+
     explicit CommonComponentClass(const LibObjPtr libObjPtr) noexcept :
         _ThisBorrowedObject {libObjPtr}
     {
@@ -175,6 +183,13 @@ public:
         return *this;
     }
 
+    template <typename UserComponentT>
+    static CommonSourceComponentClass<LibObjT>::Shared create()
+    {
+        return CommonSourceComponentClass::Shared::createWithoutRef(
+            internal::createSourceCompCls<UserComponentT>());
+    }
+
     bt2c::CStringView name() const noexcept
     {
         return this->_constComponentClass().name();
@@ -279,6 +294,13 @@ public:
         return *this;
     }
 
+    template <typename UserComponentT>
+    static CommonFilterComponentClass<LibObjT>::Shared create()
+    {
+        return CommonFilterComponentClass::Shared::createWithoutRef(
+            internal::createFilterCompCls<UserComponentT>());
+    }
+
     bt2c::CStringView name() const noexcept
     {
         return this->_constComponentClass().name();
@@ -383,6 +405,13 @@ public:
         return *this;
     }
 
+    template <typename UserComponentT>
+    static CommonSinkComponentClass<LibObjT>::Shared create()
+    {
+        return CommonSinkComponentClass::Shared::createWithoutRef(
+            internal::createSinkCompCls<UserComponentT>());
+    }
+
     bt2c::CStringView name() const noexcept
     {
         return this->_constComponentClass().name();
This page took 0.023066 seconds and 4 git commands to generate.