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