7c6b3cd7 |
1 | #ifndef TYPE_H |
2 | #define TYPE_H |
975e44c7 |
3 | |
4 | #include <ltt/ltt.h> |
5 | |
1b82f325 |
6 | |
7 | /* Different types allowed */ |
8 | |
9 | typedef enum _ltt_type_enum |
10 | { LTT_INT, LTT_UINT, LTT_FLOAT, LTT_STRING, LTT_ENUM, LTT_ARRAY, |
11 | LTT_SEQUENCE, LTT_STRUCT |
12 | } ltt_type_enum; |
13 | |
14 | |
15 | /* All event types, data types and fields belong to their trace and |
975e44c7 |
16 | are released at the same time. */ |
17 | |
1b82f325 |
18 | /* Obtain the name, description, facility, facility relative id, global id, |
19 | type and root field for an eventtype */ |
20 | |
975e44c7 |
21 | char *ltt_eventtype_name(ltt_eventtype *et); |
22 | |
23 | char *ltt_eventtype_description(ltt_eventtype *et); |
24 | |
1b82f325 |
25 | ltt_facility *ltt_eventtype_facility(ltt_eventtype *et); |
26 | |
27 | unsigned *ltt_eventtype_relative_id(ltt_eventtype *et); |
28 | |
29 | unsigned *ltt_eventtype_id(ltt_eventtype *et); |
30 | |
975e44c7 |
31 | ltt_type *ltt_eventtype_type(ltt_eventtype *et); |
32 | |
1b82f325 |
33 | ltt_field *ltt_eventtype_field(ltt_eventtype *et); |
34 | |
975e44c7 |
35 | |
36 | /* obtain the type name and size. The size is the number of bytes for |
37 | primitive types (INT, UINT, FLOAT, ENUM), or the size for the unsigned |
38 | integer length count for sequences. */ |
39 | |
40 | char *ltt_type_name(ltt_type *t); |
41 | |
7c6b3cd7 |
42 | ltt_type_enum ltt_type_class(ltt_type *t); |
975e44c7 |
43 | |
7c6b3cd7 |
44 | unsigned ltt_type_size(ltt_tracefile * tf, ltt_type *t); |
975e44c7 |
45 | |
46 | |
47 | /* The type of nested elements for arrays and sequences. */ |
48 | |
49 | ltt_type *ltt_type_element_type(ltt_type *t); |
50 | |
51 | |
52 | /* The number of elements for arrays. */ |
53 | |
54 | unsigned ltt_type_element_number(ltt_type *t); |
55 | |
56 | |
57 | /* The number of data members for structures. */ |
58 | |
59 | unsigned ltt_type_member_number(ltt_type *t); |
60 | |
61 | |
62 | /* The type of a data member in a structure. */ |
63 | |
64 | ltt_type *ltt_type_member_type(ltt_type *t, unsigned i); |
65 | |
66 | |
67 | /* For enumerations, obtain the symbolic string associated with a value |
68 | (0 to n - 1 for an enumeration of n elements). */ |
69 | |
70 | char *ltt_enum_string_get(ltt_type *t, unsigned i); |
71 | |
72 | |
73 | /* The fields form a tree representing a depth first search of the |
74 | corresponding event type directed acyclic graph. Fields for arrays and |
75 | sequences simply point to one nested field representing the currently |
76 | selected element among all the (identically typed) elements. For structures, |
77 | a nested field exists for each data member. Each field stores the |
1b82f325 |
78 | platform/trace specific offset values (for efficient access) and |
975e44c7 |
79 | points back to the corresponding ltt_type for the rest. */ |
80 | |
81 | ltt_field *ltt_field_element(ltt_field *f); |
82 | |
83 | ltt_field *ltt_field_member(ltt_field *f, unsigned i); |
84 | |
85 | ltt_type *ltt_field_type(ltt_field *f); |
86 | |
7c6b3cd7 |
87 | #endif // TYPE_H |