1 #include <fstreams.h>
\r
2 #include <excludes.h>
\r
4 \r XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(tesh);
5 \r\rfstreams_t
\r fstreams_new(void_f_pvoid_t fn_finalize)
\r
7 \rfstreams_t fstreams = xbt_new0(s_fstreams_t, 1);
8 \rfstreams->items = xbt_dynar_new(sizeof(fstream_t), fn_finalize);
12 \r\rint
\r fstreams_exclude(fstreams_t fstreams, excludes_t excludes)
\r
16 \r\rif (!fstreams || !excludes)
18 \r\rif (excludes_is_empty(excludes))
21 /* collecte the file streams to exclude */
\r
22 xbt_dynar_foreach(fstreams->items, i, fstream)
\r {
23 \rif (excludes_contains(excludes, fstream))
25 \rINFO1("excluding %s", fstream->name);
26 \rxbt_dynar_cursor_rm(fstreams->items, &i);
32 \r\rint
\r fstreams_contains(fstreams_t fstreams, fstream_t fstream)
\r
36 \r\rif (!fstreams || !fstream)
41 \r\rxbt_dynar_foreach(fstreams->items, i, cur)
\r {
42 \rif (!strcmp(cur->name, fstream->name)
43 && !strcmp(cur->directory, fstream->directory))
49 \r\rint
\r fstreams_load(fstreams_t fstreams)
\r
55 \r\rxbt_dynar_foreach(fstreams->items, i, fstream)
\r {
56 \rfstream_open(fstream);
61 \r\rint
\r fstreams_add(fstreams_t fstreams, fstream_t fstream)
\r
65 \r\rxbt_dynar_push(fstreams->items, &fstream);
69 \r\rint
\r fstreams_free(void **fstreamsptr)
\r
71 \rif (!(*fstreamsptr))
73 \r\rif ((*((fstreams_t *) fstreamsptr))->items)
74 \rxbt_dynar_free(&((*((fstreams_t *) fstreamsptr))->items));
75 \r\rfree(*fstreamsptr);
76 \r\r*fstreamsptr = NULL;
80 \r\rint
\r fstreams_get_size(fstreams_t fstreams)
\r
87 \r\rreturn xbt_dynar_length(fstreams->items);
90 \r\rint
\r fstreams_is_empty(fstreams_t fstreams)
\r
97 \r\rreturn (0 == xbt_dynar_length(fstreams->items));