public:
using Shared = SharedObject<_ThisCommonClockClass, LibObjT, internal::ClockClassRefFuncs>;
- using UserAttributes =
- typename std::conditional<std::is_const<LibObjT>::value, ConstMapValue, MapValue>::type;
+ using UserAttributes = internal::DepUserAttrs<LibObjT>;
explicit CommonClockClass(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr}
{
return *this;
}
- void frequency(const std::uint64_t frequency) noexcept
+ CommonClockClass<const bt_clock_class> asConst() const noexcept
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ return CommonClockClass<const bt_clock_class> {*this};
+ }
+
+ void frequency(const std::uint64_t frequency) const noexcept
+ {
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstClockClass`.");
bt_clock_class_set_frequency(this->libObjPtr(), frequency);
}
return bt_clock_class_get_frequency(this->libObjPtr());
}
- void offset(const ClockClassOffset& offset) noexcept
+ void offset(const ClockClassOffset& offset) 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::ConstClockClass`.");
bt_clock_class_set_offset(this->libObjPtr(), offset.seconds(), offset.cycles());
}
return ClockClassOffset {seconds, cycles};
}
- void precision(const std::uint64_t precision) noexcept
+ void precision(const std::uint64_t precision) 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::ConstClockClass`.");
bt_clock_class_set_precision(this->libObjPtr(), precision);
}
return bt_clock_class_get_precision(this->libObjPtr());
}
- void originIsUnixEpoch(const bool originIsUnixEpoch) noexcept
+ void originIsUnixEpoch(const bool originIsUnixEpoch) 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::ConstClockClass`.");
bt_clock_class_set_origin_is_unix_epoch(this->libObjPtr(),
static_cast<bt_bool>(originIsUnixEpoch));
return static_cast<bool>(bt_clock_class_origin_is_unix_epoch(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::ConstClockClass`.");
const auto status = bt_clock_class_set_name(this->libObjPtr(), name);
}
}
- void name(const std::string& name)
+ void name(const std::string& name) const
{
this->name(name.data());
}
return nonstd::nullopt;
}
- void description(const char * const description)
+ void description(const char * const description) const
{
- static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
+ static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstClockClass`.");
const auto status = bt_clock_class_set_description(this->libObjPtr(), description);
}
}
- void description(const std::string& description)
+ void description(const std::string& description) const
{
this->description(description.data());
}
return nonstd::nullopt;
}
- void uuid(const std::uint8_t * const uuid) noexcept
+ void uuid(const std::uint8_t * const uuid) const noexcept
{
bt_clock_class_set_uuid(this->libObjPtr(), uuid);
}
}
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::ConstClockClass`.");
bt_clock_class_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr());
}
- ConstMapValue userAttributes() const noexcept
- {
- return ConstMapValue {internal::CommonClockClassSpec<const bt_clock_class>::userAttributes(
- this->libObjPtr())};
- }
-
- UserAttributes userAttributes() noexcept
+ UserAttributes userAttributes() const noexcept
{
return UserAttributes {
internal::CommonClockClassSpec<LibObjT>::userAttributes(this->libObjPtr())};