goto error;
}
+ event_class->id = -1;
bt_object_init(event_class, bt_ctf_event_class_destroy);
event_class->fields = bt_ctf_field_type_structure_create();
if (!event_class->fields) {
goto end;
}
+ if (event_class->name) {
+ name = event_class->name;
+ goto end;
+ }
+
obj = bt_ctf_attributes_get_field_value(event_class->attributes,
BT_CTF_EVENT_CLASS_ATTR_NAME_INDEX);
if (!obj) {
goto end;
}
+ if (event_class->id >= 0) {
+ ret = event_class->id;
+ goto end;
+ }
+
obj = bt_ctf_attributes_get_field_value(event_class->attributes,
BT_CTF_EVENT_CLASS_ATTR_ID_INDEX);
if (!obj) {
goto end;
}
- if (!strcmp(name, "id") || !strcmp(name, "loglevel")) {
+ if (!strcmp(name, "id") || !strcmp(name, "loglevel") ||
+ !strcmp(name, "stream_id")) {
if (!bt_value_is_integer(value)) {
ret = -1;
goto end;
}
- } else if (!strcmp(name, "name") || !strcmp(name, "model.emf.uri")) {
+ } else if (!strcmp(name, "name") || !strcmp(name, "model.emf.uri") ||
+ !strcmp(name, "loglevel_string")) {
if (!bt_value_is_string(value)) {
ret = -1;
goto end;
}
ret = bt_ctf_attributes_set_field_value(event_class->attributes,
- name, value);
+ name, value);
end:
return ret;
{
int ret = 0;
- if (!event_class || !payload ||
- bt_ctf_field_type_get_type_id(payload) !=
- BT_CTF_TYPE_ID_STRUCT) {
+ if (!event_class) {
+ ret = -1;
+ goto end;
+ }
+
+ if (payload && bt_ctf_field_type_get_type_id(payload) !=
+ BT_CTF_TYPE_ID_STRUCT) {
ret = -1;
goto end;
}
- bt_get(payload);
bt_put(event_class->fields);
- event_class->fields = payload;
+ event_class->fields = bt_get(payload);
end:
return ret;
}
{
int ret = 0;
- if (!event_class || !context || event_class->frozen) {
+ if (!event_class || event_class->frozen) {
ret = -1;
goto end;
}
- if (bt_ctf_field_type_get_type_id(context) != BT_CTF_TYPE_ID_STRUCT) {
+ if (context && bt_ctf_field_type_get_type_id(context) !=
+ BT_CTF_TYPE_ID_STRUCT) {
ret = -1;
goto end;
}
- bt_get(context);
bt_put(event_class->context);
- event_class->context = context;
+ event_class->context = bt_get(context);
end:
return ret;
{
assert(event_class);
event_class->frozen = 1;
+ event_class->name = bt_ctf_event_class_get_name(event_class);
+ event_class->id = bt_ctf_event_class_get_id(event_class);
bt_ctf_field_type_freeze(event_class->context);
bt_ctf_field_type_freeze(event_class->fields);
bt_ctf_attributes_freeze(event_class->attributes);