Allow ctf-writer to use new time-keeping facilities
[babeltrace.git] / include / babeltrace / ctf-ir / clock-internal.h
index 89c271d3cb58bb42936192e26bdad3ac76198c05..38b0fcf1860ef86a915fd628ad925327adc3deeb 100644 (file)
  * SOFTWARE.
  */
 
-#include <babeltrace/ctf-writer/ref-internal.h>
 #include <babeltrace/ctf-writer/clock.h>
 #include <babeltrace/ctf-ir/trace-internal.h>
+#include <babeltrace/object-internal.h>
 #include <babeltrace/babeltrace-internal.h>
 #include <glib.h>
-#include <uuid/uuid.h>
+#include <babeltrace/compat/uuid.h>
 
 struct bt_ctf_clock {
-       struct bt_ctf_ref ref_count;
+       struct bt_object base;
        GString *name;
        GString *description;
        uint64_t frequency;
        uint64_t precision;
-       uint64_t offset_s;      /* Offset in seconds */
-       uint64_t offset;        /* Offset in ticks */
-       uint64_t time;          /* Current clock value */
+       int64_t offset_s;       /* Offset in seconds */
+       int64_t offset;         /* Offset in ticks */
+       uint64_t value;         /* Current clock value */
        uuid_t uuid;
+       int uuid_set;
        int absolute;
+
+       /*
+        * This field is set once a clock is added to a trace. If the
+        * trace was created by a CTF writer, then the clock's value
+        * can be set and returned. Otherwise both functions fail
+        * because, in non-writer mode, clocks do not have global
+        * values: values are per-stream.
+        */
+       int has_value;
+
        /*
         * A clock's properties can't be modified once it is added to a stream
         * class.
@@ -52,6 +63,12 @@ struct bt_ctf_clock {
        int frozen;
 };
 
+struct bt_ctf_clock_value {
+       struct bt_object base;
+       struct bt_ctf_clock *clock_class;
+       uint64_t value;
+};
+
 BT_HIDDEN
 void bt_ctf_clock_freeze(struct bt_ctf_clock *clock);
 
@@ -59,4 +76,10 @@ BT_HIDDEN
 void bt_ctf_clock_serialize(struct bt_ctf_clock *clock,
                struct metadata_context *context);
 
+BT_HIDDEN
+bool bt_ctf_clock_is_valid(struct bt_ctf_clock *clock);
+
+BT_HIDDEN
+int bt_ctf_clock_get_value(struct bt_ctf_clock *clock, uint64_t *value);
+
 #endif /* BABELTRACE_CTF_IR_CLOCK_INTERNAL_H */
This page took 0.037477 seconds and 4 git commands to generate.