#include <babeltrace2/babeltrace.h>
#include "cpp-common/optional.hpp"
-#include "cpp-common/string_view.hpp"
#include "borrowed-object.hpp"
#include "clock-class.hpp"
}
};
+template <typename LibObjT>
+using DepStructField = DepType<LibObjT, StructureField, ConstStructureField>;
+
} /* namespace internal */
template <typename LibObjT>
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
using typename BorrowedObject<LibObjT>::_LibObjPtr;
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;
}
+ CommonEvent<const bt_event> asConst() const noexcept
+ {
+ return CommonEvent<const bt_event> {*this};
+ }
+
Class cls() const noexcept;
_Stream stream() const noexcept;
nonstd::optional<_Packet> packet() const noexcept;
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
using typename BorrowedObject<LibObjT>::_LibObjPtr;
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 = SharedObject<_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;
}
+ CommonPacket<const bt_packet> asConst() const noexcept
+ {
+ return CommonPacket<const bt_packet> {*this};
+ }
+
_Stream stream() const noexcept;
nonstd::optional<_StructureField> contextField() const noexcept
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
using typename BorrowedObject<LibObjT>::_LibObjPtr;
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 = SharedObject<_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;
}
+ CommonStream<const bt_stream> asConst() const noexcept
+ {
+ return CommonStream<const bt_stream> {*this};
+ }
+
Packet::Shared createPacket() 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 libObjPtr = bt_packet_create(this->libObjPtr());
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);
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) 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());
}
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
using typename BorrowedObject<LibObjT>::_LibObjPtr;
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 = SharedObject<_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;
}
+ CommonTrace<const bt_trace> asConst() const noexcept
+ {
+ return CommonTrace<const bt_trace> {*this};
+ }
+
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);
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) const noexcept
return nonstd::nullopt;
}
- std::uint64_t size() const noexcept
+ std::uint64_t length() const noexcept
{
return bt_trace_get_stream_count(this->libObjPtr());
}
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 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);
template <typename LibValT>
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());
}
}
};
+template <typename LibObjT>
+using DepStructFc = DepType<LibObjT, StructureFieldClass, ConstStructureFieldClass>;
+
} /* namespace internal */
template <typename LibObjT>
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
using typename BorrowedObject<LibObjT>::_LibObjPtr;
using _Spec = internal::CommonEventClassSpec<LibObjT>;
- using _ThisCommonEventClass = CommonEventClass<LibObjT>;
+ using _StructureFieldClass = internal::DepStructFc<LibObjT>;
- using _StreamClass = typename std::conditional<std::is_const<LibObjT>::value,
- CommonStreamClass<const bt_stream_class>,
- CommonStreamClass<bt_stream_class>>::type;
-
- 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 = SharedObject<_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;
}
+ 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
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);
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) 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));
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);
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) 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());
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());
template <typename LibValT>
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());
}
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
using typename BorrowedObject<LibObjT>::_LibObjPtr;
using _Spec = internal::CommonStreamClassSpec<LibObjT>;
- using _ThisCommonStreamClass = CommonStreamClass<LibObjT>;
+ using _StructureFieldClass = internal::DepStructFc<LibObjT>;
- using _TraceClass = typename std::conditional<std::is_const<LibObjT>::value,
- CommonTraceClass<const bt_trace_class>,
- CommonTraceClass<bt_trace_class>>::type;
+ using _TraceClass = internal::DepType<LibObjT, CommonTraceClass<bt_trace_class>,
+ CommonTraceClass<const bt_trace_class>>;
- using _EventClass = typename std::conditional<std::is_const<LibObjT>::value,
- CommonEventClass<const bt_event_class>,
- CommonEventClass<bt_event_class>>::type;
+ using _EventClass = internal::DepType<LibObjT, CommonEventClass<bt_event_class>,
+ CommonEventClass<const bt_event_class>>;
- using _StructureFieldClass =
- typename std::conditional<std::is_const<LibObjT>::value, ConstStructureFieldClass,
- StructureFieldClass>::type;
-
- using _ClockClass =
- typename std::conditional<std::is_const<LibObjT>::value, ConstClockClass, ClockClass>::type;
+ using _ClockClass = internal::DepType<LibObjT, ClockClass, ConstClockClass>;
public:
- using Shared = SharedObject<_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;
}
+ 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());
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);
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());
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);
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);
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) 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));
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) 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) 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) 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),
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());
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());
}
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());
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());
template <typename LibValT>
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());
}
using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
using typename BorrowedObject<LibObjT>::_LibObjPtr;
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 = SharedObject<_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;
}
+ 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());
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());
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);
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());
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);
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());
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());
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());
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());
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());
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());
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
{
- 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);
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);
createDynamicArrayFieldClass(const FieldClass elementFieldClass,
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());
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());
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());
createOptionWithBoolSelectorFieldClass(const FieldClass optionalFieldClass,
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());
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(),
const IntegerFieldClass selectorFieldClass,
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(),
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);
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());
}
template <typename LibValT>
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());
}
typename ObjT::Shared
_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());