9c312311 |
1 | /* This file is part of the Linux Trace Toolkit trace reading library |
2 | * Copyright (C) 2003-2004 Michel Dagenais |
3 | * |
4 | * This library is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU Lesser General Public |
6 | * License Version 2.1 as published by the Free Software Foundation. |
7 | * |
8 | * This library is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | * Lesser General Public License for more details. |
12 | * |
13 | * You should have received a copy of the GNU Lesser General Public |
14 | * License along with this library; if not, write to the |
15 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | * Boston, MA 02111-1307, USA. |
17 | */ |
18 | |
7c6b3cd7 |
19 | #ifndef TYPE_H |
20 | #define TYPE_H |
975e44c7 |
21 | |
1b82f325 |
22 | |
23 | /* Different types allowed */ |
24 | |
963b5f2d |
25 | #include <ltt/ltt.h> |
26 | |
1b82f325 |
27 | |
28 | /* All event types, data types and fields belong to their trace and |
975e44c7 |
29 | are released at the same time. */ |
30 | |
1b82f325 |
31 | /* Obtain the name, description, facility, facility relative id, global id, |
32 | type and root field for an eventtype */ |
33 | |
290dfc8c |
34 | char *ltt_eventtype_name(LttEventType *et); |
975e44c7 |
35 | |
290dfc8c |
36 | char *ltt_eventtype_description(LttEventType *et); |
975e44c7 |
37 | |
290dfc8c |
38 | LttFacility *ltt_eventtype_facility(LttEventType *et); |
1b82f325 |
39 | |
33690006 |
40 | unsigned ltt_eventtype_relative_id(LttEventType *et); |
1b82f325 |
41 | |
33690006 |
42 | unsigned ltt_eventtype_id(LttEventType *et); |
1b82f325 |
43 | |
290dfc8c |
44 | LttType *ltt_eventtype_type(LttEventType *et); |
975e44c7 |
45 | |
290dfc8c |
46 | LttField *ltt_eventtype_field(LttEventType *et); |
1b82f325 |
47 | |
975e44c7 |
48 | |
49 | /* obtain the type name and size. The size is the number of bytes for |
50 | primitive types (INT, UINT, FLOAT, ENUM), or the size for the unsigned |
51 | integer length count for sequences. */ |
52 | |
290dfc8c |
53 | char *ltt_type_name(LttType *t); |
975e44c7 |
54 | |
290dfc8c |
55 | LttTypeEnum ltt_type_class(LttType *t); |
975e44c7 |
56 | |
963b5f2d |
57 | unsigned ltt_type_size(LttTrace *trace, LttType *t); |
975e44c7 |
58 | |
59 | |
60 | /* The type of nested elements for arrays and sequences. */ |
61 | |
290dfc8c |
62 | LttType *ltt_type_element_type(LttType *t); |
975e44c7 |
63 | |
64 | |
65 | /* The number of elements for arrays. */ |
66 | |
290dfc8c |
67 | unsigned ltt_type_element_number(LttType *t); |
975e44c7 |
68 | |
69 | |
a6bf5e74 |
70 | /* The number of data members for structures and unions. */ |
975e44c7 |
71 | |
290dfc8c |
72 | unsigned ltt_type_member_number(LttType *t); |
975e44c7 |
73 | |
74 | |
75 | /* The type of a data member in a structure. */ |
76 | |
5fb21f61 |
77 | LttType *ltt_type_member_type(LttType *t, unsigned i, char ** name); |
975e44c7 |
78 | |
79 | |
80 | /* For enumerations, obtain the symbolic string associated with a value |
81 | (0 to n - 1 for an enumeration of n elements). */ |
82 | |
290dfc8c |
83 | char *ltt_enum_string_get(LttType *t, unsigned i); |
975e44c7 |
84 | |
85 | |
86 | /* The fields form a tree representing a depth first search of the |
87 | corresponding event type directed acyclic graph. Fields for arrays and |
88 | sequences simply point to one nested field representing the currently |
89 | selected element among all the (identically typed) elements. For structures, |
90 | a nested field exists for each data member. Each field stores the |
1b82f325 |
91 | platform/trace specific offset values (for efficient access) and |
290dfc8c |
92 | points back to the corresponding LttType for the rest. */ |
975e44c7 |
93 | |
290dfc8c |
94 | LttField *ltt_field_element(LttField *f); |
975e44c7 |
95 | |
290dfc8c |
96 | LttField *ltt_field_member(LttField *f, unsigned i); |
975e44c7 |
97 | |
290dfc8c |
98 | LttType *ltt_field_type(LttField *f); |
975e44c7 |
99 | |
a5dcde2f |
100 | int ltt_field_size(LttField * f); |
101 | |
7c6b3cd7 |
102 | #endif // TYPE_H |