#ifndef BABELTRACE_CPP_COMMON_BT2_FIELD_CLASS_HPP
#define BABELTRACE_CPP_COMMON_BT2_FIELD_CLASS_HPP
-#include <type_traits>
#include <cstdint>
+#include <type_traits>
+
#include <babeltrace2/babeltrace.h>
#include "common/assert.h"
-#include "internal/borrowed-obj.hpp"
-#include "internal/shared-obj.hpp"
#include "cpp-common/optional.hpp"
#include "cpp-common/string_view.hpp"
-#include "lib-error.hpp"
-#include "integer-range-set.hpp"
+
+#include "common-iter.hpp"
+#include "exc.hpp"
#include "field-path.hpp"
+#include "integer-range-set.hpp"
+#include "internal/borrowed-obj.hpp"
+#include "internal/shared-obj.hpp"
+#include "internal/utils.hpp"
+#include "value.hpp"
namespace bt2 {
-
namespace internal {
struct FieldClassRefFuncs final
template <typename LibObjT>
struct CommonFieldClassSpec;
-// Functions specific to mutable field classes
+/* Functions specific to mutable field classes */
template <>
struct CommonFieldClassSpec<bt_field_class> final
{
}
};
-// Functions specific to constant field classes
+/* Functions specific to constant field classes */
template <>
struct CommonFieldClassSpec<const bt_field_class> final
{
}
};
-} // namespace internal
+} /* namespace internal */
template <typename LibObjT>
class CommonBitArrayFieldClass;
template <typename LibObjT>
class ConstEnumerationFieldClassMapping;
+template <typename LibObjT>
+class CommonBaseEnumerationFieldClass;
+
template <typename LibObjT, typename MappingT>
class CommonEnumerationFieldClass;
template <typename LibObjT>
class CommonVariantWithoutSelectorFieldClass;
+template <typename LibObjT>
+class CommonVariantWithSelectorFieldClass;
+
template <typename LibObjT>
class ConstVariantWithIntegerSelectorFieldClassOption;
template <typename LibObjT, typename RangeSetT>
class CommonVariantWithIntegerSelectorFieldClass;
+template <typename LibObjT>
+class CommonEventClass;
+
+template <typename LibObjT>
+class CommonStreamClass;
+
+template <typename LibObjT>
+class CommonTraceClass;
+
enum class FieldClassType
{
BOOL = BT_FIELD_CLASS_TYPE_BOOL,
template <typename LibObjT>
class CommonFieldClass : public internal::BorrowedObj<LibObjT>
{
- // Allow appendMember() to call `fc._libObjPtr()`
+ /* Allow appendMember() to call `fc.libObjPtr()` */
friend class CommonStructureFieldClass<bt_field_class>;
- // Allow appendOption() to call `fc._libObjPtr()`
+ /* Allow appendOption() to call `fc.libObjPtr()` */
friend class CommonVariantWithoutSelectorFieldClass<bt_field_class>;
friend class CommonVariantWithIntegerSelectorFieldClass<
ConstVariantWithIntegerSelectorFieldClassOption<
const bt_field_class_variant_with_selector_field_integer_signed_option>>;
+ /* Allow *FieldClass() to call `fc.libObjPtr()` */
+ friend class CommonEventClass<bt_event_class>;
+ friend class CommonStreamClass<bt_stream_class>;
+
+ /* Allow create*FieldClass() to call `fc.libObjPtr()` */
+ friend class CommonTraceClass<bt_trace_class>;
+
private:
using typename internal::BorrowedObj<LibObjT>::_ThisBorrowedObj;
}
template <typename OtherLibObjT>
- CommonFieldClass(const CommonFieldClass<OtherLibObjT>& fc) noexcept : _ThisBorrowedObj {fc}
+ CommonFieldClass(const CommonFieldClass<OtherLibObjT> fc) noexcept : _ThisBorrowedObj {fc}
{
}
template <typename OtherLibObjT>
- _ThisCommonFieldClass& operator=(const CommonFieldClass<OtherLibObjT>& fc) noexcept
+ CommonFieldClass& operator=(const CommonFieldClass<OtherLibObjT> fc) noexcept
{
_ThisBorrowedObj::operator=(fc);
return *this;
FieldClassType type() const noexcept
{
- return static_cast<FieldClassType>(bt_field_class_get_type(this->_libObjPtr()));
+ return static_cast<FieldClassType>(bt_field_class_get_type(this->libObjPtr()));
}
bool isBool() const noexcept
return this->_libTypeIs(BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION);
}
+ bool isReal() const noexcept
+ {
+ return this->_libTypeIs(BT_FIELD_CLASS_TYPE_REAL);
+ }
+
bool isSinglePrecisionReal() const noexcept
{
return this->_libTypeIs(BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL);
return this->_libTypeIs(BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR_FIELD);
}
+ template <typename FieldClassT>
+ FieldClassT as() const noexcept
+ {
+ return FieldClassT {this->libObjPtr()};
+ }
+
CommonBitArrayFieldClass<LibObjT> asBitArray() const noexcept;
CommonIntegerFieldClass<LibObjT> asInteger() const noexcept;
-
+ CommonBaseEnumerationFieldClass<LibObjT> asEnumeration() const noexcept;
CommonEnumerationFieldClass<LibObjT, ConstEnumerationFieldClassMapping<
const bt_field_class_enumeration_unsigned_mapping>>
asUnsignedEnumeration() const noexcept;
CommonVariantFieldClass<LibObjT> asVariant() const noexcept;
CommonVariantWithoutSelectorFieldClass<LibObjT> asVariantWithoutSelector() const noexcept;
+ CommonVariantWithSelectorFieldClass<LibObjT> asVariantWithSelector() const noexcept;
CommonVariantWithIntegerSelectorFieldClass<
LibObjT, ConstVariantWithIntegerSelectorFieldClassOption<
asVariantWithSignedIntegerSelector() const noexcept;
template <typename LibValT>
- void userAttributes(const CommonMapValue<LibValT>& userAttrs)
+ void userAttributes(const CommonMapValue<LibValT> userAttrs)
{
static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
- bt_field_class_set_user_attributes(this->_libObjPtr(), userAttrs._libObjPtr());
+ bt_field_class_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr());
}
ConstMapValue userAttributes() const noexcept
{
return ConstMapValue {internal::CommonFieldClassSpec<const bt_field_class>::userAttributes(
- this->_libObjPtr())};
+ this->libObjPtr())};
}
UserAttributes userAttributes() noexcept
{
return UserAttributes {
- internal::CommonFieldClassSpec<LibObjT>::userAttributes(this->_libObjPtr())};
+ internal::CommonFieldClassSpec<LibObjT>::userAttributes(this->libObjPtr())};
}
Shared shared() const noexcept
{
- return Shared {*this};
+ return Shared::createWithRef(*this);
}
protected:
bool _libTypeIs(const bt_field_class_type type) const noexcept
{
- return bt_field_class_type_is(bt_field_class_get_type(this->_libObjPtr()), type);
+ return bt_field_class_type_is(bt_field_class_get_type(this->libObjPtr()), type);
}
};
using FieldClass = CommonFieldClass<bt_field_class>;
using ConstFieldClass = CommonFieldClass<const bt_field_class>;
+namespace internal {
+
+struct FieldClassTypeDescr
+{
+ using Const = ConstFieldClass;
+ using NonConst = FieldClass;
+};
+
+template <>
+struct TypeDescr<FieldClass> : public FieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstFieldClass> : public FieldClassTypeDescr
+{
+};
+
+} /* namespace internal */
+
template <typename LibObjT>
class CommonBitArrayFieldClass final : public CommonFieldClass<LibObjT>
{
}
template <typename OtherLibObjT>
- CommonBitArrayFieldClass(const CommonBitArrayFieldClass<OtherLibObjT>& fc) noexcept :
+ CommonBitArrayFieldClass(const CommonBitArrayFieldClass<OtherLibObjT> fc) noexcept :
_ThisCommonFieldClass {fc}
{
}
template <typename OtherLibObjT>
CommonBitArrayFieldClass<LibObjT>&
- operator=(const CommonBitArrayFieldClass<OtherLibObjT>& fc) noexcept
+ operator=(const CommonBitArrayFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonFieldClass::operator=(fc);
return *this;
std::uint64_t length() const noexcept
{
- return bt_field_class_bit_array_get_length(this->_libObjPtr());
+ return bt_field_class_bit_array_get_length(this->libObjPtr());
}
Shared shared() const noexcept
{
- return Shared {*this};
+ return Shared::createWithRef(*this);
}
};
using BitArrayFieldClass = CommonBitArrayFieldClass<bt_field_class>;
using ConstBitArrayFieldClass = CommonBitArrayFieldClass<const bt_field_class>;
+namespace internal {
+
+struct BitArrayFieldClassTypeDescr
+{
+ using Const = ConstBitArrayFieldClass;
+ using NonConst = BitArrayFieldClass;
+};
+
+template <>
+struct TypeDescr<BitArrayFieldClass> : public BitArrayFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstBitArrayFieldClass> : public BitArrayFieldClassTypeDescr
+{
+};
+
+} /* namespace internal */
+
enum class DisplayBase
{
BINARY = BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_BINARY,
}
template <typename OtherLibObjT>
- CommonIntegerFieldClass(const CommonIntegerFieldClass<OtherLibObjT>& fc) noexcept :
+ CommonIntegerFieldClass(const CommonIntegerFieldClass<OtherLibObjT> fc) noexcept :
_ThisCommonFieldClass {fc}
{
}
template <typename OtherLibObjT>
- _ThisCommonIntegerFieldClass&
- operator=(const CommonIntegerFieldClass<OtherLibObjT>& fc) noexcept
+ CommonIntegerFieldClass& operator=(const CommonIntegerFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonFieldClass::operator=(fc);
return *this;
{
static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
- bt_field_class_integer_get_field_value_range(this->_libObjPtr(), n);
+ bt_field_class_integer_set_field_value_range(this->libObjPtr(), n);
}
std::uint64_t fieldValueRange() const noexcept
{
- return bt_field_class_integer_get_field_value_range(this->_libObjPtr());
+ return bt_field_class_integer_get_field_value_range(this->libObjPtr());
}
void preferredDisplayBase(const DisplayBase base) noexcept
static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
bt_field_class_integer_set_preferred_display_base(
- this->_libObjPtr(), static_cast<bt_field_class_integer_preferred_display_base>(base));
+ this->libObjPtr(), static_cast<bt_field_class_integer_preferred_display_base>(base));
}
DisplayBase preferredDisplayBase() const noexcept
{
return static_cast<DisplayBase>(
- bt_field_class_integer_get_preferred_display_base(this->_libObjPtr()));
+ bt_field_class_integer_get_preferred_display_base(this->libObjPtr()));
}
Shared shared() const noexcept
{
- return Shared {*this};
+ return Shared::createWithRef(*this);
}
};
namespace internal {
+struct IntegerFieldClassTypeDescr
+{
+ using Const = ConstIntegerFieldClass;
+ using NonConst = IntegerFieldClass;
+};
+
+template <>
+struct TypeDescr<IntegerFieldClass> : public IntegerFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstIntegerFieldClass> : public IntegerFieldClassTypeDescr
+{
+};
+
+} /* namespace internal */
+
+namespace internal {
+
template <typename LibObjT>
struct ConstEnumerationFieldClassMappingSpec;
-// Functions specific to unsigned enumeration field class mappings
+/* Functions specific to unsigned enumeration field class mappings */
template <>
struct ConstEnumerationFieldClassMappingSpec<const bt_field_class_enumeration_unsigned_mapping>
final
}
};
-// Functions specific to signed enumeration field class mappings
+/* Functions specific to signed enumeration field class mappings */
template <>
struct ConstEnumerationFieldClassMappingSpec<const bt_field_class_enumeration_signed_mapping> final
{
}
};
-} // namespace internal
+} /* namespace internal */
template <typename LibObjT>
class ConstEnumerationFieldClassMapping final : public internal::BorrowedObj<LibObjT>
private:
using typename internal::BorrowedObj<LibObjT>::_ThisBorrowedObj;
using typename internal::BorrowedObj<LibObjT>::_LibObjPtr;
- using _ThisConstEnumerationFieldClassMapping = ConstEnumerationFieldClassMapping<LibObjT>;
public:
using RangeSet = typename std::conditional<
{
}
- ConstEnumerationFieldClassMapping(
- const _ThisConstEnumerationFieldClassMapping& mapping) noexcept :
+ ConstEnumerationFieldClassMapping(const ConstEnumerationFieldClassMapping& mapping) noexcept :
_ThisBorrowedObj {mapping}
{
}
- _ThisConstEnumerationFieldClassMapping&
- operator=(const _ThisConstEnumerationFieldClassMapping& mapping) noexcept
+ ConstEnumerationFieldClassMapping&
+ operator=(const ConstEnumerationFieldClassMapping& mapping) noexcept
{
_ThisBorrowedObj::operator=(mapping);
return *this;
RangeSet ranges() const noexcept
{
return RangeSet {
- internal::ConstEnumerationFieldClassMappingSpec<LibObjT>::ranges(this->_libObjPtr())};
+ internal::ConstEnumerationFieldClassMappingSpec<LibObjT>::ranges(this->libObjPtr())};
}
bpstd::string_view label() const noexcept
{
- return internal::ConstEnumerationFieldClassMappingSpec<LibObjT>::label(this->_libObjPtr());
+ return internal::ConstEnumerationFieldClassMappingSpec<LibObjT>::label(this->libObjPtr());
}
};
template <typename MappingT>
struct CommonEnumerationFieldClassSpec;
-// Functions specific to unsigned enumeration field classes
+/* Functions specific to unsigned enumeration field classes */
template <>
struct CommonEnumerationFieldClassSpec<ConstUnsignedEnumerationFieldClassMapping> final
{
{
return bt_field_class_enumeration_unsigned_borrow_mapping_by_label_const(libObjPtr, label);
}
+
+ static bt_field_class_enumeration_add_mapping_status
+ addMapping(bt_field_class * const libObjPtr, const char * const label,
+ const bt_integer_range_set_unsigned * const libRanges) noexcept
+ {
+ return bt_field_class_enumeration_unsigned_add_mapping(libObjPtr, label, libRanges);
+ }
};
-// Functions specific to signed enumeration field classes
+/* Functions specific to signed enumeration field classes */
template <>
struct CommonEnumerationFieldClassSpec<ConstSignedEnumerationFieldClassMapping> final
{
{
return bt_field_class_enumeration_signed_borrow_mapping_by_label_const(libObjPtr, label);
}
+
+ static bt_field_class_enumeration_add_mapping_status
+ addMapping(bt_field_class * const libObjPtr, const char * const label,
+ const bt_integer_range_set_signed * const libRanges) noexcept
+ {
+ return bt_field_class_enumeration_signed_add_mapping(libObjPtr, label, libRanges);
+ }
};
-} // namespace internal
+} /* namespace internal */
-template <typename LibObjT, typename MappingT>
-class CommonEnumerationFieldClass final : public CommonIntegerFieldClass<LibObjT>
+template <typename LibObjT>
+class CommonBaseEnumerationFieldClass : public CommonIntegerFieldClass<LibObjT>
{
private:
- using typename CommonFieldClass<LibObjT>::_LibObjPtr;
using typename CommonIntegerFieldClass<LibObjT>::_ThisCommonIntegerFieldClass;
- using _ThisCommonEnumerationFieldClass = CommonEnumerationFieldClass<LibObjT, MappingT>;
+
+protected:
+ using typename CommonFieldClass<LibObjT>::_LibObjPtr;
+ using _ThisCommonBaseEnumerationFieldClass = CommonBaseEnumerationFieldClass<LibObjT>;
public:
- using Shared = internal::SharedFieldClass<_ThisCommonEnumerationFieldClass, LibObjT>;
- using Mapping = MappingT;
+ using Shared = internal::SharedFieldClass<_ThisCommonBaseEnumerationFieldClass, LibObjT>;
- explicit CommonEnumerationFieldClass(const _LibObjPtr libObjPtr) noexcept :
+ explicit CommonBaseEnumerationFieldClass(const _LibObjPtr libObjPtr) noexcept :
_ThisCommonIntegerFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isEnumeration());
}
template <typename OtherLibObjT>
- CommonEnumerationFieldClass(
- const CommonEnumerationFieldClass<OtherLibObjT, MappingT>& fc) noexcept :
+ CommonBaseEnumerationFieldClass(const CommonBaseEnumerationFieldClass<OtherLibObjT> fc) noexcept
+ :
_ThisCommonIntegerFieldClass {fc}
{
}
template <typename OtherLibObjT>
- _ThisCommonEnumerationFieldClass&
- operator=(const CommonEnumerationFieldClass<OtherLibObjT, MappingT>& fc) noexcept
+ CommonBaseEnumerationFieldClass&
+ operator=(const CommonBaseEnumerationFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonIntegerFieldClass::operator=(fc);
return *this;
std::uint64_t size() const noexcept
{
- return bt_field_class_enumeration_get_mapping_count(this->_libObjPtr());
+ return bt_field_class_enumeration_get_mapping_count(this->libObjPtr());
+ }
+
+ Shared shared() const noexcept
+ {
+ return Shared::createWithRef(*this);
+ }
+};
+
+template <typename LibObjT, typename MappingT>
+class CommonEnumerationFieldClass final : public CommonBaseEnumerationFieldClass<LibObjT>
+{
+private:
+ using typename CommonFieldClass<LibObjT>::_LibObjPtr;
+ using typename CommonBaseEnumerationFieldClass<LibObjT>::_ThisCommonBaseEnumerationFieldClass;
+ using _ThisCommonEnumerationFieldClass = CommonEnumerationFieldClass<LibObjT, MappingT>;
+
+public:
+ using Shared = internal::SharedFieldClass<_ThisCommonEnumerationFieldClass, LibObjT>;
+ using Iterator = CommonIterator<CommonEnumerationFieldClass, MappingT>;
+ using Mapping = MappingT;
+
+ explicit CommonEnumerationFieldClass(const _LibObjPtr libObjPtr) noexcept :
+ _ThisCommonBaseEnumerationFieldClass {libObjPtr}
+ {
+ BT_ASSERT_DBG(this->isEnumeration());
+ }
+
+ template <typename OtherLibObjT>
+ CommonEnumerationFieldClass(
+ const CommonEnumerationFieldClass<OtherLibObjT, MappingT> fc) noexcept :
+ _ThisCommonEnumerationFieldClass {fc}
+ {
+ }
+
+ template <typename OtherLibObjT>
+ CommonEnumerationFieldClass&
+ operator=(const CommonEnumerationFieldClass<OtherLibObjT, MappingT> fc) noexcept
+ {
+ _ThisCommonEnumerationFieldClass::operator=(fc);
+ return *this;
}
Mapping operator[](const std::uint64_t index) const noexcept
{
return Mapping {internal::CommonEnumerationFieldClassSpec<MappingT>::mappingByIndex(
- this->_libObjPtr(), index)};
+ this->libObjPtr(), index)};
}
nonstd::optional<Mapping> operator[](const char * const label) const noexcept
{
const auto libObjPtr = internal::CommonEnumerationFieldClassSpec<MappingT>::mappingByLabel(
- this->_libObjPtr(), label);
+ this->libObjPtr(), label);
if (libObjPtr) {
return Mapping {libObjPtr};
return (*this)[label.data()];
}
+ void addMapping(const char * const label, const typename Mapping::RangeSet ranges)
+ {
+ const auto status = internal::CommonEnumerationFieldClassSpec<MappingT>::addMapping(
+ this->libObjPtr(), label, ranges.libObjPtr());
+
+ if (status == BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_MEMORY_ERROR) {
+ throw MemoryError {};
+ }
+ }
+
+ void addMapping(const std::string& label, const typename Mapping::RangeSet ranges)
+ {
+ this->addMapping(label.data(), ranges);
+ }
+
+ Iterator begin() const noexcept
+ {
+ return Iterator {*this, 0};
+ }
+
+ Iterator end() const noexcept
+ {
+ return Iterator {*this, this->size()};
+ }
+
Shared shared() const noexcept
{
- return Shared {*this};
+ return Shared::createWithRef(*this);
}
};
+using EnumerationFieldClass = CommonBaseEnumerationFieldClass<bt_field_class>;
+using ConstEnumerationFieldClass = CommonBaseEnumerationFieldClass<const bt_field_class>;
+
using UnsignedEnumerationFieldClass =
CommonEnumerationFieldClass<bt_field_class, ConstUnsignedEnumerationFieldClassMapping>;
namespace internal {
+struct UnsignedEnumerationFieldClassTypeDescr
+{
+ using Const = ConstUnsignedEnumerationFieldClass;
+ using NonConst = UnsignedEnumerationFieldClass;
+};
+
+template <>
+struct TypeDescr<UnsignedEnumerationFieldClass> : public UnsignedEnumerationFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstUnsignedEnumerationFieldClass> : public UnsignedEnumerationFieldClassTypeDescr
+{
+};
+
+struct SignedEnumerationFieldClassTypeDescr
+{
+ using Const = ConstSignedEnumerationFieldClass;
+ using NonConst = SignedEnumerationFieldClass;
+};
+
+template <>
+struct TypeDescr<SignedEnumerationFieldClass> : public SignedEnumerationFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstSignedEnumerationFieldClass> : public SignedEnumerationFieldClassTypeDescr
+{
+};
+
template <typename LibObjT>
struct CommonStructureFieldClassMemberSpec;
-// Functions specific to mutable structure field class members
+/* Functions specific to mutable structure field class members */
template <>
struct CommonStructureFieldClassMemberSpec<bt_field_class_structure_member> final
{
{
return bt_field_class_structure_member_borrow_field_class(libObjPtr);
}
+
+ static bt_value *userAttributes(bt_field_class_structure_member * const libObjPtr) noexcept
+ {
+ return bt_field_class_structure_member_borrow_user_attributes(libObjPtr);
+ }
};
-// Functions specific to constant structure field class members
+/* Functions specific to constant structure field class members */
template <>
struct CommonStructureFieldClassMemberSpec<const bt_field_class_structure_member> final
{
{
return bt_field_class_structure_member_borrow_field_class_const(libObjPtr);
}
+
+ static const bt_value *
+ userAttributes(const bt_field_class_structure_member * const libObjPtr) noexcept
+ {
+ return bt_field_class_structure_member_borrow_user_attributes_const(libObjPtr);
+ }
};
-} // namespace internal
+} /* namespace internal */
template <typename LibObjT>
class CommonStructureFieldClassMember final : public internal::BorrowedObj<LibObjT>
typename std::conditional<std::is_const<LibObjT>::value, ConstFieldClass, FieldClass>::type;
public:
+ using UserAttributes =
+ typename std::conditional<std::is_const<LibObjT>::value, ConstMapValue, MapValue>::type;
+
explicit CommonStructureFieldClassMember(const _LibObjPtr libObjPtr) noexcept :
_ThisBorrowedObj {libObjPtr}
{
}
template <typename OtherLibObjT>
- CommonStructureFieldClassMember(
- const CommonStructureFieldClassMember<OtherLibObjT>& fc) noexcept :
+ CommonStructureFieldClassMember(const CommonStructureFieldClassMember<OtherLibObjT> fc) noexcept
+ :
_ThisBorrowedObj {fc}
{
}
template <typename OtherLibObjT>
CommonStructureFieldClassMember<LibObjT>&
- operator=(const CommonStructureFieldClassMember<OtherLibObjT>& fc) noexcept
+ operator=(const CommonStructureFieldClassMember<OtherLibObjT> fc) noexcept
{
_ThisBorrowedObj::operator=(fc);
return *this;
bpstd::string_view name() const noexcept
{
- return bt_field_class_structure_member_get_name(this->_libObjPtr());
+ return bt_field_class_structure_member_get_name(this->libObjPtr());
}
ConstFieldClass fieldClass() const noexcept
{
return ConstFieldClass {internal::CommonStructureFieldClassMemberSpec<
- const bt_field_class_structure_member>::fieldClass(this->_libObjPtr())};
+ const bt_field_class_structure_member>::fieldClass(this->libObjPtr())};
}
_FieldClass fieldClass() noexcept
{
return _FieldClass {
- internal::CommonStructureFieldClassMemberSpec<LibObjT>::fieldClass(this->_libObjPtr())};
+ internal::CommonStructureFieldClassMemberSpec<LibObjT>::fieldClass(this->libObjPtr())};
+ }
+
+ template <typename LibValT>
+ void userAttributes(const CommonMapValue<LibValT> userAttrs)
+ {
+ static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+
+ bt_field_class_structure_member_set_user_attributes(this->libObjPtr(),
+ userAttrs.libObjPtr());
+ }
+
+ ConstMapValue userAttributes() const noexcept
+ {
+ return ConstMapValue {internal::CommonStructureFieldClassMemberSpec<
+ const bt_field_class_structure_member>::userAttributes(this->libObjPtr())};
+ }
+
+ UserAttributes userAttributes() noexcept
+ {
+ return UserAttributes {
+ internal::CommonStructureFieldClassMemberSpec<LibObjT>::userAttributes(
+ this->libObjPtr())};
}
};
namespace internal {
+struct StructureFieldClassMemberTypeDescr
+{
+ using Const = ConstStructureFieldClassMember;
+ using NonConst = StructureFieldClassMember;
+};
+
+template <>
+struct TypeDescr<StructureFieldClassMember> : public StructureFieldClassMemberTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstStructureFieldClassMember> : public StructureFieldClassMemberTypeDescr
+{
+};
+
template <typename LibObjT>
struct CommonStructureFieldClassSpec;
-// Functions specific to mutable structure field classes
+/* Functions specific to mutable structure field classes */
template <>
struct CommonStructureFieldClassSpec<bt_field_class> final
{
}
};
-// Functions specific to constant structure field classes
+/* Functions specific to constant structure field classes */
template <>
struct CommonStructureFieldClassSpec<const bt_field_class> final
{
}
};
-} // namespace internal
+} /* namespace internal */
template <typename LibObjT>
class CommonStructureFieldClass final : public CommonFieldClass<LibObjT>
public:
using Shared = internal::SharedFieldClass<CommonStructureFieldClass<LibObjT>, LibObjT>;
-
using Member =
typename std::conditional<std::is_const<LibObjT>::value, ConstStructureFieldClassMember,
StructureFieldClassMember>::type;
+ using Iterator = CommonIterator<CommonStructureFieldClass<LibObjT>, Member>;
+
explicit CommonStructureFieldClass(const _LibObjPtr libObjPtr) noexcept :
_ThisCommonFieldClass {libObjPtr}
{
}
template <typename OtherLibObjT>
- CommonStructureFieldClass(const CommonStructureFieldClass<OtherLibObjT>& fc) noexcept :
+ CommonStructureFieldClass(const CommonStructureFieldClass<OtherLibObjT> fc) noexcept :
_ThisCommonFieldClass {fc}
{
}
template <typename OtherLibObjT>
- CommonStructureFieldClass<LibObjT>&
- operator=(const CommonStructureFieldClass<OtherLibObjT>& fc) noexcept
+ CommonStructureFieldClass& operator=(const CommonStructureFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonFieldClass::operator=(fc);
return *this;
}
- void appendMember(const char * const name, const FieldClass& fc)
+ void appendMember(const char * const name, const FieldClass fc)
{
static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
const auto status =
- bt_field_class_structure_append_member(this->_libObjPtr(), name, fc._libObjPtr());
+ bt_field_class_structure_append_member(this->libObjPtr(), name, fc.libObjPtr());
if (status == BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_MEMORY_ERROR) {
- throw LibMemoryError {};
+ throw MemoryError {};
}
}
- void appendMember(const std::string& name, const FieldClass& fc)
+ void appendMember(const std::string& name, const FieldClass fc)
{
this->appendMember(name.data(), fc);
}
std::uint64_t size() const noexcept
{
- return bt_field_class_structure_get_member_count(this->_libObjPtr());
+ return bt_field_class_structure_get_member_count(this->libObjPtr());
+ }
+
+ Iterator begin() const noexcept
+ {
+ return Iterator {*this, 0};
+ }
+
+ Iterator end() const noexcept
+ {
+ return Iterator {*this, this->size()};
}
ConstStructureFieldClassMember operator[](const std::uint64_t index) const noexcept
{
return ConstStructureFieldClassMember {
internal::CommonStructureFieldClassSpec<const bt_field_class>::memberByIndex(
- this->_libObjPtr(), index)};
+ this->libObjPtr(), index)};
}
Member operator[](const std::uint64_t index) noexcept
{
return Member {internal::CommonStructureFieldClassSpec<LibObjT>::memberByIndex(
- this->_libObjPtr(), index)};
+ this->libObjPtr(), index)};
}
nonstd::optional<ConstStructureFieldClassMember>
{
const auto libObjPtr =
internal::CommonStructureFieldClassSpec<const bt_field_class>::memberByName(
- this->_libObjPtr(), name);
+ this->libObjPtr(), name);
if (libObjPtr) {
return ConstStructureFieldClassMember {libObjPtr};
nonstd::optional<Member> operator[](const char * const name) noexcept
{
- const auto libObjPtr = internal::CommonStructureFieldClassSpec<LibObjT>::memberByName(
- this->_libObjPtr(), name);
+ const auto libObjPtr =
+ internal::CommonStructureFieldClassSpec<LibObjT>::memberByName(this->libObjPtr(), name);
if (libObjPtr) {
return Member {libObjPtr};
Shared shared() const noexcept
{
- return Shared {*this};
+ return Shared::createWithRef(*this);
}
};
namespace internal {
+struct StructureFieldClassTypeDescr
+{
+ using Const = ConstStructureFieldClass;
+ using NonConst = StructureFieldClass;
+};
+
+template <>
+struct TypeDescr<StructureFieldClass> : public StructureFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstStructureFieldClass> : public StructureFieldClassTypeDescr
+{
+};
+
template <typename LibObjT>
struct CommonArrayFieldClassSpec;
-// Functions specific to mutable array field classes
+/* Functions specific to mutable array field classes */
template <>
struct CommonArrayFieldClassSpec<bt_field_class> final
{
}
};
-// Functions specific to constant array field classes
+/* Functions specific to constant array field classes */
template <>
struct CommonArrayFieldClassSpec<const bt_field_class> final
{
}
};
-} // namespace internal
+} /* namespace internal */
template <typename LibObjT>
class CommonArrayFieldClass : public CommonFieldClass<LibObjT>
}
template <typename OtherLibObjT>
- CommonArrayFieldClass(const CommonArrayFieldClass<OtherLibObjT>& fc) noexcept :
+ CommonArrayFieldClass(const CommonArrayFieldClass<OtherLibObjT> fc) noexcept :
_ThisCommonFieldClass {fc}
{
}
template <typename OtherLibObjT>
- _ThisCommonArrayFieldClass& operator=(const CommonArrayFieldClass<OtherLibObjT>& fc) noexcept
+ CommonArrayFieldClass& operator=(const CommonArrayFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonFieldClass::operator=(fc);
return *this;
{
return ConstFieldClass {
internal::CommonArrayFieldClassSpec<const bt_field_class>::elementFieldClass(
- this->_libObjPtr())};
+ this->libObjPtr())};
}
_FieldClass elementFieldClass() noexcept
{
return _FieldClass {
- internal::CommonArrayFieldClassSpec<LibObjT>::elementFieldClass(this->_libObjPtr())};
+ internal::CommonArrayFieldClassSpec<LibObjT>::elementFieldClass(this->libObjPtr())};
}
Shared shared() const noexcept
{
- return Shared {*this};
+ return Shared::createWithRef(*this);
}
};
using ArrayFieldClass = CommonArrayFieldClass<bt_field_class>;
using ConstArrayFieldClass = CommonArrayFieldClass<const bt_field_class>;
+namespace internal {
+
+struct ArrayFieldClassTypeDescr
+{
+ using Const = ConstArrayFieldClass;
+ using NonConst = ArrayFieldClass;
+};
+
+template <>
+struct TypeDescr<ArrayFieldClass> : public ArrayFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstArrayFieldClass> : public ArrayFieldClassTypeDescr
+{
+};
+
+} /* namespace internal */
+
template <typename LibObjT>
class CommonStaticArrayFieldClass final : public CommonArrayFieldClass<LibObjT>
{
}
template <typename OtherLibObjT>
- CommonStaticArrayFieldClass(const CommonStaticArrayFieldClass<OtherLibObjT>& fc) noexcept :
+ CommonStaticArrayFieldClass(const CommonStaticArrayFieldClass<OtherLibObjT> fc) noexcept :
_ThisCommonArrayFieldClass {fc}
{
}
template <typename OtherLibObjT>
- CommonStaticArrayFieldClass<LibObjT>&
- operator=(const CommonStaticArrayFieldClass<OtherLibObjT>& fc) noexcept
+ CommonStaticArrayFieldClass&
+ operator=(const CommonStaticArrayFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonArrayFieldClass::operator=(fc);
return *this;
std::uint64_t length() const noexcept
{
- return bt_field_class_array_static_get_length(this->_libObjPtr());
+ return bt_field_class_array_static_get_length(this->libObjPtr());
}
Shared shared() const noexcept
{
- return Shared {*this};
+ return Shared::createWithRef(*this);
}
};
using StaticArrayFieldClass = CommonStaticArrayFieldClass<bt_field_class>;
using ConstStaticArrayFieldClass = CommonStaticArrayFieldClass<const bt_field_class>;
+namespace internal {
+
+struct StaticArrayFieldClassTypeDescr
+{
+ using Const = ConstStaticArrayFieldClass;
+ using NonConst = StaticArrayFieldClass;
+};
+
+template <>
+struct TypeDescr<StaticArrayFieldClass> : public StaticArrayFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstStaticArrayFieldClass> : public StaticArrayFieldClassTypeDescr
+{
+};
+
+} /* namespace internal */
+
template <typename LibObjT>
class CommonDynamicArrayWithLengthFieldClass final : public CommonArrayFieldClass<LibObjT>
{
template <typename OtherLibObjT>
CommonDynamicArrayWithLengthFieldClass(
- const CommonDynamicArrayWithLengthFieldClass<OtherLibObjT>& fc) noexcept :
+ const CommonDynamicArrayWithLengthFieldClass<OtherLibObjT> fc) noexcept :
_ThisCommonArrayFieldClass {fc}
{
}
template <typename OtherLibObjT>
- CommonDynamicArrayWithLengthFieldClass<LibObjT>&
- operator=(const CommonDynamicArrayWithLengthFieldClass<OtherLibObjT>& fc) noexcept
+ CommonDynamicArrayWithLengthFieldClass&
+ operator=(const CommonDynamicArrayWithLengthFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonArrayFieldClass::operator=(fc);
return *this;
{
return ConstFieldPath {
bt_field_class_array_dynamic_with_length_field_borrow_length_field_path_const(
- this->_libObjPtr())};
+ this->libObjPtr())};
}
Shared shared() const noexcept
{
- return Shared {*this};
+ return Shared::createWithRef(*this);
}
};
namespace internal {
+struct DynamicArrayWithLengthFieldClassTypeDescr
+{
+ using Const = ConstDynamicArrayWithLengthFieldClass;
+ using NonConst = DynamicArrayWithLengthFieldClass;
+};
+
+template <>
+struct TypeDescr<DynamicArrayWithLengthFieldClass> :
+ public DynamicArrayWithLengthFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstDynamicArrayWithLengthFieldClass> :
+ public DynamicArrayWithLengthFieldClassTypeDescr
+{
+};
+
template <typename LibObjT>
struct CommonOptionFieldClassSpec;
-// Functions specific to mutable option field classes
+/* Functions specific to mutable option field classes */
template <>
struct CommonOptionFieldClassSpec<bt_field_class> final
{
}
};
-// Functions specific to constant option field classes
+/* Functions specific to constant option field classes */
template <>
struct CommonOptionFieldClassSpec<const bt_field_class> final
{
}
};
-} // namespace internal
+} /* namespace internal */
template <typename LibObjT>
class CommonOptionFieldClass : public CommonFieldClass<LibObjT>
}
template <typename OtherLibObjT>
- CommonOptionFieldClass(const CommonOptionFieldClass<OtherLibObjT>& fc) noexcept :
+ CommonOptionFieldClass(const CommonOptionFieldClass<OtherLibObjT> fc) noexcept :
_ThisCommonFieldClass {fc}
{
}
template <typename OtherLibObjT>
- _ThisCommonOptionFieldClass& operator=(const CommonOptionFieldClass<OtherLibObjT>& fc) noexcept
+ CommonOptionFieldClass& operator=(const CommonOptionFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonFieldClass::operator=(fc);
return *this;
{
return ConstFieldClass {
internal::CommonOptionFieldClassSpec<const bt_field_class>::fieldClass(
- this->_libObjPtr())};
+ this->libObjPtr())};
}
_FieldClass fieldClass() noexcept
{
return _FieldClass {
- internal::CommonOptionFieldClassSpec<LibObjT>::fieldClass(this->_libObjPtr())};
+ internal::CommonOptionFieldClassSpec<LibObjT>::fieldClass(this->libObjPtr())};
}
Shared shared() const noexcept
{
- return Shared {*this};
+ return Shared::createWithRef(*this);
}
};
using OptionFieldClass = CommonOptionFieldClass<bt_field_class>;
using ConstOptionFieldClass = CommonOptionFieldClass<const bt_field_class>;
+namespace internal {
+
+struct OptionFieldClassTypeDescr
+{
+ using Const = ConstOptionFieldClass;
+ using NonConst = OptionFieldClass;
+};
+
+template <>
+struct TypeDescr<OptionFieldClass> : public OptionFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstOptionFieldClass> : public OptionFieldClassTypeDescr
+{
+};
+
+} /* namespace internal */
+
template <typename LibObjT>
class CommonOptionWithSelectorFieldClass : public CommonOptionFieldClass<LibObjT>
{
template <typename OtherLibObjT>
CommonOptionWithSelectorFieldClass(
- const CommonOptionWithSelectorFieldClass<OtherLibObjT>& fc) noexcept :
+ const CommonOptionWithSelectorFieldClass<OtherLibObjT> fc) noexcept :
_ThisCommonOptionFieldClass {fc}
{
}
template <typename OtherLibObjT>
- _ThisCommonOptionWithSelectorFieldClass&
- operator=(const CommonOptionWithSelectorFieldClass<OtherLibObjT>& fc) noexcept
+ CommonOptionWithSelectorFieldClass&
+ operator=(const CommonOptionWithSelectorFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonOptionFieldClass::operator=(fc);
return *this;
{
return ConstFieldPath {
bt_field_class_option_with_selector_field_borrow_selector_field_path_const(
- this->_libObjPtr())};
+ this->libObjPtr())};
}
Shared shared() const noexcept
{
- return Shared {*this};
+ return Shared::createWithRef(*this);
}
};
using OptionWithSelectorFieldClass = CommonOptionWithSelectorFieldClass<bt_field_class>;
using ConstOptionWithSelectorFieldClass = CommonOptionWithSelectorFieldClass<const bt_field_class>;
+namespace internal {
+
+struct OptionWithSelectorFieldClassTypeDescr
+{
+ using Const = ConstOptionWithSelectorFieldClass;
+ using NonConst = OptionWithSelectorFieldClass;
+};
+
+template <>
+struct TypeDescr<OptionWithSelectorFieldClass> : public OptionWithSelectorFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstOptionWithSelectorFieldClass> : public OptionWithSelectorFieldClassTypeDescr
+{
+};
+
+} /* namespace internal */
+
template <typename LibObjT>
class CommonOptionWithBoolSelectorFieldClass : public CommonOptionWithSelectorFieldClass<LibObjT>
{
template <typename OtherLibObjT>
CommonOptionWithBoolSelectorFieldClass(
- const CommonOptionWithBoolSelectorFieldClass<OtherLibObjT>& fc) noexcept :
+ const CommonOptionWithBoolSelectorFieldClass<OtherLibObjT> fc) noexcept :
_ThisCommonOptionWithSelectorFieldClass {fc}
{
}
template <typename OtherLibObjT>
- CommonOptionWithBoolSelectorFieldClass<LibObjT>&
- operator=(const CommonOptionWithBoolSelectorFieldClass<OtherLibObjT>& fc) noexcept
+ CommonOptionWithBoolSelectorFieldClass&
+ operator=(const CommonOptionWithBoolSelectorFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonOptionWithSelectorFieldClass::operator=(fc);
return *this;
bool selectorIsReversed() const noexcept
{
return bt_field_class_option_with_selector_field_bool_selector_is_reversed(
- this->_libObjPtr());
+ this->libObjPtr());
}
Shared shared() const noexcept
{
- return Shared {*this};
+ return Shared::createWithRef(*this);
}
};
namespace internal {
+struct OptionWithBoolSelectorFieldClassTypeDescr
+{
+ using Const = ConstOptionWithBoolSelectorFieldClass;
+ using NonConst = OptionWithBoolSelectorFieldClass;
+};
+
+template <>
+struct TypeDescr<OptionWithBoolSelectorFieldClass> :
+ public OptionWithBoolSelectorFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstOptionWithBoolSelectorFieldClass> :
+ public OptionWithBoolSelectorFieldClassTypeDescr
+{
+};
+
template <typename RangeSetT>
struct CommonOptionWithIntegerSelectorFieldClassSpec;
-// Functions specific to option field classes with unsigned integer ranges
+/* Functions specific to option field classes with unsigned integer ranges */
template <>
struct CommonOptionWithIntegerSelectorFieldClassSpec<ConstUnsignedIntegerRangeSet> final
{
}
};
-// Functions specific to option field classes with signed ranges
+/* Functions specific to option field classes with signed ranges */
template <>
struct CommonOptionWithIntegerSelectorFieldClassSpec<ConstSignedIntegerRangeSet> final
{
}
};
-} // namespace internal
+} /* namespace internal */
template <typename LibObjT, typename RangeSetT>
class CommonOptionWithIntegerSelectorFieldClass : public CommonOptionWithSelectorFieldClass<LibObjT>
template <typename OtherLibObjT>
CommonOptionWithIntegerSelectorFieldClass(
- const CommonOptionWithIntegerSelectorFieldClass<OtherLibObjT, RangeSetT>& fc) noexcept :
+ const CommonOptionWithIntegerSelectorFieldClass<OtherLibObjT, RangeSetT> fc) noexcept :
_ThisCommonOptionWithSelectorFieldClass {fc}
{
}
template <typename OtherLibObjT>
- _ThisCommonOptionWithIntegerSelectorFieldClass&
- operator=(const CommonOptionWithIntegerSelectorFieldClass<OtherLibObjT, RangeSetT>& fc) noexcept
+ CommonOptionWithIntegerSelectorFieldClass&
+ operator=(const CommonOptionWithIntegerSelectorFieldClass<OtherLibObjT, RangeSetT> fc) noexcept
{
_ThisCommonOptionWithSelectorFieldClass::operator=(fc);
return *this;
RangeSet ranges() const noexcept
{
return RangeSet {internal::CommonOptionWithIntegerSelectorFieldClassSpec<RangeSetT>::ranges(
- this->_libObjPtr())};
+ this->libObjPtr())};
}
Shared shared() const noexcept
{
- return Shared {*this};
+ return Shared::createWithRef(*this);
}
};
namespace internal {
+struct OptionWithUnsignedIntegerSelectorFieldClassTypeDescr
+{
+ using Const = ConstOptionWithUnsignedIntegerSelectorFieldClass;
+ using NonConst = OptionWithUnsignedIntegerSelectorFieldClass;
+};
+
+template <>
+struct TypeDescr<OptionWithUnsignedIntegerSelectorFieldClass> :
+ public OptionWithUnsignedIntegerSelectorFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstOptionWithUnsignedIntegerSelectorFieldClass> :
+ public OptionWithUnsignedIntegerSelectorFieldClassTypeDescr
+{
+};
+
+struct OptionWithSignedIntegerSelectorFieldClassTypeDescr
+{
+ using Const = ConstOptionWithSignedIntegerSelectorFieldClass;
+ using NonConst = OptionWithSignedIntegerSelectorFieldClass;
+};
+
+template <>
+struct TypeDescr<OptionWithSignedIntegerSelectorFieldClass> :
+ public OptionWithSignedIntegerSelectorFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstOptionWithSignedIntegerSelectorFieldClass> :
+ public OptionWithSignedIntegerSelectorFieldClassTypeDescr
+{
+};
+
template <typename LibObjT>
struct CommonVariantFieldClassOptionSpec;
-// Functions specific to mutable variant field class options
+/* Functions specific to mutable variant field class options */
template <>
struct CommonVariantFieldClassOptionSpec<bt_field_class_variant_option> final
{
{
return bt_field_class_variant_option_borrow_field_class(libObjPtr);
}
+
+ static bt_value *userAttributes(bt_field_class_variant_option * const libObjPtr) noexcept
+ {
+ return bt_field_class_variant_option_borrow_user_attributes(libObjPtr);
+ }
};
-// Functions specific to constant variant field class options
+/* Functions specific to constant variant field class options */
template <>
struct CommonVariantFieldClassOptionSpec<const bt_field_class_variant_option> final
{
{
return bt_field_class_variant_option_borrow_field_class_const(libObjPtr);
}
+
+ static const bt_value *
+ userAttributes(const bt_field_class_variant_option * const libObjPtr) noexcept
+ {
+ return bt_field_class_variant_option_borrow_user_attributes_const(libObjPtr);
+ }
};
-} // namespace internal
+} /* namespace internal */
template <typename LibObjT>
class CommonVariantFieldClassOption : public internal::BorrowedObj<LibObjT>
typename std::conditional<std::is_const<LibObjT>::value, ConstFieldClass, FieldClass>::type;
public:
+ using UserAttributes =
+ typename std::conditional<std::is_const<LibObjT>::value, ConstMapValue, MapValue>::type;
+
explicit CommonVariantFieldClassOption(const _LibObjPtr libObjPtr) noexcept :
_ThisBorrowedObj {libObjPtr}
{
}
template <typename OtherLibObjT>
- CommonVariantFieldClassOption(const CommonVariantFieldClassOption<OtherLibObjT>& fc) noexcept :
+ CommonVariantFieldClassOption(const CommonVariantFieldClassOption<OtherLibObjT> fc) noexcept :
_ThisBorrowedObj {fc}
{
}
template <typename OtherLibObjT>
- CommonVariantFieldClassOption<LibObjT>&
- operator=(const CommonVariantFieldClassOption<OtherLibObjT>& fc) noexcept
+ CommonVariantFieldClassOption&
+ operator=(const CommonVariantFieldClassOption<OtherLibObjT> fc) noexcept
{
_ThisBorrowedObj::operator=(fc);
return *this;
}
- bpstd::string_view name() const noexcept
+ nonstd::optional<bpstd::string_view> name() const noexcept
{
- return bt_field_class_variant_option_get_name(this->_libObjPtr());
+ const auto name = bt_field_class_variant_option_get_name(this->libObjPtr());
+
+ if (name) {
+ return name;
+ }
+
+ return nonstd::nullopt;
}
ConstFieldClass fieldClass() const noexcept
{
return ConstFieldClass {internal::CommonVariantFieldClassOptionSpec<
- const bt_field_class_variant_option>::fieldClass(this->_libObjPtr())};
+ const bt_field_class_variant_option>::fieldClass(this->libObjPtr())};
}
_FieldClass fieldClass() noexcept
{
return _FieldClass {
- internal::CommonVariantFieldClassOptionSpec<LibObjT>::fieldClass(this->_libObjPtr())};
+ internal::CommonVariantFieldClassOptionSpec<LibObjT>::fieldClass(this->libObjPtr())};
+ }
+
+ template <typename LibValT>
+ void userAttributes(const CommonMapValue<LibValT> userAttrs)
+ {
+ static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+
+ bt_field_class_variant_option_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr());
+ }
+
+ ConstMapValue userAttributes() const noexcept
+ {
+ return ConstMapValue {internal::CommonVariantFieldClassOptionSpec<
+ const bt_field_class_variant_option>::userAttributes(this->libObjPtr())};
+ }
+
+ UserAttributes userAttributes() noexcept
+ {
+ return UserAttributes {internal::CommonVariantFieldClassOptionSpec<LibObjT>::userAttributes(
+ this->libObjPtr())};
}
};
namespace internal {
+struct VariantFieldClassOptionTypeDescr
+{
+ using Const = ConstVariantFieldClassOption;
+ using NonConst = VariantFieldClassOption;
+};
+
+template <>
+struct TypeDescr<VariantFieldClassOption> : public VariantFieldClassOptionTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstVariantFieldClassOption> : public VariantFieldClassOptionTypeDescr
+{
+};
+
template <typename LibObjT>
struct ConstVariantWithIntegerSelectorFieldClassOptionSpec;
-// Functions specific to variant field class options with unsigned integer selector
+/* Functions specific to variant field class options with unsigned integer selector */
template <>
struct ConstVariantWithIntegerSelectorFieldClassOptionSpec<
const bt_field_class_variant_with_selector_field_integer_unsigned_option>
}
};
-// Functions specific to variant field class options with signed integer selector
+/* Functions specific to variant field class options with signed integer selector */
template <>
struct ConstVariantWithIntegerSelectorFieldClassOptionSpec<
const bt_field_class_variant_with_selector_field_integer_signed_option>
}
};
-} // namespace internal
+} /* namespace internal */
template <typename LibObjT>
class ConstVariantWithIntegerSelectorFieldClassOption : public internal::BorrowedObj<LibObjT>
template <typename OtherLibObjT>
ConstVariantWithIntegerSelectorFieldClassOption(
- const ConstVariantWithIntegerSelectorFieldClassOption<OtherLibObjT>& fc) noexcept :
+ const ConstVariantWithIntegerSelectorFieldClassOption<OtherLibObjT> fc) noexcept :
_ThisBorrowedObj {fc}
{
}
template <typename OtherLibObjT>
- ConstVariantWithIntegerSelectorFieldClassOption<LibObjT>&
- operator=(const ConstVariantWithIntegerSelectorFieldClassOption<OtherLibObjT>& fc) noexcept
+ ConstVariantWithIntegerSelectorFieldClassOption&
+ operator=(const ConstVariantWithIntegerSelectorFieldClassOption<OtherLibObjT> fc) noexcept
{
_ThisBorrowedObj::operator=(fc);
return *this;
ConstVariantFieldClassOption asBaseOption() const noexcept
{
- return ConstVariantFieldClassOption {_Spec::asBaseOption(this->_libObjPtr())};
+ return ConstVariantFieldClassOption {_Spec::asBaseOption(this->libObjPtr())};
}
- bpstd::string_view name() const noexcept
+ nonstd::optional<bpstd::string_view> name() const noexcept
{
return this->asBaseOption().name();
}
RangeSet ranges() const noexcept
{
- return RangeSet {_Spec::ranges(this->_libObjPtr())};
+ return RangeSet {_Spec::ranges(this->libObjPtr())};
}
};
template <typename LibObjT>
struct CommonVariantFieldClassSpec;
-// Functions specific to mutable variant field classes
+/* Functions specific to mutable variant field classes */
template <>
struct CommonVariantFieldClassSpec<bt_field_class> final
{
}
};
-// Functions specific to constant variant field classes
+/* Functions specific to constant variant field classes */
template <>
struct CommonVariantFieldClassSpec<const bt_field_class> final
{
}
};
-} // namespace internal
+} /* namespace internal */
template <typename LibObjT>
class CommonVariantFieldClass : public CommonFieldClass<LibObjT>
typename std::conditional<std::is_const<LibObjT>::value, ConstVariantFieldClassOption,
VariantFieldClassOption>::type;
+ using Iterator = CommonIterator<CommonVariantFieldClass, Option>;
+
explicit CommonVariantFieldClass(const _LibObjPtr libObjPtr) noexcept :
_ThisCommonFieldClass {libObjPtr}
{
}
template <typename OtherLibObjT>
- CommonVariantFieldClass(const CommonVariantFieldClass<OtherLibObjT>& fc) noexcept :
+ CommonVariantFieldClass(const CommonVariantFieldClass<OtherLibObjT> fc) noexcept :
_ThisCommonFieldClass {fc}
{
}
template <typename OtherLibObjT>
- _ThisCommonVariantFieldClass&
- operator=(const CommonVariantFieldClass<OtherLibObjT>& fc) noexcept
+ CommonVariantFieldClass& operator=(const CommonVariantFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonFieldClass::operator=(fc);
return *this;
std::uint64_t size() const noexcept
{
- return bt_field_class_variant_get_option_count(this->_libObjPtr());
+ return bt_field_class_variant_get_option_count(this->libObjPtr());
+ }
+
+ Iterator begin() const noexcept
+ {
+ return Iterator {*this, 0};
+ }
+
+ Iterator end() const noexcept
+ {
+ return Iterator {*this, this->size()};
}
ConstVariantFieldClassOption operator[](const std::uint64_t index) const noexcept
{
return ConstVariantFieldClassOption {
internal::CommonVariantFieldClassSpec<const bt_field_class>::optionByIndex(
- this->_libObjPtr(), index)};
+ this->libObjPtr(), index)};
}
Option operator[](const std::uint64_t index) noexcept
{
return Option {internal::CommonVariantFieldClassSpec<LibObjT>::optionByIndex(
- this->_libObjPtr(), index)};
+ this->libObjPtr(), index)};
}
nonstd::optional<ConstVariantFieldClassOption>
{
const auto libObjPtr =
internal::CommonVariantFieldClassSpec<const bt_field_class>::optionByName(
- this->_libObjPtr(), name);
+ this->libObjPtr(), name);
if (libObjPtr) {
return ConstVariantFieldClassOption {libObjPtr};
nonstd::optional<Option> operator[](const char * const name) noexcept
{
const auto libObjPtr =
- internal::CommonVariantFieldClassSpec<LibObjT>::optionByName(this->_libObjPtr(), name);
+ internal::CommonVariantFieldClassSpec<LibObjT>::optionByName(this->libObjPtr(), name);
if (libObjPtr) {
return Option {libObjPtr};
Shared shared() const noexcept
{
- return Shared {*this};
+ return Shared::createWithRef(*this);
}
};
using VariantFieldClass = CommonVariantFieldClass<bt_field_class>;
using ConstVariantFieldClass = CommonVariantFieldClass<const bt_field_class>;
+namespace internal {
+
+struct VariantFieldClassTypeDescr
+{
+ using Const = ConstVariantFieldClass;
+ using NonConst = VariantFieldClass;
+};
+
+template <>
+struct TypeDescr<VariantFieldClass> : public VariantFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstVariantFieldClass> : public VariantFieldClassTypeDescr
+{
+};
+
+} /* namespace internal */
+
template <typename LibObjT>
class CommonVariantWithoutSelectorFieldClass : public CommonVariantFieldClass<LibObjT>
{
template <typename OtherLibObjT>
CommonVariantWithoutSelectorFieldClass(
- const CommonVariantWithoutSelectorFieldClass<OtherLibObjT>& fc) noexcept :
+ const CommonVariantWithoutSelectorFieldClass<OtherLibObjT> fc) noexcept :
_ThisCommonVariantFieldClass {fc}
{
}
template <typename OtherLibObjT>
- CommonVariantWithoutSelectorFieldClass<LibObjT>&
- operator=(const CommonVariantWithoutSelectorFieldClass<OtherLibObjT>& fc) noexcept
+ CommonVariantWithoutSelectorFieldClass&
+ operator=(const CommonVariantWithoutSelectorFieldClass<OtherLibObjT> fc) noexcept
{
_ThisCommonVariantFieldClass::operator=(fc);
return *this;
}
- void appendOption(const char * const name, const FieldClass& fc)
+ void appendOption(const char * const name, const FieldClass fc)
{
static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
const auto status = bt_field_class_variant_without_selector_append_option(
- this->_libObjPtr(), name, fc._libObjPtr());
+ this->libObjPtr(), name, fc.libObjPtr());
if (status ==
BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR) {
- throw LibMemoryError {};
+ throw MemoryError {};
}
}
- void appendOption(const std::string& name, const FieldClass& fc)
+ void appendOption(const nonstd::optional<std::string>& name, const FieldClass fc)
{
- this->appendOption(name.data(), fc);
+ this->appendOption(name ? name->data() : nullptr, fc);
}
Shared shared() const noexcept
{
- return Shared {*this};
+ return Shared::createWithRef(*this);
}
};
namespace internal {
+struct VariantWithoutSelectorFieldClassTypeDescr
+{
+ using Const = ConstVariantWithoutSelectorFieldClass;
+ using NonConst = VariantWithoutSelectorFieldClass;
+};
+
+template <>
+struct TypeDescr<VariantWithoutSelectorFieldClass> :
+ public VariantWithoutSelectorFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstVariantWithoutSelectorFieldClass> :
+ public VariantWithoutSelectorFieldClassTypeDescr
+{
+};
+
template <typename OptionT>
struct CommonVariantWithIntegerSelectorFieldClassSpec;
-// Functions specific to variant field classes with unsigned integer selector
+/* Functions specific to variant field classes with unsigned integer selector */
template <>
struct CommonVariantWithIntegerSelectorFieldClassSpec<
ConstVariantWithUnsignedIntegerSelectorFieldClassOption>
}
};
-// Functions specific to variant field classes with signed integer selector
+/* Functions specific to variant field classes with signed integer selector */
template <>
struct CommonVariantWithIntegerSelectorFieldClassSpec<
ConstVariantWithSignedIntegerSelectorFieldClassOption>
}
};
-} // namespace internal
+} /* namespace internal */
-template <typename LibObjT, typename OptionT>
-class CommonVariantWithIntegerSelectorFieldClass : public CommonVariantFieldClass<LibObjT>
+template <typename LibObjT>
+class CommonVariantWithSelectorFieldClass : public CommonVariantFieldClass<LibObjT>
{
private:
using typename CommonVariantFieldClass<LibObjT>::_ThisCommonVariantFieldClass;
+
+protected:
using typename CommonFieldClass<LibObjT>::_LibObjPtr;
+ using _ThisCommonVariantWithSelectorFieldClass = CommonVariantWithSelectorFieldClass<LibObjT>;
+
+public:
+ using Shared = internal::SharedFieldClass<_ThisCommonVariantWithSelectorFieldClass, LibObjT>;
+
+ explicit CommonVariantWithSelectorFieldClass(const _LibObjPtr libObjPtr) noexcept :
+ _ThisCommonVariantFieldClass {libObjPtr}
+ {
+ BT_ASSERT_DBG(this->isVariantWithSelector());
+ }
+
+ template <typename OtherLibObjT>
+ CommonVariantWithSelectorFieldClass(
+ const CommonVariantWithSelectorFieldClass<OtherLibObjT> fc) noexcept :
+ _ThisCommonVariantFieldClass {fc}
+ {
+ }
+
+ template <typename OtherLibObjT>
+ CommonVariantWithSelectorFieldClass&
+ operator=(const CommonVariantWithSelectorFieldClass<OtherLibObjT> fc) noexcept
+ {
+ _ThisCommonVariantFieldClass::operator=(fc);
+ return *this;
+ }
+
+ ConstFieldPath selectorFieldPath() const noexcept
+ {
+ return ConstFieldPath {
+ bt_field_class_variant_with_selector_field_borrow_selector_field_path_const(
+ this->libObjPtr())};
+ }
+ Shared shared() const noexcept
+ {
+ return Shared::createWithRef(*this);
+ }
+};
+
+using VariantWithSelectorFieldClass = CommonVariantWithSelectorFieldClass<bt_field_class>;
+using ConstVariantWithSelectorFieldClass =
+ CommonVariantWithSelectorFieldClass<const bt_field_class>;
+
+template <typename LibObjT, typename OptionT>
+class CommonVariantWithIntegerSelectorFieldClass :
+ public CommonVariantWithSelectorFieldClass<LibObjT>
+{
+private:
+ using typename CommonVariantWithSelectorFieldClass<
+ LibObjT>::_ThisCommonVariantWithSelectorFieldClass;
+ using typename CommonFieldClass<LibObjT>::_LibObjPtr;
using _ThisCommonVariantWithIntegerSelectorFieldClass =
CommonVariantWithIntegerSelectorFieldClass<LibObjT, OptionT>;
internal::SharedFieldClass<_ThisCommonVariantWithIntegerSelectorFieldClass, LibObjT>;
using Option = OptionT;
+ using Iterator =
+ CommonIterator<CommonVariantWithIntegerSelectorFieldClass<LibObjT, Option>, Option>;
explicit CommonVariantWithIntegerSelectorFieldClass(const _LibObjPtr libObjPtr) noexcept :
- _ThisCommonVariantFieldClass {libObjPtr}
+ _ThisCommonVariantWithSelectorFieldClass {libObjPtr}
{
BT_ASSERT_DBG(this->isVariant());
}
template <typename OtherLibObjT>
CommonVariantWithIntegerSelectorFieldClass(
- const CommonVariantWithIntegerSelectorFieldClass<OtherLibObjT, OptionT>& fc) noexcept :
- _ThisCommonVariantFieldClass {fc}
+ const CommonVariantWithIntegerSelectorFieldClass<OtherLibObjT, OptionT> fc) noexcept :
+ _ThisCommonVariantWithSelectorFieldClass {fc}
{
}
template <typename OtherLibObjT>
- _ThisCommonVariantWithIntegerSelectorFieldClass&
- operator=(const CommonVariantWithIntegerSelectorFieldClass<OtherLibObjT, OptionT>& fc) noexcept
+ CommonVariantWithIntegerSelectorFieldClass&
+ operator=(const CommonVariantWithIntegerSelectorFieldClass<OtherLibObjT, OptionT> fc) noexcept
{
- _ThisCommonVariantFieldClass::operator=(fc);
+ _ThisCommonVariantWithSelectorFieldClass::operator=(fc);
return *this;
}
- ConstFieldPath selectorFieldPath() const noexcept
- {
- return ConstFieldPath {
- bt_field_class_option_with_selector_field_borrow_selector_field_path_const(
- this->_libObjPtr())};
- }
-
Option operator[](const std::uint64_t index) const noexcept
{
- return Option {_Spec::optionByIndex(this->_libObjPtr(), index)};
+ return Option {_Spec::optionByIndex(this->libObjPtr(), index)};
}
nonstd::optional<Option> operator[](const char * const name) const noexcept
{
- const auto libObjPtr = _Spec::optionByName(this->_libObjPtr(), name);
+ const auto libObjPtr = _Spec::optionByName(this->libObjPtr(), name);
if (libObjPtr) {
return Option {libObjPtr};
return (*this)[name.data()];
}
- void appendOption(const char * const name, const FieldClass& fc,
- const typename Option::RangeSet& ranges)
+ void appendOption(const char * const name, const FieldClass fc,
+ const typename Option::RangeSet ranges)
{
static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
const auto status =
- _Spec::appendOption(this->_libObjPtr(), name, fc._libObjPtr(), ranges._libObjPtr());
+ _Spec::appendOption(this->libObjPtr(), name, fc.libObjPtr(), ranges.libObjPtr());
if (status ==
BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR) {
- throw LibMemoryError {};
+ throw MemoryError {};
}
}
- void appendOption(const std::string& name, const FieldClass& fc)
+ void appendOption(const nonstd::optional<std::string>& name, const FieldClass fc,
+ const typename Option::RangeSet ranges)
+ {
+ this->appendOption(name ? name->data() : nullptr, fc, ranges);
+ }
+
+ Iterator begin() const noexcept
{
- this->appendOption(name.data(), fc);
+ return Iterator {*this, 0};
+ }
+
+ Iterator end() const noexcept
+ {
+ return Iterator {*this, this->size()};
}
Shared shared() const noexcept
{
- return Shared {*this};
+ return Shared::createWithRef(*this);
}
};
using ConstVariantWithSignedIntegerSelectorFieldClass = CommonVariantWithIntegerSelectorFieldClass<
const bt_field_class, ConstVariantWithSignedIntegerSelectorFieldClassOption>;
+namespace internal {
+
+struct VariantWithUnsignedIntegerSelectorFieldClassTypeDescr
+{
+ using Const = ConstVariantWithUnsignedIntegerSelectorFieldClass;
+ using NonConst = VariantWithUnsignedIntegerSelectorFieldClass;
+};
+
+template <>
+struct TypeDescr<VariantWithUnsignedIntegerSelectorFieldClass> :
+ public VariantWithUnsignedIntegerSelectorFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstVariantWithUnsignedIntegerSelectorFieldClass> :
+ public VariantWithUnsignedIntegerSelectorFieldClassTypeDescr
+{
+};
+
+struct VariantWithSignedIntegerSelectorFieldClassTypeDescr
+{
+ using Const = ConstVariantWithSignedIntegerSelectorFieldClass;
+ using NonConst = VariantWithSignedIntegerSelectorFieldClass;
+};
+
+template <>
+struct TypeDescr<VariantWithSignedIntegerSelectorFieldClass> :
+ public VariantWithSignedIntegerSelectorFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstVariantWithSignedIntegerSelectorFieldClass> :
+ public VariantWithSignedIntegerSelectorFieldClassTypeDescr
+{
+};
+
+} /* namespace internal */
+
template <typename LibObjT>
CommonBitArrayFieldClass<LibObjT> CommonFieldClass<LibObjT>::asBitArray() const noexcept
{
BT_ASSERT_DBG(this->isBitArray());
- return CommonBitArrayFieldClass<LibObjT> {this->_libObjPtr()};
+ return CommonBitArrayFieldClass<LibObjT> {this->libObjPtr()};
}
template <typename LibObjT>
CommonIntegerFieldClass<LibObjT> CommonFieldClass<LibObjT>::asInteger() const noexcept
{
BT_ASSERT_DBG(this->isInteger());
- return CommonIntegerFieldClass<LibObjT> {this->_libObjPtr()};
+ return CommonIntegerFieldClass<LibObjT> {this->libObjPtr()};
+}
+
+template <typename LibObjT>
+CommonBaseEnumerationFieldClass<LibObjT> CommonFieldClass<LibObjT>::asEnumeration() const noexcept
+{
+ BT_ASSERT_DBG(this->isEnumeration());
+ return CommonBaseEnumerationFieldClass<LibObjT> {this->libObjPtr()};
}
template <typename LibObjT>
{
BT_ASSERT_DBG(this->isUnsignedEnumeration());
return CommonEnumerationFieldClass<LibObjT, ConstUnsignedEnumerationFieldClassMapping> {
- this->_libObjPtr()};
+ this->libObjPtr()};
}
template <typename LibObjT>
{
BT_ASSERT_DBG(this->isSignedEnumeration());
return CommonEnumerationFieldClass<LibObjT, ConstSignedEnumerationFieldClassMapping> {
- this->_libObjPtr()};
+ this->libObjPtr()};
}
template <typename LibObjT>
CommonStructureFieldClass<LibObjT> CommonFieldClass<LibObjT>::asStructure() const noexcept
{
BT_ASSERT_DBG(this->isStructure());
- return CommonStructureFieldClass<LibObjT> {this->_libObjPtr()};
+ return CommonStructureFieldClass<LibObjT> {this->libObjPtr()};
}
template <typename LibObjT>
CommonArrayFieldClass<LibObjT> CommonFieldClass<LibObjT>::asArray() const noexcept
{
BT_ASSERT_DBG(this->isArray());
- return CommonArrayFieldClass<LibObjT> {this->_libObjPtr()};
+ return CommonArrayFieldClass<LibObjT> {this->libObjPtr()};
}
template <typename LibObjT>
CommonStaticArrayFieldClass<LibObjT> CommonFieldClass<LibObjT>::asStaticArray() const noexcept
{
BT_ASSERT_DBG(this->isStaticArray());
- return CommonStaticArrayFieldClass<LibObjT> {this->_libObjPtr()};
+ return CommonStaticArrayFieldClass<LibObjT> {this->libObjPtr()};
}
template <typename LibObjT>
CommonFieldClass<LibObjT>::asDynamicArrayWithLength() const noexcept
{
BT_ASSERT_DBG(this->isDynamicArrayWithLength());
- return CommonDynamicArrayWithLengthFieldClass<LibObjT> {this->_libObjPtr()};
+ return CommonDynamicArrayWithLengthFieldClass<LibObjT> {this->libObjPtr()};
}
template <typename LibObjT>
CommonOptionFieldClass<LibObjT> CommonFieldClass<LibObjT>::asOption() const noexcept
{
BT_ASSERT_DBG(this->isOption());
- return CommonOptionFieldClass<LibObjT> {this->_libObjPtr()};
+ return CommonOptionFieldClass<LibObjT> {this->libObjPtr()};
}
template <typename LibObjT>
CommonFieldClass<LibObjT>::asOptionWithSelector() const noexcept
{
BT_ASSERT_DBG(this->isOptionWithSelector());
- return CommonOptionWithSelectorFieldClass<LibObjT> {this->_libObjPtr()};
+ return CommonOptionWithSelectorFieldClass<LibObjT> {this->libObjPtr()};
}
template <typename LibObjT>
CommonFieldClass<LibObjT>::asOptionWithBoolSelector() const noexcept
{
BT_ASSERT_DBG(this->isOptionWithBoolSelector());
- return CommonOptionWithBoolSelectorFieldClass<LibObjT> {this->_libObjPtr()};
+ return CommonOptionWithBoolSelectorFieldClass<LibObjT> {this->libObjPtr()};
}
template <typename LibObjT>
{
BT_ASSERT_DBG(this->isOptionWithUnsignedIntegerSelector());
return CommonOptionWithIntegerSelectorFieldClass<LibObjT, ConstUnsignedIntegerRangeSet> {
- this->_libObjPtr()};
+ this->libObjPtr()};
}
template <typename LibObjT>
{
BT_ASSERT_DBG(this->isOptionWithSignedIntegerSelector());
return CommonOptionWithIntegerSelectorFieldClass<LibObjT, ConstSignedIntegerRangeSet> {
- this->_libObjPtr()};
+ this->libObjPtr()};
}
template <typename LibObjT>
CommonVariantFieldClass<LibObjT> CommonFieldClass<LibObjT>::asVariant() const noexcept
{
BT_ASSERT_DBG(this->isVariant());
- return CommonVariantFieldClass<LibObjT> {this->_libObjPtr()};
+ return CommonVariantFieldClass<LibObjT> {this->libObjPtr()};
}
template <typename LibObjT>
CommonFieldClass<LibObjT>::asVariantWithoutSelector() const noexcept
{
BT_ASSERT_DBG(this->isVariantWithoutSelector());
- return CommonVariantWithoutSelectorFieldClass<LibObjT> {this->_libObjPtr()};
+ return CommonVariantWithoutSelectorFieldClass<LibObjT> {this->libObjPtr()};
+}
+
+template <typename LibObjT>
+CommonVariantWithSelectorFieldClass<LibObjT>
+CommonFieldClass<LibObjT>::asVariantWithSelector() const noexcept
+{
+ BT_ASSERT_DBG(this->isVariantWithSelector());
+ return CommonVariantWithSelectorFieldClass<LibObjT> {this->libObjPtr()};
}
template <typename LibObjT>
{
BT_ASSERT_DBG(this->isVariantWithUnsignedIntegerSelector());
return CommonVariantWithIntegerSelectorFieldClass<
- LibObjT, ConstVariantWithUnsignedIntegerSelectorFieldClassOption> {this->_libObjPtr()};
+ LibObjT, ConstVariantWithUnsignedIntegerSelectorFieldClassOption> {this->libObjPtr()};
}
template <typename LibObjT>
{
BT_ASSERT_DBG(this->isVariantWithSignedIntegerSelector());
return CommonVariantWithIntegerSelectorFieldClass<
- LibObjT, ConstVariantWithSignedIntegerSelectorFieldClassOption> {this->_libObjPtr()};
+ LibObjT, ConstVariantWithSignedIntegerSelectorFieldClassOption> {this->libObjPtr()};
}
-} // namespace bt2
+} /* namespace bt2 */
-#endif // BABELTRACE_CPP_COMMON_BT2_FIELD_CLASS_HPP
+#endif /* BABELTRACE_CPP_COMMON_BT2_FIELD_CLASS_HPP */