Clock class API: use status
[babeltrace.git] / include / babeltrace / trace-ir / clock-class-const.h
index 3032b316b8082d04d0cf019fe83b9c54f16343dd..f7afc24802b491d4e19628571b296da6dc2cfd4c 100644 (file)
 
 #include <stdint.h>
 
-/* For bt_bool, bt_uuid */
+/* For bt_bool, bt_uuid, bt_clock_class */
 #include <babeltrace/types.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-struct bt_clock_class;
+enum bt_clock_class_status {
+       BT_CLOCK_CLASS_STATUS_OK = 0,
+       BT_CLOCK_CLASS_STATUS_NOMEM = -12,
+       BT_CLOCK_CLASS_STATUS_OVERFLOW = -75,
+};
 
 extern const char *bt_clock_class_get_name(
-               const struct bt_clock_class *clock_class);
+               const bt_clock_class *clock_class);
 
 extern const char *bt_clock_class_get_description(
-               const struct bt_clock_class *clock_class);
+               const bt_clock_class *clock_class);
 
 extern uint64_t bt_clock_class_get_frequency(
-               const struct bt_clock_class *clock_class);
+               const bt_clock_class *clock_class);
 
 extern uint64_t bt_clock_class_get_precision(
-               const struct bt_clock_class *clock_class);
+               const bt_clock_class *clock_class);
 
-extern void bt_clock_class_get_offset(const struct bt_clock_class *clock_class,
+extern void bt_clock_class_get_offset(const bt_clock_class *clock_class,
                int64_t *seconds, uint64_t *cycles);
 
 extern bt_bool bt_clock_class_is_absolute(
-               const struct bt_clock_class *clock_class);
+               const bt_clock_class *clock_class);
 
 extern bt_uuid bt_clock_class_get_uuid(
-               const struct bt_clock_class *clock_class);
+               const bt_clock_class *clock_class);
 
-extern int bt_clock_class_cycles_to_ns_from_origin(
-               const struct bt_clock_class *clock_class,
+extern enum bt_clock_class_status bt_clock_class_cycles_to_ns_from_origin(
+               const bt_clock_class *clock_class,
                uint64_t cycles, int64_t *ns_from_origin);
 
+extern void bt_clock_class_get_ref(const bt_clock_class *clock_class);
+
+extern void bt_clock_class_put_ref(const bt_clock_class *clock_class);
+
+#define BT_CLOCK_CLASS_PUT_REF_AND_RESET(_var)         \
+       do {                                            \
+               bt_clock_class_put_ref(_var);           \
+               (_var) = NULL;                          \
+       } while (0)
+
+#define BT_CLOCK_CLASS_MOVE_REF(_var_dst, _var_src)    \
+       do {                                            \
+               bt_clock_class_put_ref(_var_dst);       \
+               (_var_dst) = (_var_src);                \
+               (_var_src) = NULL;                      \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif
This page took 0.024219 seconds and 4 git commands to generate.