7c6b3cd7 |
1 | #ifndef TYPE_H |
2 | #define TYPE_H |
975e44c7 |
3 | |
1b82f325 |
4 | |
5 | /* Different types allowed */ |
6 | |
290dfc8c |
7 | typedef enum _LttTypeEnum |
1b82f325 |
8 | { LTT_INT, LTT_UINT, LTT_FLOAT, LTT_STRING, LTT_ENUM, LTT_ARRAY, |
a6bf5e74 |
9 | LTT_SEQUENCE, LTT_STRUCT, LTT_UNION |
290dfc8c |
10 | } LttTypeEnum; |
1b82f325 |
11 | |
963b5f2d |
12 | #include <ltt/ltt.h> |
13 | |
1b82f325 |
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 | |
290dfc8c |
21 | char *ltt_eventtype_name(LttEventType *et); |
975e44c7 |
22 | |
290dfc8c |
23 | char *ltt_eventtype_description(LttEventType *et); |
975e44c7 |
24 | |
290dfc8c |
25 | LttFacility *ltt_eventtype_facility(LttEventType *et); |
1b82f325 |
26 | |
290dfc8c |
27 | unsigned *ltt_eventtype_relative_id(LttEventType *et); |
1b82f325 |
28 | |
290dfc8c |
29 | unsigned *ltt_eventtype_id(LttEventType *et); |
1b82f325 |
30 | |
290dfc8c |
31 | LttType *ltt_eventtype_type(LttEventType *et); |
975e44c7 |
32 | |
290dfc8c |
33 | LttField *ltt_eventtype_field(LttEventType *et); |
1b82f325 |
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 | |
290dfc8c |
40 | char *ltt_type_name(LttType *t); |
975e44c7 |
41 | |
290dfc8c |
42 | LttTypeEnum ltt_type_class(LttType *t); |
975e44c7 |
43 | |
963b5f2d |
44 | unsigned ltt_type_size(LttTrace *trace, LttType *t); |
975e44c7 |
45 | |
46 | |
47 | /* The type of nested elements for arrays and sequences. */ |
48 | |
290dfc8c |
49 | LttType *ltt_type_element_type(LttType *t); |
975e44c7 |
50 | |
51 | |
52 | /* The number of elements for arrays. */ |
53 | |
290dfc8c |
54 | unsigned ltt_type_element_number(LttType *t); |
975e44c7 |
55 | |
56 | |
a6bf5e74 |
57 | /* The number of data members for structures and unions. */ |
975e44c7 |
58 | |
290dfc8c |
59 | unsigned ltt_type_member_number(LttType *t); |
975e44c7 |
60 | |
61 | |
62 | /* The type of a data member in a structure. */ |
63 | |
290dfc8c |
64 | LttType *ltt_type_member_type(LttType *t, unsigned i); |
975e44c7 |
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 | |
290dfc8c |
70 | char *ltt_enum_string_get(LttType *t, unsigned i); |
975e44c7 |
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 |
290dfc8c |
79 | points back to the corresponding LttType for the rest. */ |
975e44c7 |
80 | |
290dfc8c |
81 | LttField *ltt_field_element(LttField *f); |
975e44c7 |
82 | |
290dfc8c |
83 | LttField *ltt_field_member(LttField *f, unsigned i); |
975e44c7 |
84 | |
290dfc8c |
85 | LttType *ltt_field_type(LttField *f); |
975e44c7 |
86 | |
7c6b3cd7 |
87 | #endif // TYPE_H |