Implement bt_ctf_clock_value interface
[babeltrace.git] / include / babeltrace / ctf-ir / clock-internal.h
index e13978110e3c799b566ec4c3cdb7b7ecdd6861fd..0ed43ae991e9e85abdf4a4a5b434bbf4862e0ecb 100644 (file)
@@ -42,10 +42,20 @@ struct bt_ctf_clock {
        uint64_t precision;
        int64_t offset_s;       /* Offset in seconds */
        int64_t offset;         /* Offset in ticks */
-       int64_t time;           /* Current clock value */
+       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.
@@ -53,23 +63,11 @@ struct bt_ctf_clock {
        int frozen;
 };
 
-/*
- * This is not part of the public API to prevent users from creating clocks
- * in an invalid state (being nameless, in this case).
- *
- * The only legitimate use-case for this function is to allocate a clock
- * while the TSDL metadata is being parsed.
- */
-BT_HIDDEN
-struct bt_ctf_clock *_bt_ctf_clock_create(void);
-
-/*
- * Not exposed as part of the public API since the only usecase
- * for this is when we are creating clocks from the TSDL metadata.
- */
-BT_HIDDEN
-int bt_ctf_clock_set_name(struct bt_ctf_clock *clock,
-               const char *name);
+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);
@@ -78,4 +76,7 @@ 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);
+
 #endif /* BABELTRACE_CTF_IR_CLOCK_INTERNAL_H */
This page took 0.024323 seconds and 4 git commands to generate.