extern const char *bt_clock_class_get_origin_uid(
const bt_clock_class *clock_class) __BT_NOEXCEPT;
+/*!
+@brief
+ Status codes for bt_clock_class_set_namespace().
+*/
+typedef enum bt_clock_class_set_namespace_status {
+ /*!
+ @brief
+ Success.
+ */
+ BT_CLOCK_CLASS_SET_NAMESPACE_STATUS_OK = __BT_FUNC_STATUS_OK,
+
+ /*!
+ @brief
+ Out of memory.
+ */
+ BT_CLOCK_CLASS_SET_NAMESPACE_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_clock_class_set_namespace_status;
+
+/*!
+@brief
+ Sets the namespace of the clock class \bt_p{clock_class} to
+ a copy of \bt_p{ns}.
+
+See the \ref api-tir-clock-cls-prop-iden "identity" property.
+
+@param[in] clock_class
+ Clock class of which to set the namespace to \bt_p{ns}.
+@param[in] namespace
+ New namespace of \bt_p{clock_class} (copied).
+
+@retval #BT_CLOCK_CLASS_SET_NAMESPACE_STATUS_OK
+ Success.
+@retval #BT_CLOCK_CLASS_SET_NAMESPACE_STATUS_MEMORY_ERROR
+ Out of memory.
+
+@bt_pre_not_null{clock_class}
+@bt_pre_hot{clock_class}
+@bt_pre_clock_cls_with_mip{clock_class, 1}
+@bt_pre_not_null{namespace}
+
+@sa bt_clock_class_get_namespace() —
+ Returns the namespace of a clock class.
+*/
+extern bt_clock_class_set_namespace_status bt_clock_class_set_namespace(
+ bt_clock_class *clock_class, const char *ns) __BT_NOEXCEPT;
+
+/*!
+@brief
+ Returns the namespace of the clock class \bt_p{clock_class}.
+
+See the \ref api-tir-clock-cls-prop-iden "identity" property.
+
+If \bt_p{clock_class} has no namespace, this function returns \c NULL.
+
+@param[in] clock_class
+ Clock class of which to get the namespace.
+
+@returns
+ @parblock
+ Namespace of \bt_p{clock_class}, or \c NULL if none.
+
+ The returned pointer remains valid as long as \bt_p{clock_class}
+ is not modified.
+ @endparblock
+
+@bt_pre_not_null{clock_class}
+@bt_pre_clock_cls_with_mip{clock_class, 1}
+
+@sa bt_clock_class_set_namespace() —
+ Sets the namespace of a clock class.
+*/
+extern const char *bt_clock_class_get_namespace(
+ const bt_clock_class *clock_class) __BT_NOEXCEPT;
+
/*!
@brief
Status codes for bt_clock_class_set_name().
extern const char *bt_clock_class_get_name(
const bt_clock_class *clock_class) __BT_NOEXCEPT;
+/*!
+@brief
+ Status codes for bt_clock_class_set_uid().
+*/
+typedef enum bt_clock_class_set_uid_status {
+ /*!
+ @brief
+ Success.
+ */
+ BT_CLOCK_CLASS_SET_UID_STATUS_OK = __BT_FUNC_STATUS_OK,
+
+ /*!
+ @brief
+ Out of memory.
+ */
+ BT_CLOCK_CLASS_SET_UID_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_clock_class_set_uid_status;
+
+/*!
+@brief
+ Sets the
+ <a href="https://en.wikipedia.org/wiki/Unique_identifier">unique identifier</a>
+ (UID) of the clock class \bt_p{clock_class} to a copy of \bt_p{uid}.
+
+See the \ref api-tir-clock-cls-prop-iden "identity" property.
+
+@param[in] clock_class
+ Clock class of which to set the UID to \bt_p{uid}.
+@param[in] UID
+ New UID of \bt_p{clock_class} (copied).
+
+@retval #BT_CLOCK_CLASS_SET_UID_STATUS_OK
+ Success.
+@retval #BT_CLOCK_CLASS_SET_UID_STATUS_MEMORY_ERROR
+ Out of memory.
+
+@bt_pre_not_null{clock_class}
+@bt_pre_hot{clock_class}
+@bt_pre_clock_cls_with_mip{clock_class, 1}
+@bt_pre_not_null{uid}
+
+@sa bt_clock_class_get_uid() —
+ Returns the UID of a clock class.
+*/
+extern bt_clock_class_set_uid_status bt_clock_class_set_uid(
+ bt_clock_class *clock_class, const char *uid) __BT_NOEXCEPT;
+
+/*!
+@brief
+ Returns the UID of the clock class \bt_p{clock_class}.
+
+See the \ref api-tir-clock-cls-prop-iden "identity" property.
+
+If \bt_p{clock_class} has no UID, this function returns \c NULL.
+
+@param[in] clock_class
+ Clock class of which to get the UID.
+
+@returns
+ @parblock
+ UID of \bt_p{clock_class}, or \c NULL if none.
+
+ The returned pointer remains valid as long as \bt_p{clock_class}
+ is not modified.
+ @endparblock
+
+@bt_pre_not_null{clock_class}
+@bt_pre_clock_cls_with_mip{clock_class, 1}
+
+@sa bt_clock_class_set_uid() —
+ Sets the UID of a clock class.
+*/
+extern const char *
+bt_clock_class_get_uid(const bt_clock_class *clock_class) __BT_NOEXCEPT;
+
/*!
@brief
Status codes for bt_clock_class_set_description().
BT_LIB_LOGD("Destroying clock class: %!+K", clock_class);
BT_OBJECT_PUT_REF_AND_RESET(clock_class->user_attributes);
+ g_free(clock_class->ns);
g_free(clock_class->name);
+ g_free(clock_class->uid);
g_free(clock_class->description);
free_clock_class_origin_data(clock_class);
bt_object_pool_finalize(&clock_class->cs_pool);
return clock_class;
}
+BT_EXPORT
+const char *bt_clock_class_get_namespace(
+ const struct bt_clock_class *clock_class)
+{
+ BT_ASSERT_PRE_DEV_CLK_CLS_NON_NULL(clock_class);
+ BT_ASSERT_PRE_CC_MIP_VERSION_GE(clock_class, 1);
+ return clock_class->ns;
+}
+
+BT_EXPORT
+enum bt_clock_class_set_namespace_status bt_clock_class_set_namespace(
+ struct bt_clock_class *clock_class, const char *ns)
+{
+ BT_ASSERT_PRE_NO_ERROR();
+ BT_ASSERT_PRE_CLK_CLS_NON_NULL(clock_class);
+ BT_ASSERT_PRE_NAME_NON_NULL(ns);
+ BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class);
+ BT_ASSERT_PRE_CC_MIP_VERSION_GE(clock_class, 1);
+ g_free(clock_class->ns);
+ clock_class->ns = g_strdup(ns);
+ BT_LIB_LOGD("Set clock class's namespace: %!+K", clock_class);
+ return BT_FUNC_STATUS_OK;
+}
+
BT_EXPORT
const char *bt_clock_class_get_name(const struct bt_clock_class *clock_class)
{
return BT_FUNC_STATUS_OK;
}
+BT_EXPORT
+const char *bt_clock_class_get_uid(const struct bt_clock_class *clock_class)
+{
+ BT_ASSERT_PRE_NO_ERROR();
+ BT_ASSERT_PRE_DEV_CLK_CLS_NON_NULL(clock_class);
+ BT_ASSERT_PRE_CC_MIP_VERSION_GE(clock_class, 1);
+ return clock_class->uid;
+}
+
+BT_EXPORT
+enum bt_clock_class_set_uid_status bt_clock_class_set_uid(
+ struct bt_clock_class *clock_class, const char *uid)
+{
+ BT_ASSERT_PRE_NO_ERROR();
+ BT_ASSERT_PRE_CLK_CLS_NON_NULL(clock_class);
+ BT_ASSERT_PRE_NAME_NON_NULL(uid);
+ BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class);
+ BT_ASSERT_PRE_CC_MIP_VERSION_GE(clock_class, 1);
+ g_free(clock_class->uid);
+ clock_class->uid = g_strdup(uid);
+ BT_LIB_LOGD("Set clock class's UID: %!+K", clock_class);
+ return BT_FUNC_STATUS_OK;
+}
+
BT_EXPORT
const char *bt_clock_class_get_description(
const struct bt_clock_class *clock_class)