* http://www.efficios.com/ctf
*/
-/* For enum bt_event_class_log_level */
+/* For enum bt_event_class_status, enum bt_event_class_log_level */
#include <babeltrace/trace-ir/event-class-const.h>
/* For bt_event_class, bt_stream_class */
extern bt_stream_class *bt_event_class_borrow_stream_class(
bt_event_class *event_class);
-extern int bt_event_class_set_name(bt_event_class *event_class,
- const char *name);
+extern enum bt_event_class_status bt_event_class_set_name(
+ bt_event_class *event_class, const char *name);
extern void bt_event_class_set_log_level(
bt_event_class *event_class,
enum bt_event_class_log_level log_level);
-extern int bt_event_class_set_emf_uri(
+extern enum bt_event_class_status bt_event_class_set_emf_uri(
bt_event_class *event_class,
const char *emf_uri);
-extern int bt_event_class_set_specific_context_field_class(
- bt_event_class *event_class,
+extern enum bt_event_class_status
+bt_event_class_set_specific_context_field_class(bt_event_class *event_class,
bt_field_class *field_class);
-extern int bt_event_class_set_payload_field_class(
+extern enum bt_event_class_status bt_event_class_set_payload_field_class(
bt_event_class *event_class,
bt_field_class *field_class);
return event_class->name.value;
}
-int bt_event_class_set_name(struct bt_event_class *event_class,
- const char *name)
+enum bt_event_class_status bt_event_class_set_name(
+ struct bt_event_class *event_class, const char *name)
{
BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
BT_ASSERT_PRE_NON_NULL(name, "Name");
g_string_assign(event_class->name.str, name);
event_class->name.value = event_class->name.str->str;
BT_LIB_LOGV("Set event class's name: %!+E", event_class);
- return 0;
+ return BT_EVENT_CLASS_STATUS_OK;
}
uint64_t bt_event_class_get_id(const struct bt_event_class *event_class)
return event_class->emf_uri.value;
}
-int bt_event_class_set_emf_uri(
+enum bt_event_class_status bt_event_class_set_emf_uri(
struct bt_event_class *event_class,
const char *emf_uri)
{
g_string_assign(event_class->emf_uri.str, emf_uri);
event_class->emf_uri.value = event_class->emf_uri.str->str;
BT_LIB_LOGV("Set event class's EMF URI: %!+E", event_class);
- return 0;
+ return BT_EVENT_CLASS_STATUS_OK;
}
struct bt_stream_class *bt_event_class_borrow_stream_class(
return event_class->specific_context_fc;
}
-int bt_event_class_set_specific_context_field_class(
+enum bt_event_class_status bt_event_class_set_specific_context_field_class(
struct bt_event_class *event_class,
struct bt_field_class *field_class)
{
ret = bt_resolve_field_paths(field_class, &resolve_ctx);
if (ret) {
+ /*
+ * This is the only reason for which
+ * bt_resolve_field_paths() can fail: anything else
+ * would be because a precondition is not satisfied.
+ */
+ ret = BT_EVENT_CLASS_STATUS_NOMEM;
goto end;
}
return event_class->payload_fc;
}
-int bt_event_class_set_payload_field_class(
+enum bt_event_class_status bt_event_class_set_payload_field_class(
struct bt_event_class *event_class,
struct bt_field_class *field_class)
{
ret = bt_resolve_field_paths(field_class, &resolve_ctx);
if (ret) {
+ /*
+ * This is the only reason for which
+ * bt_resolve_field_paths() can fail: anything else
+ * would be because a precondition is not satisfied.
+ */
+ ret = BT_EVENT_CLASS_STATUS_NOMEM;
goto end;
}