#include <babeltrace2/babeltrace.h>
#include "cpp-common/optional.hpp"
-#include "cpp-common/string_view.hpp"
#include "borrowed-object.hpp"
#include "clock-class.hpp"
#include "field-class.hpp"
#include "field.hpp"
#include "internal/utils.hpp"
-#include "shared-obj.hpp"
+#include "shared-object.hpp"
#include "value.hpp"
namespace bt2 {
}
};
+template <typename LibObjT>
+using DepStructField = DepType<LibObjT, StructureField, ConstStructureField>;
+
} /* namespace internal */
template <typename LibObjT>
private:
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
using typename BorrowedObject<LibObjT>::_LibObjPtr;
- using _ConstSpec = internal::CommonEventSpec<const bt_event>;
using _Spec = internal::CommonEventSpec<LibObjT>;
-
- using _Packet =
- typename std::conditional<std::is_const<LibObjT>::value, CommonPacket<const bt_packet>,
- CommonPacket<bt_packet>>::type;
-
- using _Stream =
- typename std::conditional<std::is_const<LibObjT>::value, CommonStream<const bt_stream>,
- CommonStream<bt_stream>>::type;
-
- using _StructureField = typename std::conditional<std::is_const<LibObjT>::value,
- ConstStructureField, StructureField>::type;
+ using _Packet = internal::DepPacket<LibObjT>;
+ using _Stream = internal::DepStream<LibObjT>;
+ using _StructureField = internal::DepStructField<LibObjT>;
public:
- using Class = typename std::conditional<std::is_const<LibObjT>::value,
- CommonEventClass<const bt_event_class>,
- CommonEventClass<bt_event_class>>::type;
+ using Class = internal::DepType<LibObjT, CommonEventClass<bt_event_class>,
+ CommonEventClass<const bt_event_class>>;
explicit CommonEvent(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr}
{
}
template <typename OtherLibObjT>
- CommonEvent<LibObjT>& operator=(const CommonEvent<OtherLibObjT> event) noexcept
+ CommonEvent<LibObjT> operator=(const CommonEvent<OtherLibObjT> event) noexcept
{
_ThisBorrowedObject::operator=(event);
return *this;
}
- CommonEventClass<const bt_event_class> cls() const noexcept;
- Class cls() noexcept;
- CommonStream<const bt_stream> stream() const noexcept;
- _Stream stream() noexcept;
- nonstd::optional<CommonPacket<const bt_packet>> packet() const noexcept;
- nonstd::optional<_Packet> packet() noexcept;
-
- nonstd::optional<ConstStructureField> payloadField() const noexcept
+ CommonEvent<const bt_event> asConst() const noexcept
{
- const auto libObjPtr = _ConstSpec::payloadField(this->libObjPtr());
-
- if (libObjPtr) {
- return ConstStructureField {libObjPtr};
- }
-
- return nonstd::nullopt;
+ return CommonEvent<const bt_event> {*this};
}
- nonstd::optional<_StructureField> payloadField() noexcept
+ Class cls() const noexcept;
+ _Stream stream() const noexcept;
+ nonstd::optional<_Packet> packet() const noexcept;
+
+ nonstd::optional<_StructureField> payloadField() const noexcept
{
const auto libObjPtr = _Spec::payloadField(this->libObjPtr());
return nonstd::nullopt;
}
- nonstd::optional<ConstStructureField> specificContextField() const noexcept
- {
- const auto libObjPtr = _ConstSpec::specificContextField(this->libObjPtr());
-
- if (libObjPtr) {
- return ConstStructureField {libObjPtr};
- }
-
- return nonstd::nullopt;
- }
-
- nonstd::optional<_StructureField> specificContextField() noexcept
+ nonstd::optional<_StructureField> specificContextField() const noexcept
{
const auto libObjPtr = _Spec::specificContextField(this->libObjPtr());
return nonstd::nullopt;
}
- nonstd::optional<ConstStructureField> commonContextField() const noexcept
- {
- const auto libObjPtr = _ConstSpec::commonContextField(this->libObjPtr());
-
- if (libObjPtr) {
- return ConstStructureField {libObjPtr};
- }
-
- return nonstd::nullopt;
- }
-
- nonstd::optional<_StructureField> commonContextField() noexcept
+ nonstd::optional<_StructureField> commonContextField() const noexcept
{
const auto libObjPtr = _Spec::commonContextField(this->libObjPtr());
struct PacketRefFuncs final
{
- static void get(const bt_packet * const libObjPtr)
+ static void get(const bt_packet * const libObjPtr) noexcept
{
bt_packet_get_ref(libObjPtr);
}
- static void put(const bt_packet * const libObjPtr)
+ static void put(const bt_packet * const libObjPtr) noexcept
{
bt_packet_put_ref(libObjPtr);
}
private:
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
using typename BorrowedObject<LibObjT>::_LibObjPtr;
- using _ConstSpec = internal::CommonPacketSpec<const bt_packet>;
using _Spec = internal::CommonPacketSpec<LibObjT>;
- using _ThisCommonPacket = CommonPacket<LibObjT>;
-
- using _Stream =
- typename std::conditional<std::is_const<LibObjT>::value, CommonStream<const bt_stream>,
- CommonStream<bt_stream>>::type;
-
- using _StructureField = typename std::conditional<std::is_const<LibObjT>::value,
- ConstStructureField, StructureField>::type;
+ using _Stream = internal::DepStream<LibObjT>;
+ using _StructureField = internal::DepStructField<LibObjT>;
public:
- using Shared = SharedObj<_ThisCommonPacket, LibObjT, internal::PacketRefFuncs>;
+ using Shared = SharedObject<CommonPacket, LibObjT, internal::PacketRefFuncs>;
explicit CommonPacket(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr}
{
}
template <typename OtherLibObjT>
- _ThisCommonPacket& operator=(const CommonPacket<OtherLibObjT> packet) noexcept
+ CommonPacket operator=(const CommonPacket<OtherLibObjT> packet) noexcept
{
_ThisBorrowedObject::operator=(packet);
return *this;
}
- CommonStream<const bt_stream> stream() const noexcept;
- _Stream stream() noexcept;
-
- nonstd::optional<ConstStructureField> contextField() const noexcept
+ CommonPacket<const bt_packet> asConst() const noexcept
{
- const auto libObjPtr = _ConstSpec::contextField(this->libObjPtr());
-
- if (libObjPtr) {
- return ConstStructureField {libObjPtr};
- }
-
- return nonstd::nullopt;
+ return CommonPacket<const bt_packet> {*this};
}
- nonstd::optional<_StructureField> contextField() noexcept
+ _Stream stream() const noexcept;
+
+ nonstd::optional<_StructureField> contextField() const noexcept
{
const auto libObjPtr = _Spec::contextField(this->libObjPtr());
} /* namespace internal */
template <typename LibObjT>
-nonstd::optional<ConstPacket> CommonEvent<LibObjT>::packet() const noexcept
-{
- const auto libObjPtr = _ConstSpec::packet(this->libObjPtr());
-
- if (libObjPtr) {
- return ConstPacket {libObjPtr};
- }
-
- return nonstd::nullopt;
-}
-
-template <typename LibObjT>
-nonstd::optional<typename CommonEvent<LibObjT>::_Packet> CommonEvent<LibObjT>::packet() noexcept
+nonstd::optional<typename CommonEvent<LibObjT>::_Packet>
+CommonEvent<LibObjT>::packet() const noexcept
{
const auto libObjPtr = _Spec::packet(this->libObjPtr());
struct StreamRefFuncs final
{
- static void get(const bt_stream * const libObjPtr)
+ static void get(const bt_stream * const libObjPtr) noexcept
{
bt_stream_get_ref(libObjPtr);
}
- static void put(const bt_stream * const libObjPtr)
+ static void put(const bt_stream * const libObjPtr) noexcept
{
bt_stream_put_ref(libObjPtr);
}
private:
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
using typename BorrowedObject<LibObjT>::_LibObjPtr;
- using _ConstSpec = internal::CommonStreamSpec<const bt_stream>;
using _Spec = internal::CommonStreamSpec<LibObjT>;
- using _ThisCommonStream = CommonStream<LibObjT>;
-
- using _Trace =
- typename std::conditional<std::is_const<LibObjT>::value, CommonTrace<const bt_trace>,
- CommonTrace<bt_trace>>::type;
+ using _Trace = internal::DepType<LibObjT, CommonTrace<bt_trace>, CommonTrace<const bt_trace>>;
public:
- using Shared = SharedObj<_ThisCommonStream, LibObjT, internal::StreamRefFuncs>;
-
- using Class = typename std::conditional<std::is_const<LibObjT>::value,
- CommonStreamClass<const bt_stream_class>,
- CommonStreamClass<bt_stream_class>>::type;
+ using Shared = SharedObject<CommonStream, LibObjT, internal::StreamRefFuncs>;
+ using UserAttributes = internal::DepUserAttrs<LibObjT>;
- using UserAttributes =
- typename std::conditional<std::is_const<LibObjT>::value, ConstMapValue, MapValue>::type;
+ using Class = internal::DepType<LibObjT, CommonStreamClass<bt_stream_class>,
+ CommonStreamClass<const bt_stream_class>>;
explicit CommonStream(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr}
{
}
template <typename OtherLibObjT>
- _ThisCommonStream& operator=(const CommonStream<OtherLibObjT> stream) noexcept
+ CommonStream operator=(const CommonStream<OtherLibObjT> stream) noexcept
{
_ThisBorrowedObject::operator=(stream);
return *this;
}
- Packet::Shared createPacket()
+ CommonStream<const bt_stream> asConst() const noexcept
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ return CommonStream<const bt_stream> {*this};
+ }
+
+ Packet::Shared createPacket() const
+ {
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstStream`.");
const auto libObjPtr = bt_packet_create(this->libObjPtr());
return Packet::Shared::createWithoutRef(libObjPtr);
}
- CommonStreamClass<const bt_stream_class> cls() const noexcept;
- Class cls() noexcept;
- CommonTrace<const bt_trace> trace() const noexcept;
- _Trace trace() noexcept;
+ Class cls() const noexcept;
+ _Trace trace() const noexcept;
std::uint64_t id() const noexcept
{
return bt_stream_get_id(this->libObjPtr());
}
- void name(const char * const name)
+ void name(const char * const name) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstStream`.");
const auto status = bt_stream_set_name(this->libObjPtr(), name);
}
}
- void name(const std::string& name)
+ void name(const std::string& name) const
{
this->name(name.data());
}
- nonstd::optional<bpstd::string_view> name() const noexcept
+ const char *name() const noexcept
{
- const auto name = bt_stream_get_name(this->libObjPtr());
-
- if (name) {
- return name;
- }
-
- return nonstd::nullopt;
+ return bt_stream_get_name(this->libObjPtr());
}
template <typename LibValT>
- void userAttributes(const CommonMapValue<LibValT> userAttrs)
+ void userAttributes(const CommonMapValue<LibValT> userAttrs) const noexcept
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstStream`.");
bt_stream_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr());
}
- ConstMapValue userAttributes() const noexcept
- {
- return ConstMapValue {_ConstSpec::userAttributes(this->libObjPtr())};
- }
-
- UserAttributes userAttributes() noexcept
+ UserAttributes userAttributes() const noexcept
{
return UserAttributes {_Spec::userAttributes(this->libObjPtr())};
}
} /* namespace internal */
template <typename LibObjT>
-ConstStream CommonEvent<LibObjT>::stream() const noexcept
-{
- return ConstStream {_ConstSpec::stream(this->libObjPtr())};
-}
-
-template <typename LibObjT>
-typename CommonEvent<LibObjT>::_Stream CommonEvent<LibObjT>::stream() noexcept
+typename CommonEvent<LibObjT>::_Stream CommonEvent<LibObjT>::stream() const noexcept
{
return _Stream {_Spec::stream(this->libObjPtr())};
}
template <typename LibObjT>
-ConstStream CommonPacket<LibObjT>::stream() const noexcept
-{
- return ConstStream {_ConstSpec::stream(this->libObjPtr())};
-}
-
-template <typename LibObjT>
-typename CommonPacket<LibObjT>::_Stream CommonPacket<LibObjT>::stream() noexcept
+typename CommonPacket<LibObjT>::_Stream CommonPacket<LibObjT>::stream() const noexcept
{
return _Stream {_Spec::stream(this->libObjPtr())};
}
struct TraceRefFuncs final
{
- static void get(const bt_trace * const libObjPtr)
+ static void get(const bt_trace * const libObjPtr) noexcept
{
bt_trace_get_ref(libObjPtr);
}
- static void put(const bt_trace * const libObjPtr)
+ static void put(const bt_trace * const libObjPtr) noexcept
{
bt_trace_put_ref(libObjPtr);
}
template <typename LibObjT>
class CommonTrace final : public BorrowedObject<LibObjT>
{
- /* Allow instantiate() to call `trace.libObjPtr()` */
- friend class CommonStreamClass<bt_stream_class>;
-
private:
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
using typename BorrowedObject<LibObjT>::_LibObjPtr;
- using _ConstSpec = internal::CommonTraceSpec<const bt_trace>;
using _Spec = internal::CommonTraceSpec<LibObjT>;
- using _ThisCommonTrace = CommonTrace<LibObjT>;
-
- using _Stream =
- typename std::conditional<std::is_const<LibObjT>::value, CommonStream<const bt_stream>,
- CommonStream<bt_stream>>::type;
+ using _Stream = internal::DepStream<LibObjT>;
public:
- using Shared = SharedObj<_ThisCommonTrace, LibObjT, internal::TraceRefFuncs>;
+ using Shared = SharedObject<CommonTrace, LibObjT, internal::TraceRefFuncs>;
+ using UserAttributes = internal::DepUserAttrs<LibObjT>;
- using Class = typename std::conditional<std::is_const<LibObjT>::value,
- CommonTraceClass<const bt_trace_class>,
- CommonTraceClass<bt_trace_class>>::type;
-
- using UserAttributes =
- typename std::conditional<std::is_const<LibObjT>::value, ConstMapValue, MapValue>::type;
+ using Class = internal::DepType<LibObjT, CommonTraceClass<bt_trace_class>,
+ CommonTraceClass<const bt_trace_class>>;
struct ConstEnvironmentEntry
{
- bpstd::string_view name;
+ const char *name;
ConstValue value;
};
}
template <typename OtherLibObjT>
- _ThisCommonTrace& operator=(const CommonTrace<OtherLibObjT> trace) noexcept
+ CommonTrace operator=(const CommonTrace<OtherLibObjT> trace) noexcept
{
_ThisBorrowedObject::operator=(trace);
return *this;
}
- CommonTraceClass<const bt_trace_class> cls() const noexcept;
- Class cls() noexcept;
+ CommonTrace<const bt_trace> asConst() const noexcept
+ {
+ return CommonTrace<const bt_trace> {*this};
+ }
- void name(const char * const name)
+ Class cls() const noexcept;
+
+ void name(const char * const name) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTrace`.");
const auto status = bt_trace_set_name(this->libObjPtr(), name);
}
}
- void name(const std::string& name)
+ void name(const std::string& name) const
{
this->name(name.data());
}
- nonstd::optional<bpstd::string_view> name() const noexcept
+ const char *name() const noexcept
{
- const auto name = bt_trace_get_name(this->libObjPtr());
-
- if (name) {
- return name;
- }
-
- return nonstd::nullopt;
+ return bt_trace_get_name(this->libObjPtr());
}
- void uuid(const bt2_common::UuidView& uuid) noexcept
+ void uuid(const bt2_common::UuidView& uuid) const noexcept
{
bt_trace_set_uuid(this->libObjPtr(), uuid.begin());
}
return nonstd::nullopt;
}
- std::uint64_t size() const noexcept
+ std::uint64_t length() const noexcept
{
return bt_trace_get_stream_count(this->libObjPtr());
}
- ConstStream operator[](const std::uint64_t index) const noexcept
- {
- return ConstStream {_ConstSpec::streamByIndex(this->libObjPtr(), index)};
- }
-
- _Stream operator[](const std::uint64_t index) noexcept
+ _Stream operator[](const std::uint64_t index) const noexcept
{
return _Stream {_Spec::streamByIndex(this->libObjPtr(), index)};
}
- nonstd::optional<ConstStream> streamById(const std::uint64_t id) const noexcept
- {
- const auto libObjPtr = _ConstSpec::streamById(this->libObjPtr(), id);
-
- if (libObjPtr) {
- return ConstStream {libObjPtr};
- }
-
- return nonstd::nullopt;
- }
-
- nonstd::optional<_Stream> streamById(const std::uint64_t id) noexcept
+ nonstd::optional<_Stream> streamById(const std::uint64_t id) const noexcept
{
const auto libObjPtr = _Spec::streamById(this->libObjPtr(), id);
return nonstd::nullopt;
}
- void environmentEntry(const char * const name, const std::int64_t val)
+ void environmentEntry(const char * const name, const std::int64_t val) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTrace`.");
const auto status = bt_trace_set_environment_entry_integer(this->libObjPtr(), name, val);
}
}
- void environmentEntry(const std::string& name, const std::int64_t val)
+ void environmentEntry(const std::string& name, const std::int64_t val) const
{
this->environmentEntry(name.data(), val);
}
- void environmentEntry(const char * const name, const char * const val)
+ void environmentEntry(const char * const name, const char * const val) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTrace`.");
const auto status = bt_trace_set_environment_entry_string(this->libObjPtr(), name, val);
}
}
- void environmentEntry(const std::string& name, const char * const val)
+ void environmentEntry(const std::string& name, const char * const val) const
{
this->environmentEntry(name.data(), val);
}
- void environmentEntry(const char * const name, const std::string& val)
+ void environmentEntry(const char * const name, const std::string& val) const
{
this->environmentEntry(name, val.data());
}
- void environmentEntry(const std::string& name, const std::string& val)
+ void environmentEntry(const std::string& name, const std::string& val) const
{
this->environmentEntry(name.data(), val.data());
}
}
template <typename LibValT>
- void userAttributes(const CommonMapValue<LibValT> userAttrs)
+ void userAttributes(const CommonMapValue<LibValT> userAttrs) const noexcept
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTrace`.");
bt_trace_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr());
}
- ConstMapValue userAttributes() const noexcept
- {
- return ConstMapValue {_ConstSpec::userAttributes(this->libObjPtr())};
- }
-
- UserAttributes userAttributes() noexcept
+ UserAttributes userAttributes() const noexcept
{
return UserAttributes {_Spec::userAttributes(this->libObjPtr())};
}
} /* namespace internal */
template <typename LibObjT>
-ConstTrace CommonStream<LibObjT>::trace() const noexcept
-{
- return ConstTrace {_ConstSpec::trace(this->libObjPtr())};
-}
-
-template <typename LibObjT>
-typename CommonStream<LibObjT>::_Trace CommonStream<LibObjT>::trace() noexcept
+typename CommonStream<LibObjT>::_Trace CommonStream<LibObjT>::trace() const noexcept
{
return _Trace {_Spec::trace(this->libObjPtr())};
}
struct EventClassRefFuncs final
{
- static void get(const bt_event_class * const libObjPtr)
+ static void get(const bt_event_class * const libObjPtr) noexcept
{
bt_event_class_get_ref(libObjPtr);
}
- static void put(const bt_event_class * const libObjPtr)
+ static void put(const bt_event_class * const libObjPtr) noexcept
{
bt_event_class_put_ref(libObjPtr);
}
}
};
+template <typename LibObjT>
+using DepStructFc = DepType<LibObjT, StructureFieldClass, ConstStructureFieldClass>;
+
} /* namespace internal */
template <typename LibObjT>
private:
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
using typename BorrowedObject<LibObjT>::_LibObjPtr;
- using _ConstSpec = internal::CommonEventClassSpec<const bt_event_class>;
using _Spec = internal::CommonEventClassSpec<LibObjT>;
- using _ThisCommonEventClass = CommonEventClass<LibObjT>;
-
- using _StreamClass = typename std::conditional<std::is_const<LibObjT>::value,
- CommonStreamClass<const bt_stream_class>,
- CommonStreamClass<bt_stream_class>>::type;
+ using _StructureFieldClass = internal::DepStructFc<LibObjT>;
- using _StructureFieldClass =
- typename std::conditional<std::is_const<LibObjT>::value, ConstStructureFieldClass,
- StructureFieldClass>::type;
+ using _StreamClass = internal::DepType<LibObjT, CommonStreamClass<bt_stream_class>,
+ CommonStreamClass<const bt_stream_class>>;
public:
- using Shared = SharedObj<_ThisCommonEventClass, LibObjT, internal::EventClassRefFuncs>;
-
- using UserAttributes =
- typename std::conditional<std::is_const<LibObjT>::value, ConstMapValue, MapValue>::type;
+ using Shared = SharedObject<CommonEventClass, LibObjT, internal::EventClassRefFuncs>;
+ using UserAttributes = internal::DepUserAttrs<LibObjT>;
enum class LogLevel
{
}
template <typename OtherLibObjT>
- _ThisCommonEventClass& operator=(const CommonEventClass<OtherLibObjT> eventClass) noexcept
+ CommonEventClass operator=(const CommonEventClass<OtherLibObjT> eventClass) noexcept
{
_ThisBorrowedObject::operator=(eventClass);
return *this;
}
- CommonStreamClass<const bt_stream_class> streamClass() const noexcept;
- _StreamClass streamClass() noexcept;
+ CommonEventClass<const bt_event_class> asConst() const noexcept
+ {
+ return CommonEventClass<const bt_event_class> {*this};
+ }
+
+ _StreamClass streamClass() const noexcept;
std::uint64_t id() const noexcept
{
return bt_event_class_get_id(this->libObjPtr());
}
- void name(const char * const name)
+ void name(const char * const name) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstEventClass`.");
const auto status = bt_event_class_set_name(this->libObjPtr(), name);
}
}
- void name(const std::string& name)
+ void name(const std::string& name) const
{
this->name(name.data());
}
- nonstd::optional<bpstd::string_view> name() const noexcept
+ const char *name() const noexcept
{
- const auto name = bt_event_class_get_name(this->libObjPtr());
-
- if (name) {
- return name;
- }
-
- return nonstd::nullopt;
+ return bt_event_class_get_name(this->libObjPtr());
}
- void logLevel(const LogLevel logLevel) noexcept
+ void logLevel(const LogLevel logLevel) const noexcept
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstEventClass`.");
bt_event_class_set_log_level(this->libObjPtr(),
static_cast<bt_event_class_log_level>(logLevel));
return nonstd::nullopt;
}
- void emfUri(const char * const emfUri)
+ void emfUri(const char * const emfUri) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstEventClass`.");
const auto status = bt_event_class_set_emf_uri(this->libObjPtr(), emfUri);
}
}
- void emfUri(const std::string& emfUri)
+ void emfUri(const std::string& emfUri) const
{
this->emfUri(emfUri.data());
}
- nonstd::optional<bpstd::string_view> emfUri() const noexcept
+ const char *emfUri() const noexcept
{
- const auto emfUri = bt_event_class_get_emf_uri(this->libObjPtr());
-
- if (emfUri) {
- return emfUri;
- }
-
- return nonstd::nullopt;
+ return bt_event_class_get_emf_uri(this->libObjPtr());
}
- void payloadFieldClass(const StructureFieldClass fc)
+ void payloadFieldClass(const StructureFieldClass fc) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstEventClass`.");
const auto status =
bt_event_class_set_payload_field_class(this->libObjPtr(), fc.libObjPtr());
}
}
- nonstd::optional<ConstStructureFieldClass> payloadFieldClass() const noexcept
- {
- const auto libObjPtr = _ConstSpec::payloadFieldClass(this->libObjPtr());
-
- if (libObjPtr) {
- return ConstStructureFieldClass {libObjPtr};
- }
-
- return nonstd::nullopt;
- }
-
- nonstd::optional<_StructureFieldClass> payloadFieldClass() noexcept
+ nonstd::optional<_StructureFieldClass> payloadFieldClass() const noexcept
{
const auto libObjPtr = _Spec::payloadFieldClass(this->libObjPtr());
return nonstd::nullopt;
}
- void specificContextFieldClass(const StructureFieldClass fc)
+ void specificContextFieldClass(const StructureFieldClass fc) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstEventClass`.");
const auto status =
bt_event_class_set_specific_context_field_class(this->libObjPtr(), fc.libObjPtr());
}
}
- nonstd::optional<ConstStructureFieldClass> specificContextFieldClass() const noexcept
- {
- const auto libObjPtr = _ConstSpec::specificContextFieldClass(this->libObjPtr());
-
- if (libObjPtr) {
- return ConstStructureFieldClass {libObjPtr};
- }
-
- return nonstd::nullopt;
- }
-
- nonstd::optional<_StructureFieldClass> specificContextFieldClass() noexcept
+ nonstd::optional<_StructureFieldClass> specificContextFieldClass() const noexcept
{
const auto libObjPtr = _Spec::specificContextFieldClass(this->libObjPtr());
}
template <typename LibValT>
- void userAttributes(const CommonMapValue<LibValT> userAttrs)
+ void userAttributes(const CommonMapValue<LibValT> userAttrs) const noexcept
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstEventClass`.");
bt_event_class_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr());
}
- ConstMapValue userAttributes() const noexcept
- {
- return ConstMapValue {_ConstSpec::userAttributes(this->libObjPtr())};
- }
-
- UserAttributes userAttributes() noexcept
+ UserAttributes userAttributes() const noexcept
{
return UserAttributes {_Spec::userAttributes(this->libObjPtr())};
}
} /* namespace internal */
template <typename LibObjT>
-ConstEventClass CommonEvent<LibObjT>::cls() const noexcept
-{
- return ConstEventClass {_ConstSpec::cls(this->libObjPtr())};
-}
-
-template <typename LibObjT>
-typename CommonEvent<LibObjT>::Class CommonEvent<LibObjT>::cls() noexcept
+typename CommonEvent<LibObjT>::Class CommonEvent<LibObjT>::cls() const noexcept
{
return Class {_Spec::cls(this->libObjPtr())};
}
struct StreamClassRefFuncs final
{
- static void get(const bt_stream_class * const libObjPtr)
+ static void get(const bt_stream_class * const libObjPtr) noexcept
{
bt_stream_class_get_ref(libObjPtr);
}
- static void put(const bt_stream_class * const libObjPtr)
+ static void put(const bt_stream_class * const libObjPtr) noexcept
{
bt_stream_class_put_ref(libObjPtr);
}
private:
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
using typename BorrowedObject<LibObjT>::_LibObjPtr;
- using _ConstSpec = internal::CommonStreamClassSpec<const bt_stream_class>;
using _Spec = internal::CommonStreamClassSpec<LibObjT>;
- using _ThisCommonStreamClass = CommonStreamClass<LibObjT>;
-
- using _TraceClass = typename std::conditional<std::is_const<LibObjT>::value,
- CommonTraceClass<const bt_trace_class>,
- CommonTraceClass<bt_trace_class>>::type;
+ using _StructureFieldClass = internal::DepStructFc<LibObjT>;
- using _EventClass = typename std::conditional<std::is_const<LibObjT>::value,
- CommonEventClass<const bt_event_class>,
- CommonEventClass<bt_event_class>>::type;
+ using _TraceClass = internal::DepType<LibObjT, CommonTraceClass<bt_trace_class>,
+ CommonTraceClass<const bt_trace_class>>;
- using _StructureFieldClass =
- typename std::conditional<std::is_const<LibObjT>::value, ConstStructureFieldClass,
- StructureFieldClass>::type;
+ using _EventClass = internal::DepType<LibObjT, CommonEventClass<bt_event_class>,
+ CommonEventClass<const bt_event_class>>;
- using _ClockClass =
- typename std::conditional<std::is_const<LibObjT>::value, ConstClockClass, ClockClass>::type;
+ using _ClockClass = internal::DepType<LibObjT, ClockClass, ConstClockClass>;
public:
- using Shared = SharedObj<_ThisCommonStreamClass, LibObjT, internal::StreamClassRefFuncs>;
-
- using UserAttributes =
- typename std::conditional<std::is_const<LibObjT>::value, ConstMapValue, MapValue>::type;
+ using Shared = SharedObject<CommonStreamClass, LibObjT, internal::StreamClassRefFuncs>;
+ using UserAttributes = internal::DepUserAttrs<LibObjT>;
explicit CommonStreamClass(const _LibObjPtr libObjPtr) noexcept :
_ThisBorrowedObject {libObjPtr}
}
template <typename OtherLibObjT>
- _ThisCommonStreamClass& operator=(const CommonStreamClass<OtherLibObjT> streamClass) noexcept
+ CommonStreamClass operator=(const CommonStreamClass<OtherLibObjT> streamClass) noexcept
{
_ThisBorrowedObject::operator=(streamClass);
return *this;
}
- Stream::Shared instantiate(const Trace trace)
+ CommonStreamClass<const bt_stream_class> asConst() const noexcept
+ {
+ return CommonStreamClass<const bt_stream_class> {*this};
+ }
+
+ Stream::Shared instantiate(const Trace trace) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value,
+ "Not available with `bt2::ConstStreamClass`.");
const auto libObjPtr = bt_stream_create(this->libObjPtr(), trace.libObjPtr());
return Stream::Shared::createWithoutRef(libObjPtr);
}
- Stream::Shared instantiate(const Trace trace, const std::uint64_t id)
+ Stream::Shared instantiate(const Trace trace, const std::uint64_t id) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value,
+ "Not available with `bt2::ConstStreamClass`.");
const auto libObjPtr = bt_stream_create_with_id(this->libObjPtr(), trace.libObjPtr(), id);
return Stream::Shared::createWithoutRef(libObjPtr);
}
- EventClass::Shared createEventClass()
+ EventClass::Shared createEventClass() const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value,
+ "Not available with `bt2::ConstStreamClass`.");
const auto libObjPtr = bt_event_class_create(this->libObjPtr());
return EventClass::Shared::createWithoutRef(libObjPtr);
}
- EventClass::Shared createEventClass(const std::uint64_t id)
+ EventClass::Shared createEventClass(const std::uint64_t id) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value,
+ "Not available with `bt2::ConstStreamClass`.");
const auto libObjPtr = bt_event_class_create_with_id(this->libObjPtr(), id);
return EventClass::Shared::createWithoutRef(libObjPtr);
}
- CommonTraceClass<const bt_trace_class> traceClass() const noexcept;
- _TraceClass traceClass() noexcept;
+ _TraceClass traceClass() const noexcept;
std::uint64_t id() const noexcept
{
return bt_stream_class_get_id(this->libObjPtr());
}
- void name(const char * const name)
+ void name(const char * const name) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value,
+ "Not available with `bt2::ConstStreamClass`.");
const auto status = bt_stream_class_set_name(this->libObjPtr(), name);
}
}
- void name(const std::string& name)
+ void name(const std::string& name) const
{
this->name(name.data());
}
- nonstd::optional<bpstd::string_view> name() const noexcept
+ const char *name() const noexcept
{
- const auto name = bt_stream_class_get_name(this->libObjPtr());
-
- if (name) {
- return name;
- }
-
- return nonstd::nullopt;
+ return bt_stream_class_get_name(this->libObjPtr());
}
- void assignsAutomaticEventClassId(const bool val) noexcept
+ void assignsAutomaticEventClassId(const bool val) const noexcept
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value,
+ "Not available with `bt2::ConstStreamClass`.");
bt_stream_class_set_assigns_automatic_event_class_id(this->libObjPtr(),
static_cast<bt_bool>(val));
bt_stream_class_assigns_automatic_event_class_id(this->libObjPtr()));
}
- void assignsAutomaticStreamId(const bool val) noexcept
+ void assignsAutomaticStreamId(const bool val) const noexcept
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value,
+ "Not available with `bt2::ConstStreamClass`.");
bt_stream_class_set_assigns_automatic_stream_id(this->libObjPtr(),
static_cast<bt_bool>(val));
}
void supportsPackets(const bool supportsPackets, const bool withBeginningDefaultClkSnapshot,
- const bool withEndDefaultClkSnapshot) noexcept
+ const bool withEndDefaultClkSnapshot) const noexcept
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value,
+ "Not available with `bt2::ConstStreamClass`.");
bt_stream_class_set_supports_packets(this->libObjPtr(),
static_cast<bt_bool>(supportsPackets),
}
void supportsDiscardedEvents(const bool supportsDiscardedEvents,
- const bool withDefaultClkSnapshots) noexcept
+ const bool withDefaultClkSnapshots) const noexcept
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value,
+ "Not available with `bt2::ConstStreamClass`.");
bt_stream_class_set_supports_discarded_events(
this->libObjPtr(), static_cast<bt_bool>(supportsDiscardedEvents),
}
void supportsDiscardedPackets(const bool supportsDiscardedPackets,
- const bool withDefaultClkSnapshots) noexcept
+ const bool withDefaultClkSnapshots) const noexcept
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value,
+ "Not available with `bt2::ConstStreamClass`.");
bt_stream_class_set_supports_discarded_packets(
this->libObjPtr(), static_cast<bt_bool>(supportsDiscardedPackets),
bt_stream_class_discarded_packets_have_default_clock_snapshots(this->libObjPtr()));
}
- void defaultClockClass(const ClockClass clkCls)
+ void defaultClockClass(const ClockClass clkCls) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value,
+ "Not available with `bt2::ConstStreamClass`.");
const auto status =
bt_stream_class_set_default_clock_class(this->libObjPtr(), clkCls.libObjPtr());
BT_ASSERT(status == BT_STREAM_CLASS_SET_DEFAULT_CLOCK_CLASS_STATUS_OK);
}
- nonstd::optional<ConstClockClass> defaultClockClass() const noexcept
- {
- const auto libObjPtr = _ConstSpec::defaultClockClass(this->libObjPtr());
-
- if (libObjPtr) {
- return ConstClockClass {libObjPtr};
- }
-
- return nonstd::nullopt;
- }
-
- nonstd::optional<_ClockClass> defaultClockClass() noexcept
+ nonstd::optional<_ClockClass> defaultClockClass() const noexcept
{
const auto libObjPtr = _Spec::defaultClockClass(this->libObjPtr());
return nonstd::nullopt;
}
- std::uint64_t size() const noexcept
+ std::uint64_t length() const noexcept
{
return bt_stream_class_get_event_class_count(this->libObjPtr());
}
- ConstEventClass operator[](const std::uint64_t index) const noexcept
- {
- return ConstEventClass {_ConstSpec::eventClassByIndex(this->libObjPtr(), index)};
- }
-
- _EventClass operator[](const std::uint64_t index) noexcept
+ _EventClass operator[](const std::uint64_t index) const noexcept
{
return _EventClass {_Spec::eventClassByIndex(this->libObjPtr(), index)};
}
- nonstd::optional<ConstEventClass> eventClassById(const std::uint64_t id) const noexcept
- {
- const auto libObjPtr = _ConstSpec::eventClassById(this->libObjPtr(), id);
-
- if (libObjPtr) {
- return ConstEventClass {libObjPtr};
- }
-
- return nonstd::nullopt;
- }
-
- nonstd::optional<_EventClass> eventClassById(const std::uint64_t id) noexcept
+ nonstd::optional<_EventClass> eventClassById(const std::uint64_t id) const noexcept
{
const auto libObjPtr = _Spec::eventClassById(this->libObjPtr(), id);
return nonstd::nullopt;
}
- void packetContextFieldClass(const StructureFieldClass fc)
+ void packetContextFieldClass(const StructureFieldClass fc) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value,
+ "Not available with `bt2::ConstStreamClass`.");
const auto status =
bt_stream_class_set_packet_context_field_class(this->libObjPtr(), fc.libObjPtr());
}
}
- nonstd::optional<ConstStructureFieldClass> packetContextFieldClass() const noexcept
- {
- const auto libObjPtr = _ConstSpec::packetContextFieldClass(this->libObjPtr());
-
- if (libObjPtr) {
- return ConstStructureFieldClass {libObjPtr};
- }
-
- return nonstd::nullopt;
- }
-
- nonstd::optional<_StructureFieldClass> packetContextFieldClass() noexcept
+ nonstd::optional<_StructureFieldClass> packetContextFieldClass() const noexcept
{
const auto libObjPtr = _Spec::packetContextFieldClass(this->libObjPtr());
return nonstd::nullopt;
}
- void eventCommonContextFieldClass(const StructureFieldClass fc)
+ void eventCommonContextFieldClass(const StructureFieldClass fc) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value,
+ "Not available with `bt2::ConstStreamClass`.");
const auto status =
bt_stream_class_set_event_common_context_field_class(this->libObjPtr(), fc.libObjPtr());
}
}
- nonstd::optional<ConstStructureFieldClass> eventCommonContextFieldClass() const noexcept
- {
- const auto libObjPtr = _ConstSpec::eventCommonContextFieldClass(this->libObjPtr());
-
- if (libObjPtr) {
- return ConstStructureFieldClass {libObjPtr};
- }
-
- return nonstd::nullopt;
- }
-
- nonstd::optional<_StructureFieldClass> eventCommonContextFieldClass() noexcept
+ nonstd::optional<_StructureFieldClass> eventCommonContextFieldClass() const noexcept
{
const auto libObjPtr = _Spec::eventCommonContextFieldClass(this->libObjPtr());
}
template <typename LibValT>
- void userAttributes(const CommonMapValue<LibValT> userAttrs)
+ void userAttributes(const CommonMapValue<LibValT> userAttrs) const noexcept
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value,
+ "Not available with `bt2::ConstStreamClass`.");
bt_stream_class_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr());
}
- ConstMapValue userAttributes() const noexcept
- {
- return ConstMapValue {_ConstSpec::userAttributes(this->libObjPtr())};
- }
-
- UserAttributes userAttributes() noexcept
+ UserAttributes userAttributes() const noexcept
{
return UserAttributes {_Spec::userAttributes(this->libObjPtr())};
}
} /* namespace internal */
template <typename LibObjT>
-ConstStreamClass CommonEventClass<LibObjT>::streamClass() const noexcept
-{
- return ConstStreamClass {_ConstSpec::streamClass(this->libObjPtr())};
-}
-
-template <typename LibObjT>
-typename CommonEventClass<LibObjT>::_StreamClass CommonEventClass<LibObjT>::streamClass() noexcept
+typename CommonEventClass<LibObjT>::_StreamClass
+CommonEventClass<LibObjT>::streamClass() const noexcept
{
return _StreamClass {_Spec::streamClass(this->libObjPtr())};
}
template <typename LibObjT>
-ConstStreamClass CommonStream<LibObjT>::cls() const noexcept
-{
- return ConstStreamClass {_ConstSpec::cls(this->libObjPtr())};
-}
-
-template <typename LibObjT>
-typename CommonStream<LibObjT>::Class CommonStream<LibObjT>::cls() noexcept
+typename CommonStream<LibObjT>::Class CommonStream<LibObjT>::cls() const noexcept
{
return Class {_Spec::cls(this->libObjPtr())};
}
struct TraceClassRefFuncs final
{
- static void get(const bt_trace_class * const libObjPtr)
+ static void get(const bt_trace_class * const libObjPtr) noexcept
{
bt_trace_class_get_ref(libObjPtr);
}
- static void put(const bt_trace_class * const libObjPtr)
+ static void put(const bt_trace_class * const libObjPtr) noexcept
{
bt_trace_class_put_ref(libObjPtr);
}
private:
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
using typename BorrowedObject<LibObjT>::_LibObjPtr;
- using _ConstSpec = internal::CommonTraceClassSpec<const bt_trace_class>;
using _Spec = internal::CommonTraceClassSpec<LibObjT>;
- using _ThisCommonTraceClass = CommonTraceClass<LibObjT>;
- using _StreamClass = typename std::conditional<std::is_const<LibObjT>::value,
- CommonStreamClass<const bt_stream_class>,
- CommonStreamClass<bt_stream_class>>::type;
+ using _StreamClass = internal::DepType<LibObjT, CommonStreamClass<bt_stream_class>,
+ CommonStreamClass<const bt_stream_class>>;
public:
- using Shared = SharedObj<_ThisCommonTraceClass, LibObjT, internal::TraceClassRefFuncs>;
-
- using UserAttributes =
- typename std::conditional<std::is_const<LibObjT>::value, ConstMapValue, MapValue>::type;
+ using Shared = SharedObject<CommonTraceClass, LibObjT, internal::TraceClassRefFuncs>;
+ using UserAttributes = internal::DepUserAttrs<LibObjT>;
explicit CommonTraceClass(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr}
{
}
template <typename OtherLibObjT>
- _ThisCommonTraceClass& operator=(const CommonTraceClass<OtherLibObjT> traceClass) noexcept
+ CommonTraceClass operator=(const CommonTraceClass<OtherLibObjT> traceClass) noexcept
{
_ThisBorrowedObject::operator=(traceClass);
return *this;
}
- Trace::Shared instantiate()
+ CommonTraceClass<const bt_trace_class> asConst() const noexcept
+ {
+ return CommonTraceClass<const bt_trace_class> {*this};
+ }
+
+ Trace::Shared instantiate() const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr = bt_trace_create(this->libObjPtr());
return Trace::Shared::createWithoutRef(libObjPtr);
}
- StreamClass::Shared createStreamClass()
+ StreamClass::Shared createStreamClass() const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr = bt_stream_class_create(this->libObjPtr());
return StreamClass::Shared::createWithoutRef(libObjPtr);
}
- StreamClass::Shared createStreamClass(const std::uint64_t id)
+ StreamClass::Shared createStreamClass(const std::uint64_t id) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr = bt_stream_class_create_with_id(this->libObjPtr(), id);
return StreamClass::Shared::createWithoutRef(libObjPtr);
}
- FieldClass::Shared createBoolFieldClass()
+ FieldClass::Shared createBoolFieldClass() const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr = bt_field_class_bool_create(this->libObjPtr());
return FieldClass::Shared::createWithoutRef(libObjPtr);
}
- BitArrayFieldClass::Shared createBitArrayFieldClass(const std::uint64_t length)
+ BitArrayFieldClass::Shared createBitArrayFieldClass(const std::uint64_t length) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr = bt_field_class_bit_array_create(this->libObjPtr(), length);
return BitArrayFieldClass::Shared::createWithoutRef(libObjPtr);
}
- IntegerFieldClass::Shared createUnsignedIntegerFieldClass()
+ IntegerFieldClass::Shared createUnsignedIntegerFieldClass() const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr = bt_field_class_integer_unsigned_create(this->libObjPtr());
return IntegerFieldClass::Shared::createWithoutRef(libObjPtr);
}
- IntegerFieldClass::Shared createSignedIntegerFieldClass()
+ IntegerFieldClass::Shared createSignedIntegerFieldClass() const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr = bt_field_class_integer_signed_create(this->libObjPtr());
return IntegerFieldClass::Shared::createWithoutRef(libObjPtr);
}
- UnsignedEnumerationFieldClass::Shared createUnsignedEnumerationFieldClass()
+ UnsignedEnumerationFieldClass::Shared createUnsignedEnumerationFieldClass() const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr = bt_field_class_enumeration_unsigned_create(this->libObjPtr());
return UnsignedEnumerationFieldClass::Shared::createWithoutRef(libObjPtr);
}
- SignedEnumerationFieldClass::Shared createSignedEnumerationFieldClass()
+ SignedEnumerationFieldClass::Shared createSignedEnumerationFieldClass() const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr = bt_field_class_enumeration_signed_create(this->libObjPtr());
return SignedEnumerationFieldClass::Shared::createWithoutRef(libObjPtr);
}
- FieldClass::Shared createSinglePrecisionRealFieldClass()
+ FieldClass::Shared createSinglePrecisionRealFieldClass() const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr = bt_field_class_real_single_precision_create(this->libObjPtr());
return FieldClass::Shared::createWithoutRef(libObjPtr);
}
- FieldClass::Shared createDoublePrecisionRealFieldClass()
+ FieldClass::Shared createDoublePrecisionRealFieldClass() const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr = bt_field_class_real_double_precision_create(this->libObjPtr());
return FieldClass::Shared::createWithoutRef(libObjPtr);
}
- FieldClass::Shared createStringFieldClass()
+ FieldClass::Shared createStringFieldClass() const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr = bt_field_class_string_create(this->libObjPtr());
}
StaticArrayFieldClass::Shared createStaticArrayFieldClass(const FieldClass elementFieldClass,
- const std::uint64_t length)
+ const std::uint64_t length) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr = bt_field_class_array_static_create(
this->libObjPtr(), elementFieldClass.libObjPtr(), length);
return StaticArrayFieldClass::Shared::createWithoutRef(libObjPtr);
}
- ArrayFieldClass::Shared createDynamicArrayFieldClass(const FieldClass elementFieldClass)
+ ArrayFieldClass::Shared createDynamicArrayFieldClass(const FieldClass elementFieldClass) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr = bt_field_class_array_dynamic_create(
this->libObjPtr(), elementFieldClass.libObjPtr(), nullptr);
DynamicArrayWithLengthFieldClass::Shared
createDynamicArrayFieldClass(const FieldClass elementFieldClass,
- const IntegerFieldClass lengthFieldClass)
+ const IntegerFieldClass lengthFieldClass) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr = bt_field_class_array_dynamic_create(
this->libObjPtr(), elementFieldClass.libObjPtr(), lengthFieldClass.libObjPtr());
return DynamicArrayWithLengthFieldClass::Shared::createWithoutRef(libObjPtr);
}
- StructureFieldClass::Shared createStructureFieldClass()
+ StructureFieldClass::Shared createStructureFieldClass() const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr = bt_field_class_structure_create(this->libObjPtr());
return StructureFieldClass::Shared::createWithoutRef(libObjPtr);
}
- OptionFieldClass::Shared createOptionFieldClass(const FieldClass optionalFieldClass)
+ OptionFieldClass::Shared createOptionFieldClass(const FieldClass optionalFieldClass) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr = bt_field_class_option_without_selector_create(
this->libObjPtr(), optionalFieldClass.libObjPtr());
OptionWithBoolSelectorFieldClass::Shared
createOptionWithBoolSelectorFieldClass(const FieldClass optionalFieldClass,
- const FieldClass selectorFieldClass)
+ const FieldClass selectorFieldClass) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr = bt_field_class_option_with_selector_field_bool_create(
this->libObjPtr(), optionalFieldClass.libObjPtr(), selectorFieldClass.libObjPtr());
}
OptionWithUnsignedIntegerSelectorFieldClass::Shared
- createOptionWithUnsignedIntegerSelectorFieldClass(const FieldClass optionalFieldClass,
- const IntegerFieldClass selectorFieldClass,
- const ConstUnsignedIntegerRangeSet ranges)
+ createOptionWithUnsignedIntegerSelectorFieldClass(
+ const FieldClass optionalFieldClass, const IntegerFieldClass selectorFieldClass,
+ const ConstUnsignedIntegerRangeSet ranges) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr = bt_field_class_option_with_selector_field_integer_unsigned_create(
this->libObjPtr(), optionalFieldClass.libObjPtr(), selectorFieldClass.libObjPtr(),
OptionWithSignedIntegerSelectorFieldClass::Shared
createOptionWithSignedIntegerSelectorFieldClass(const FieldClass optionalFieldClass,
const IntegerFieldClass selectorFieldClass,
- const ConstSignedIntegerRangeSet ranges)
+ const ConstSignedIntegerRangeSet ranges) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr = bt_field_class_option_with_selector_field_integer_signed_create(
this->libObjPtr(), optionalFieldClass.libObjPtr(), selectorFieldClass.libObjPtr(),
return OptionWithSignedIntegerSelectorFieldClass::Shared::createWithoutRef(libObjPtr);
}
- VariantWithoutSelectorFieldClass::Shared createVariantFieldClass()
+ VariantWithoutSelectorFieldClass::Shared createVariantFieldClass() const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr = bt_field_class_variant_create(this->libObjPtr(), nullptr);
}
VariantWithUnsignedIntegerSelectorFieldClass::Shared
- createVariantWithUnsignedIntegerSelectorFieldClass(const IntegerFieldClass selectorFieldClass)
+ createVariantWithUnsignedIntegerSelectorFieldClass(
+ const IntegerFieldClass selectorFieldClass) const
{
return this->_createVariantWithIntegerSelectorFieldClass<
VariantWithUnsignedIntegerSelectorFieldClass>(selectorFieldClass);
}
VariantWithSignedIntegerSelectorFieldClass::Shared
- createVariantWithSignedIntegerSelectorFieldClass(const IntegerFieldClass selectorFieldClass)
+ createVariantWithSignedIntegerSelectorFieldClass(
+ const IntegerFieldClass selectorFieldClass) const
{
return this->_createVariantWithIntegerSelectorFieldClass<
VariantWithSignedIntegerSelectorFieldClass>(selectorFieldClass);
}
- void assignsAutomaticStreamClassId(const bool val) noexcept
+ void assignsAutomaticStreamClassId(const bool val) const noexcept
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
bt_trace_class_set_assigns_automatic_stream_class_id(this->libObjPtr(),
static_cast<bt_bool>(val));
bt_trace_class_assigns_automatic_stream_class_id(this->libObjPtr()));
}
- std::uint64_t size() const noexcept
+ std::uint64_t length() const noexcept
{
return bt_trace_class_get_stream_class_count(this->libObjPtr());
}
- ConstStreamClass operator[](const std::uint64_t index) const noexcept
- {
- return ConstStreamClass {_ConstSpec::streamClassByIndex(this->libObjPtr(), index)};
- }
-
- _StreamClass operator[](const std::uint64_t index) noexcept
+ _StreamClass operator[](const std::uint64_t index) const noexcept
{
return _StreamClass {_Spec::streamClassByIndex(this->libObjPtr(), index)};
}
- nonstd::optional<ConstStreamClass> streamClassById(const std::uint64_t id) const noexcept
- {
- const auto libObjPtr = _ConstSpec::streamClassById(this->libObjPtr(), id);
-
- if (libObjPtr) {
- return ConstStreamClass {libObjPtr};
- }
-
- return nonstd::nullopt;
- }
-
- nonstd::optional<_StreamClass> streamClassById(const std::uint64_t id) noexcept
+ nonstd::optional<_StreamClass> streamClassById(const std::uint64_t id) const noexcept
{
const auto libObjPtr = _Spec::streamClassById(this->libObjPtr(), id);
}
template <typename LibValT>
- void userAttributes(const CommonMapValue<LibValT> userAttrs)
+ void userAttributes(const CommonMapValue<LibValT> userAttrs) const noexcept
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
bt_trace_class_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr());
}
- ConstMapValue userAttributes() const noexcept
- {
- return ConstMapValue {_ConstSpec::userAttributes(this->libObjPtr())};
- }
-
- UserAttributes userAttributes() noexcept
+ UserAttributes userAttributes() const noexcept
{
return UserAttributes {_Spec::userAttributes(this->libObjPtr())};
}
private:
template <typename ObjT>
typename ObjT::Shared
- _createVariantWithIntegerSelectorFieldClass(const IntegerFieldClass selectorFieldClass)
+ _createVariantWithIntegerSelectorFieldClass(const IntegerFieldClass selectorFieldClass) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
const auto libObjPtr =
bt_field_class_variant_create(this->libObjPtr(), selectorFieldClass.libObjPtr());
} /* namespace internal */
template <typename LibObjT>
-ConstTraceClass CommonStreamClass<LibObjT>::traceClass() const noexcept
-{
- return ConstTraceClass {_ConstSpec::traceClass(this->libObjPtr())};
-}
-
-template <typename LibObjT>
-typename CommonStreamClass<LibObjT>::_TraceClass CommonStreamClass<LibObjT>::traceClass() noexcept
+typename CommonStreamClass<LibObjT>::_TraceClass
+CommonStreamClass<LibObjT>::traceClass() const noexcept
{
return _TraceClass {_Spec::traceClass(this->libObjPtr())};
}
template <typename LibObjT>
-ConstTraceClass CommonTrace<LibObjT>::cls() const noexcept
-{
- return ConstTraceClass {_ConstSpec::cls(this->libObjPtr())};
-}
-
-template <typename LibObjT>
-typename CommonTrace<LibObjT>::Class CommonTrace<LibObjT>::cls() noexcept
+typename CommonTrace<LibObjT>::Class CommonTrace<LibObjT>::cls() const noexcept
{
return Class {_Spec::cls(this->libObjPtr())};
}