X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Flttv%2Fiattribute.c;h=0271dddb65d3836e10932c31539e1bc5a6a398b6;hb=4d4528813f83afd049d937aea321b10f9598185e;hp=ef357dd5b050e87fc95e59e809232c98b3ce26d9;hpb=c47a6dc6fb544baff5b6fe977c992822693208b8;p=lttv.git diff --git a/ltt/branches/poly/lttv/lttv/iattribute.c b/ltt/branches/poly/lttv/lttv/iattribute.c index ef357dd5..0271dddb 100644 --- a/ltt/branches/poly/lttv/lttv/iattribute.c +++ b/ltt/branches/poly/lttv/lttv/iattribute.c @@ -16,6 +16,9 @@ * MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +#include +#endif #include @@ -66,9 +69,9 @@ gboolean lttv_iattribute_named(LttvIAttribute *self, gboolean *homogeneous) LttvAttributeType lttv_iattribute_get(LttvIAttribute *self, unsigned i, - LttvAttributeName *name, LttvAttributeValue *v) + LttvAttributeName *name, LttvAttributeValue *v, gboolean *is_named) { - return LTTV_IATTRIBUTE_GET_CLASS (self)->get (self, i, name, v); + return LTTV_IATTRIBUTE_GET_CLASS (self)->get (self, i, name, v, is_named); } @@ -85,6 +88,11 @@ LttvAttributeValue lttv_iattribute_add(LttvIAttribute *self, return LTTV_IATTRIBUTE_GET_CLASS (self)->add (self, name, t); } +LttvAttributeValue lttv_iattribute_add_unnamed(LttvIAttribute *self, + LttvAttributeName name, LttvAttributeType t) +{ + return LTTV_IATTRIBUTE_GET_CLASS (self)->add_unnamed (self, name, t); +} void lttv_iattribute_remove(LttvIAttribute *self, unsigned i) { @@ -104,6 +112,13 @@ LttvIAttribute* lttv_iattribute_find_subdir(LttvIAttribute *self, return LTTV_IATTRIBUTE_GET_CLASS (self)->find_subdir (self, name); } +LttvIAttribute* lttv_iattribute_find_subdir_unnamed(LttvIAttribute *self, + LttvAttributeName name) +{ + return LTTV_IATTRIBUTE_GET_CLASS (self)->find_subdir_unnamed (self, name); +} + + /* Find the named attribute in the table, which must be of the specified type. If it does not exist, it is created with a default value of 0 (NULL for @@ -187,6 +202,8 @@ LttvIAttribute *lttv_iattribute_shallow_copy(LttvIAttribute *self) LttvAttributeName name; + gboolean is_named; + int i; int nb_attributes = lttv_iattribute_get_number(self); @@ -194,8 +211,11 @@ LttvIAttribute *lttv_iattribute_shallow_copy(LttvIAttribute *self) copy = LTTV_IATTRIBUTE_GET_CLASS(self)->new_attribute(NULL); for(i = 0 ; i < nb_attributes ; i++) { - t = lttv_iattribute_get(self, i, &name, &v); - v_copy = lttv_iattribute_add(copy, name, t); + t = lttv_iattribute_get(self, i, &name, &v, &is_named); + if(is_named) + v_copy = lttv_iattribute_add(copy, name, t); + else + v_copy = lttv_iattribute_add_unnamed(copy, name, t); lttv_iattribute_copy_value(t, v_copy, v); } return copy; @@ -211,6 +231,8 @@ LttvIAttribute *lttv_iattribute_deep_copy(LttvIAttribute *self) LttvAttributeName name; + gboolean is_named; + int i; int nb_attributes = lttv_iattribute_get_number(self); @@ -218,8 +240,11 @@ LttvIAttribute *lttv_iattribute_deep_copy(LttvIAttribute *self) copy = LTTV_IATTRIBUTE_GET_CLASS(self)->new_attribute(NULL); for(i = 0 ; i < nb_attributes ; i++) { - t = lttv_iattribute_get(self, i, &name, &v); - v_copy = lttv_iattribute_add(copy, name, t); + t = lttv_iattribute_get(self, i, &name, &v, &is_named); + if(is_named) + v_copy = lttv_iattribute_add(copy, name, t); + else + v_copy = lttv_iattribute_add_unnamed(copy, name, t); if(t == LTTV_GOBJECT && LTTV_IS_IATTRIBUTE(*(v.v_gobject))) { child = LTTV_IATTRIBUTE(*(v.v_gobject)); *(v_copy.v_gobject) = G_OBJECT(lttv_iattribute_deep_copy(child));