Compilation errors are done. Some makefile.am fixes are required for linking
[lttv.git] / ltt / branches / poly / lttv / traceset.c
1
2 #include <lttv/traceset.h>
3
4 /* A trace is a sequence of events gathered in the same tracing session. The
5 events may be stored in several tracefiles in the same directory.
6 A trace set is defined when several traces are to be analyzed together,
7 possibly to study the interactions between events in the different traces.
8 */
9
10 struct _LttvTraceset {
11 GPtrArray *traces;
12 GPtrArray *attributes;
13 LttvAttribute *a;
14 };
15
16
17 LttvTraceset *lttv_trace_set_new()
18 {
19 LttvTraceset *s;
20
21 s = g_new(LttvTraceset, 1);
22 s->traces = g_ptr_array_new();
23 s->attributes = g_ptr_array_new();
24 s->a = g_object_new(LTTV_ATTRIBUTE_TYPE, NULL);
25 }
26
27
28 void lttv_traceset_destroy(LttvTraceset *s)
29 {
30 int i, nb;
31
32 for(i = 0 ; i < s->attributes->len ; i++) {
33 g_object_unref((LttvAttribute *)s->attributes->pdata[i]);
34 }
35 g_ptr_array_free(s->attributes, TRUE);
36 g_ptr_array_free(s->traces, TRUE);
37 g_object_unref(s->a);
38 g_free(s);
39 }
40
41
42 void lttv_traceset_add(LttvTraceset *s, LttTrace *t)
43 {
44 g_ptr_array_add(s->traces, t);
45 g_ptr_array_add(s->attributes, g_object_new(LTTV_ATTRIBUTE_TYPE, NULL));
46 }
47
48
49 unsigned lttv_traceset_number(LttvTraceset *s)
50 {
51 return s->traces->len;
52 }
53
54
55 LttTrace *lttv_traceset_get(LttvTraceset *s, unsigned i)
56 {
57 g_assert(s->traces->len > i);
58 return ((LttTrace *)s->traces->pdata[i]);
59 }
60
61
62 void lttv_traceset_remove(LttvTraceset *s, unsigned i)
63 {
64 g_ptr_array_remove_index(s->traces, i);
65 g_object_unref(s->attributes->pdata[i]);
66 g_ptr_array_remove_index(s->attributes,i);
67 }
68
69
70 /* A set of attributes is attached to each trace set, trace and tracefile
71 to store user defined data as needed. */
72
73 LttvAttribute *lttv_traceset_attribute(LttvTraceset *s)
74 {
75 return s->a;
76 }
77
78
79 LttvAttribute *lttv_traceset_trace_attribute(LttvTraceset *s, unsigned i)
80 {
81 return (LttvAttribute *)s->attributes->pdata[i];
82 }
This page took 0.030398 seconds and 4 git commands to generate.