cpp-common/bt2: add asConst() methods
[babeltrace.git] / src / cpp-common / bt2 / value.hpp
index c8e3dc791fce51678e5dc5301487fedcd3e58156..408710c0eb0150b6655aafd037191e6d7fecb0b0 100644 (file)
@@ -110,6 +110,11 @@ public:
         return *this;
     }
 
+    CommonValue<const bt_value> asConst() const noexcept
+    {
+        return CommonValue<const bt_value> {*this};
+    }
+
     ValueType type() const noexcept
     {
         return static_cast<ValueType>(bt_value_get_type(this->libObjPtr()));
@@ -247,6 +252,11 @@ public:
         return *this;
     }
 
+    CommonNullValue<const bt_value> asConst() const noexcept
+    {
+        return CommonNullValue<const bt_value> {*this};
+    }
+
     Shared shared() const noexcept
     {
         return Shared::createWithRef(*this);
@@ -312,6 +322,11 @@ public:
         return *this;
     }
 
+    CommonBoolValue<const bt_value> asConst() const noexcept
+    {
+        return CommonBoolValue<const bt_value> {*this};
+    }
+
     CommonBoolValue<LibObjT> operator=(const Value rawVal) const noexcept
     {
         static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
@@ -400,6 +415,11 @@ public:
         return *this;
     }
 
+    CommonUnsignedIntegerValue<const bt_value> asConst() const noexcept
+    {
+        return CommonUnsignedIntegerValue<const bt_value> {*this};
+    }
+
     CommonUnsignedIntegerValue<LibObjT> operator=(const Value rawVal) const noexcept
     {
         bt_value_integer_unsigned_set(this->libObjPtr(), rawVal);
@@ -484,6 +504,11 @@ public:
         return *this;
     }
 
+    CommonSignedIntegerValue<const bt_value> asConst() const noexcept
+    {
+        return CommonSignedIntegerValue<const bt_value> {*this};
+    }
+
     CommonSignedIntegerValue<LibObjT> operator=(const Value rawVal) const noexcept
     {
         static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
@@ -567,6 +592,11 @@ public:
         return *this;
     }
 
+    CommonRealValue<const bt_value> asConst() const noexcept
+    {
+        return CommonRealValue<const bt_value> {*this};
+    }
+
     CommonRealValue<LibObjT> operator=(const Value rawVal) const noexcept
     {
         static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
@@ -654,6 +684,11 @@ public:
         return *this;
     }
 
+    CommonStringValue<const bt_value> asConst() const noexcept
+    {
+        return CommonStringValue<const bt_value> {*this};
+    }
+
     CommonStringValue<LibObjT> operator=(const char * const rawVal) const
     {
         static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
@@ -766,6 +801,11 @@ public:
         return *this;
     }
 
+    CommonArrayValue<const bt_value> asConst() const noexcept
+    {
+        return CommonArrayValue<const bt_value> {*this};
+    }
+
     std::uint64_t length() const noexcept
     {
         return bt_value_array_get_length(this->libObjPtr());
@@ -1064,6 +1104,11 @@ public:
         return *this;
     }
 
+    CommonMapValue<const bt_value> asConst() const noexcept
+    {
+        return CommonMapValue<const bt_value> {*this};
+    }
+
     std::uint64_t length() const noexcept
     {
         return bt_value_map_get_size(this->libObjPtr());
This page took 0.025701 seconds and 4 git commands to generate.