03d7fdf3 |
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 | |
19 | #ifndef TYPE_H |
20 | #define TYPE_H |
21 | |
22 | |
23 | /* Different types allowed */ |
24 | |
25 | #include <ltt/ltt.h> |
26 | |
27 | |
28 | /* All event types, data types and fields belong to their trace and |
29 | are released at the same time. */ |
30 | |
31 | /* Obtain the name, description, facility, facility relative id, global id, |
32 | type and root field for an eventtype */ |
33 | |
34 | GQuark ltt_eventtype_name(LttEventType *et); |
35 | |
36 | gchar *ltt_eventtype_description(LttEventType *et); |
37 | |
38 | LttFacility *ltt_eventtype_facility(LttEventType *et); |
39 | |
40 | unsigned ltt_eventtype_relative_id(LttEventType *et); |
41 | |
42 | guint8 ltt_eventtype_id(LttEventType *et); |
43 | |
44 | /* obtain the type name and size. The size is the number of bytes for |
45 | primitive types (INT, UINT, FLOAT, ENUM), or the size for the unsigned |
46 | integer length count for sequences. */ |
47 | |
48 | GQuark ltt_type_name(LttType *t); |
49 | |
50 | GQuark ltt_field_name(LttField *f); |
51 | |
52 | LttTypeEnum ltt_type_class(LttType *t); |
53 | |
54 | unsigned ltt_type_size(LttTrace *trace, LttType *t); |
55 | |
56 | |
57 | /* The type of nested elements for arrays and sequences. */ |
58 | |
59 | LttType *ltt_type_element_type(LttType *t); |
60 | |
61 | |
62 | /* The number of elements for arrays. */ |
63 | |
64 | unsigned ltt_type_element_number(LttType *t); |
65 | |
66 | |
67 | /* The number of data members for structures and unions. */ |
68 | |
69 | guint ltt_type_member_number(LttType *t); |
70 | |
71 | |
72 | /* For enumerations, obtain the symbolic string associated with a value |
73 | (0 to n - 1 for an enumeration of n elements). */ |
74 | |
75 | GQuark ltt_enum_string_get(LttType *t, gulong i); |
76 | |
77 | |
78 | /* The fields form a tree representing a depth first search of the |
79 | corresponding event type directed acyclic graph. Fields for arrays and |
80 | sequences simply point to one nested field representing the currently |
81 | selected element among all the (identically typed) elements. For structures, |
82 | a nested field exists for each data member. Each field stores the |
83 | platform/trace specific offset values (for efficient access) and |
84 | points back to the corresponding LttType for the rest. */ |
85 | |
86 | //LttField *ltt_field_element(LttField *f); |
87 | |
88 | LttField *ltt_field_member_by_name(LttField *f, GQuark name); |
89 | |
90 | LttField *ltt_field_member(LttField *f, guint i); |
91 | |
92 | LttType *ltt_field_type(LttField *f); |
93 | |
94 | int ltt_field_size(LttField * f); |
95 | |
96 | guint ltt_eventtype_num_fields(LttEventType *event_type); |
97 | |
98 | LttField *ltt_eventtype_field(LttEventType *event_type, guint i); |
99 | |
100 | LttField *ltt_eventtype_field_by_name(LttEventType *event_type, GQuark name); |
101 | |
102 | #endif // TYPE_H |