2 #include <lttv/lttvfilter.h>
7 struct _LttvTracesetSelector
{
13 struct _LttvTraceSelector
{
15 GPtrArray
* tracefiles
;
16 GPtrArray
* eventtypes
;
20 struct _LttvTracefileSelector
{
21 char * tracefile_name
;
22 GPtrArray
* eventtypes
;
26 struct _LttvEventtypeSelector
{
27 char * eventtype_name
;
32 LttvTracesetSelector
*lttv_traceset_selector_new(char * name
)
34 LttvTracesetSelector
*s
;
36 s
= g_new(LttvTracesetSelector
, 1);
38 s
->traceset_name
= g_strdup(name
);
40 s
->traceset_name
= NULL
;
41 s
->traces
= g_ptr_array_new();
45 LttvTraceSelector
*lttv_trace_selector_new(LttTrace
*t
)
47 LttvTraceSelector
* trace
;
49 trace
= g_new(LttvTraceSelector
, 1);
50 trace
->trace_name
= g_strdup(ltt_trace_name(t
));
51 trace
->tracefiles
= g_ptr_array_new();
52 trace
->eventtypes
= g_ptr_array_new();
53 trace
->selected
= TRUE
;
57 LttvTracefileSelector
*lttv_tracefile_selector_new(LttTracefile
*t
)
59 LttvTracefileSelector
* tracefile
;
61 tracefile
= g_new(LttvTracefileSelector
, 1);
62 tracefile
->tracefile_name
= g_strdup(ltt_tracefile_name(t
));
63 tracefile
->eventtypes
= g_ptr_array_new();
64 tracefile
->selected
= TRUE
;
68 LttvEventtypeSelector
*lttv_eventtype_selector_new(LttEventType
* et
)
70 LttvEventtypeSelector
* ev
;
71 ev
= g_new(LttvEventtypeSelector
, 1);
72 ev
->eventtype_name
= g_strdup(ltt_eventtype_name(et
));
77 void lttv_traceset_selector_destroy(LttvTracesetSelector
*s
)
80 LttvTraceSelector
* t
;
82 for(i
=0;i
<s
->traces
->len
;i
++){
83 t
= (LttvTraceSelector
*)s
->traces
->pdata
[i
];
84 lttv_trace_selector_destroy(t
);
86 g_ptr_array_free(s
->traces
, TRUE
);
87 if(s
->traceset_name
) g_free(s
->traceset_name
);
91 void lttv_trace_selector_destroy(LttvTraceSelector
*s
)
94 LttvTracefileSelector
* t
;
95 LttvEventtypeSelector
* e
;
97 for(i
=0;i
<s
->tracefiles
->len
;i
++){
98 t
= (LttvTracefileSelector
*)s
->tracefiles
->pdata
[i
];
99 lttv_tracefile_selector_destroy(t
);
101 for(i
=0;i
<s
->eventtypes
->len
;i
++){
102 e
= (LttvEventtypeSelector
*)s
->eventtypes
->pdata
[i
];
103 lttv_eventtype_selector_destroy(e
);
105 if(s
->trace_name
) g_free(s
->trace_name
);
109 void lttv_tracefile_selector_destroy(LttvTracefileSelector
*t
)
112 LttvEventtypeSelector
* e
;
114 for(i
=0;i
<t
->eventtypes
->len
;i
++){
115 e
= (LttvEventtypeSelector
*)t
->eventtypes
->pdata
[i
];
116 lttv_eventtype_selector_destroy(e
);
119 if(t
->tracefile_name
) g_free(t
->tracefile_name
);
123 void lttv_eventtype_selector_destroy(LttvEventtypeSelector
*e
)
125 if(e
->eventtype_name
) g_free(e
->eventtype_name
);
129 void lttv_traceset_selector_trace_add(LttvTracesetSelector
*s
,
130 LttvTraceSelector
*t
)
132 g_ptr_array_add(s
->traces
, t
);
135 void lttv_trace_selector_tracefile_add(LttvTraceSelector
*s
,
136 LttvTracefileSelector
*t
)
138 g_ptr_array_add(s
->tracefiles
, t
);
141 void lttv_trace_selector_eventtype_add(LttvTraceSelector
*s
,
142 LttvEventtypeSelector
*et
)
144 g_ptr_array_add(s
->eventtypes
, et
);
147 void lttv_tracefile_selector_eventtype_add(LttvTracefileSelector
*s
,
148 LttvEventtypeSelector
*et
)
150 g_ptr_array_add(s
->eventtypes
, et
);
153 unsigned lttv_traceset_selector_trace_number(LttvTracesetSelector
*s
)
155 return s
->traces
->len
;
158 unsigned lttv_trace_selector_tracefile_number(LttvTraceSelector
*s
)
160 return s
->tracefiles
->len
;
163 unsigned lttv_trace_selector_eventtype_number(LttvTraceSelector
*s
)
165 return s
->eventtypes
->len
;
168 unsigned lttv_tracefile_selector_eventtype_number(LttvTracefileSelector
*s
)
170 return s
->eventtypes
->len
;
173 LttvTraceSelector
*lttv_traceset_selector_trace_get(LttvTracesetSelector
*s
,
176 g_assert(s
->traces
->len
> i
);
177 return ((LttvTraceSelector
*)s
->traces
->pdata
[i
]);
180 LttvTracefileSelector
*lttv_trace_selector_tracefile_get(LttvTraceSelector
*s
,
183 g_assert(s
->tracefiles
->len
> i
);
184 return ((LttvTracefileSelector
*)s
->tracefiles
->pdata
[i
]);
187 LttvEventtypeSelector
*lttv_trace_selector_eventtype_get(LttvTraceSelector
*s
,
190 g_assert(s
->eventtypes
->len
> i
);
191 return ((LttvEventtypeSelector
*)s
->eventtypes
->pdata
[i
]);
194 LttvEventtypeSelector
*lttv_tracefile_selector_eventtype_get(LttvTracefileSelector
*s
,
197 g_assert(s
->eventtypes
->len
> i
);
198 return ((LttvEventtypeSelector
*)s
->eventtypes
->pdata
[i
]);
201 void lttv_traceset_selector_trace_remove(LttvTracesetSelector
*s
, unsigned i
)
203 g_assert(s
->traces
->len
> i
);
204 g_ptr_array_remove_index(s
->traces
, i
);
207 void lttv_trace_selector_tracefile_remove(LttvTraceSelector
*s
, unsigned i
)
209 g_assert(s
->tracefiles
->len
> i
);
210 g_ptr_array_remove_index(s
->tracefiles
, i
);
213 void lttv_trace_selector_eventtype_remove(LttvTraceSelector
*s
, unsigned i
)
215 g_assert(s
->eventtypes
->len
> i
);
216 g_ptr_array_remove_index(s
->eventtypes
, i
);
219 void lttv_tracefile_selector_eventtype_remove(LttvTracefileSelector
*s
, unsigned i
)
221 g_assert(s
->eventtypes
->len
> i
);
222 g_ptr_array_remove_index(s
->eventtypes
, i
);
225 void lttv_trace_selector_set_selected(LttvTraceSelector
*s
, gboolean g
)
230 void lttv_tracefile_selector_set_selected(LttvTracefileSelector
*s
, gboolean g
)
235 void lttv_eventtype_selector_set_selected(LttvEventtypeSelector
*s
, gboolean g
)
240 gboolean
lttv_trace_selector_get_selected(LttvTraceSelector
*s
)
245 gboolean
lttv_tracefile_selector_get_selected(LttvTracefileSelector
*s
)
250 gboolean
lttv_eventtype_selector_get_selected(LttvEventtypeSelector
*s
)
255 char * lttv_traceset_selector_get_name(LttvTracesetSelector
*s
)
257 return s
->traceset_name
;
260 char * lttv_trace_selector_get_name(LttvTraceSelector
*s
)
262 return s
->trace_name
;
265 char * lttv_tracefile_selector_get_name(LttvTracefileSelector
*s
)
267 return s
->tracefile_name
;
270 char * lttv_eventtype_selector_get_name(LttvEventtypeSelector
*s
)
272 return s
->eventtype_name
;
275 LttvEventtypeSelector
* lttv_eventtype_selector_clone(LttvEventtypeSelector
* s
)
277 LttvEventtypeSelector
* ev
= g_new(LttvEventtypeSelector
, 1);
278 ev
->eventtype_name
= g_strdup(s
->eventtype_name
);
279 ev
->selected
= s
->selected
;
283 void lttv_eventtype_selector_copy(LttvTraceSelector
* s
, LttvTracefileSelector
* d
)
286 LttvEventtypeSelector
* ev
, *ev1
;
288 len
= s
->eventtypes
->len
;
290 ev
= lttv_trace_selector_eventtype_get(s
,i
);
291 ev1
= lttv_eventtype_selector_clone(ev
);
292 lttv_tracefile_selector_eventtype_add(d
,ev1
);
This page took 0.035069 seconds and 4 git commands to generate.