lib: add internal object pool API and use it; adapt plugins/tests
[babeltrace.git] / include / babeltrace / ctf-ir / clock-value-internal.h
index 7284a35f64a4769fac4e516b84f40e98ce3180af..0f23181b733595b275621cf0cfffdae28f803ee3 100644 (file)
  * SOFTWARE.
  */
 
+#include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/object-internal.h>
 #include <stdbool.h>
 #include <stdint.h>
 
-struct bt_ctf_clock_class;
+struct bt_clock_class;
 
-struct bt_ctf_clock_value {
+struct bt_clock_value {
        struct bt_object base;
-       struct bt_ctf_clock_class *clock_class;
+       struct bt_clock_class *clock_class;
        uint64_t value;
        bool ns_from_epoch_overflows;
        int64_t ns_from_epoch;
+       bool is_set;
+       bool frozen;
 };
 
+static inline
+void bt_clock_value_set(struct bt_clock_value *clock_value)
+{
+       BT_ASSERT(clock_value);
+       clock_value->is_set = true;
+}
+
+static inline
+void bt_clock_value_reset(struct bt_clock_value *clock_value)
+{
+       BT_ASSERT(clock_value);
+       clock_value->is_set = false;
+}
+
+BT_UNUSED
+static inline
+void _bt_clock_value_set_is_frozen(struct bt_clock_value *clock_value,
+               bool is_frozen)
+{
+       BT_ASSERT(clock_value);
+       clock_value->frozen = is_frozen;
+}
+
+#ifdef BT_DEV_MODE
+# define bt_clock_value_set_is_frozen  _bt_clock_value_set_is_frozen
+#else
+# define bt_clock_value_set_is_frozen(_x, _f)
+#endif /* BT_DEV_MODE */
+
+BT_HIDDEN
+struct bt_clock_value *bt_clock_value_create(
+               struct bt_clock_class *clock_class);
+
+BT_HIDDEN
+void bt_clock_value_recycle(struct bt_clock_value *clock_value);
+
+BT_HIDDEN
+void bt_clock_value_set_raw_value(struct bt_clock_value *clock_value,
+               uint64_t cycles);
+
 #endif /* BABELTRACE_CTF_IR_CLOCK_VALUE_INTERNAL_H */
This page took 0.031024 seconds and 4 git commands to generate.