Commit | Line | Data |
---|---|---|
086dc475 PP |
1 | #ifndef BABELTRACE_CTF_WRITER_CLOCK_CLASS_INTERNAL_H |
2 | #define BABELTRACE_CTF_WRITER_CLOCK_CLASS_INTERNAL_H | |
3 | ||
4 | /* | |
086dc475 PP |
5 | * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
6 | * | |
7 | * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com> | |
8 | * | |
9 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
10 | * of this software and associated documentation files (the "Software"), to deal | |
11 | * in the Software without restriction, including without limitation the rights | |
12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
13 | * copies of the Software, and to permit persons to whom the Software is | |
14 | * furnished to do so, subject to the following conditions: | |
15 | * | |
16 | * The above copyright notice and this permission notice shall be included in | |
17 | * all copies or substantial portions of the Software. | |
18 | * | |
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
25 | * SOFTWARE. | |
26 | */ | |
27 | ||
85e7137b | 28 | #include "common/macros.h" |
cac20f14 | 29 | #include "object-pool.h" |
d126826c | 30 | #include "common/uuid.h" |
3996bc53 | 31 | #include <babeltrace2-ctf-writer/types.h> |
086dc475 PP |
32 | #include <stdint.h> |
33 | #include <glib.h> | |
34 | ||
57952005 MJ |
35 | #include "object.h" |
36 | ||
086dc475 | 37 | struct bt_ctf_clock_class { |
c2606e2f | 38 | struct bt_ctf_object base; |
086dc475 PP |
39 | GString *name; |
40 | GString *description; | |
41 | uint64_t frequency; | |
42 | uint64_t precision; | |
43 | int64_t offset_s; /* Offset in seconds */ | |
44 | int64_t offset; /* Offset in ticks */ | |
d126826c | 45 | bt_uuid_t uuid; |
086dc475 PP |
46 | int uuid_set; |
47 | int absolute; | |
48 | ||
49 | /* | |
50 | * A clock's properties can't be modified once it is added to a stream | |
51 | * class. | |
52 | */ | |
53 | int frozen; | |
54 | }; | |
55 | ||
56 | BT_HIDDEN | |
57 | void bt_ctf_clock_class_freeze(struct bt_ctf_clock_class *clock_class); | |
58 | ||
59 | BT_HIDDEN | |
d7279670 | 60 | bt_ctf_bool bt_ctf_clock_class_is_valid(struct bt_ctf_clock_class *clock_class); |
086dc475 PP |
61 | |
62 | BT_HIDDEN | |
63 | int bt_ctf_clock_class_compare(struct bt_ctf_clock_class *clock_class_a, | |
64 | struct bt_ctf_clock_class *clock_class_b); | |
65 | ||
66 | BT_HIDDEN | |
67 | struct bt_ctf_clock_class *bt_ctf_clock_class_create(const char *name, | |
68 | uint64_t freq); | |
69 | BT_HIDDEN | |
70 | const char *bt_ctf_clock_class_get_name( | |
71 | struct bt_ctf_clock_class *clock_class); | |
72 | BT_HIDDEN | |
73 | int bt_ctf_clock_class_set_name(struct bt_ctf_clock_class *clock_class, | |
74 | const char *name); | |
75 | BT_HIDDEN | |
76 | const char *bt_ctf_clock_class_get_description( | |
77 | struct bt_ctf_clock_class *clock_class); | |
78 | BT_HIDDEN | |
79 | int bt_ctf_clock_class_set_description( | |
80 | struct bt_ctf_clock_class *clock_class, | |
81 | const char *desc); | |
82 | BT_HIDDEN | |
83 | uint64_t bt_ctf_clock_class_get_frequency( | |
84 | struct bt_ctf_clock_class *clock_class); | |
85 | BT_HIDDEN | |
86 | int bt_ctf_clock_class_set_frequency( | |
87 | struct bt_ctf_clock_class *clock_class, uint64_t freq); | |
88 | BT_HIDDEN | |
89 | uint64_t bt_ctf_clock_class_get_precision( | |
90 | struct bt_ctf_clock_class *clock_class); | |
91 | BT_HIDDEN | |
92 | int bt_ctf_clock_class_set_precision( | |
93 | struct bt_ctf_clock_class *clock_class, uint64_t precision); | |
94 | BT_HIDDEN | |
95 | int bt_ctf_clock_class_get_offset_s( | |
96 | struct bt_ctf_clock_class *clock_class, int64_t *seconds); | |
97 | BT_HIDDEN | |
98 | int bt_ctf_clock_class_set_offset_s( | |
99 | struct bt_ctf_clock_class *clock_class, int64_t seconds); | |
100 | BT_HIDDEN | |
101 | int bt_ctf_clock_class_get_offset_cycles( | |
102 | struct bt_ctf_clock_class *clock_class, int64_t *cycles); | |
103 | BT_HIDDEN | |
104 | int bt_ctf_clock_class_set_offset_cycles( | |
105 | struct bt_ctf_clock_class *clock_class, int64_t cycles); | |
106 | BT_HIDDEN | |
d7279670 | 107 | bt_ctf_bool bt_ctf_clock_class_is_absolute( |
086dc475 PP |
108 | struct bt_ctf_clock_class *clock_class); |
109 | BT_HIDDEN | |
110 | int bt_ctf_clock_class_set_is_absolute( | |
d7279670 | 111 | struct bt_ctf_clock_class *clock_class, bt_ctf_bool is_absolute); |
086dc475 | 112 | BT_HIDDEN |
d126826c | 113 | const uint8_t *bt_ctf_clock_class_get_uuid( |
086dc475 PP |
114 | struct bt_ctf_clock_class *clock_class); |
115 | BT_HIDDEN | |
116 | int bt_ctf_clock_class_set_uuid(struct bt_ctf_clock_class *clock_class, | |
d126826c | 117 | const uint8_t *uuid); |
086dc475 PP |
118 | |
119 | #endif /* BABELTRACE_CTF_WRITER_CLOCK_CLASS_INTERNAL_H */ |