summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
669ab65)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
+enum bt_stream_class_status {
+ BT_STREAM_CLASS_STATUS_OK = 0,
+ BT_STREAM_CLASS_STATUS_NOMEM = -12,
+};
+
extern const bt_trace_class *bt_stream_class_borrow_trace_class_const(
const bt_stream_class *stream_class);
extern const bt_trace_class *bt_stream_class_borrow_trace_class_const(
const bt_stream_class *stream_class);
*/
#include <babeltrace/types.h>
*/
#include <babeltrace/types.h>
+/* For enum bt_stream_class_status */
+#include <babeltrace/trace-ir/stream-class-const.h>
+
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
extern "C" {
#endif
extern bt_trace_class *bt_stream_class_borrow_trace_class(
bt_stream_class *stream_class);
extern bt_trace_class *bt_stream_class_borrow_trace_class(
bt_stream_class *stream_class);
-extern int bt_stream_class_set_name(bt_stream_class *stream_class,
- const char *name);
+extern enum bt_stream_class_status bt_stream_class_set_name(
+ bt_stream_class *stream_class, const char *name);
extern void bt_stream_class_set_assigns_automatic_event_class_id(
bt_stream_class *stream_class, bt_bool value);
extern void bt_stream_class_set_assigns_automatic_event_class_id(
bt_stream_class *stream_class, bt_bool value);
extern void bt_stream_class_set_assigns_automatic_stream_id(
bt_stream_class *stream_class, bt_bool value);
extern void bt_stream_class_set_assigns_automatic_stream_id(
bt_stream_class *stream_class, bt_bool value);
-extern int bt_stream_class_set_packet_context_field_class(
+extern enum bt_stream_class_status
+bt_stream_class_set_packet_context_field_class(
bt_stream_class *stream_class,
bt_field_class *field_class);
bt_stream_class *stream_class,
bt_field_class *field_class);
-extern int bt_stream_class_set_event_header_field_class(
+extern enum bt_stream_class_status
+bt_stream_class_set_event_header_field_class(
bt_stream_class *stream_class,
bt_field_class *field_class);
bt_stream_class *stream_class,
bt_field_class *field_class);
+extern enum bt_stream_class_status
bt_stream_class_set_event_common_context_field_class(
bt_stream_class *stream_class,
bt_field_class *field_class);
bt_stream_class_set_event_common_context_field_class(
bt_stream_class *stream_class,
bt_field_class *field_class);
extern bt_clock_class *bt_stream_class_borrow_default_clock_class(
bt_stream_class *stream_class);
extern bt_clock_class *bt_stream_class_borrow_default_clock_class(
bt_stream_class *stream_class);
-extern int bt_stream_class_set_default_clock_class(
+extern enum bt_stream_class_status bt_stream_class_set_default_clock_class(
bt_stream_class *stream_class,
bt_clock_class *clock_class);
bt_stream_class *stream_class,
bt_clock_class *clock_class);
return stream_class->name.value;
}
return stream_class->name.value;
}
-int bt_stream_class_set_name(
+enum bt_stream_class_status bt_stream_class_set_name(
struct bt_stream_class *stream_class,
const char *name)
{
struct bt_stream_class *stream_class,
const char *name)
{
g_string_assign(stream_class->name.str, name);
stream_class->name.value = stream_class->name.str->str;
BT_LIB_LOGV("Set stream class's name: %!+S", stream_class);
g_string_assign(stream_class->name.str, name);
stream_class->name.value = stream_class->name.str->str;
BT_LIB_LOGV("Set stream class's name: %!+S", stream_class);
+ return BT_STREAM_CLASS_STATUS_OK;
}
uint64_t bt_stream_class_get_id(const struct bt_stream_class *stream_class)
}
uint64_t bt_stream_class_get_id(const struct bt_stream_class *stream_class)
return stream_class->packet_context_fc;
}
return stream_class->packet_context_fc;
}
-int bt_stream_class_set_packet_context_field_class(
+enum bt_stream_class_status bt_stream_class_set_packet_context_field_class(
struct bt_stream_class *stream_class,
struct bt_field_class *field_class)
{
struct bt_stream_class *stream_class,
struct bt_field_class *field_class)
{
bt_stream_class_borrow_trace_class_inline(stream_class)->packet_header_fc;
ret = bt_resolve_field_paths(field_class, &resolve_ctx);
if (ret) {
bt_stream_class_borrow_trace_class_inline(stream_class)->packet_header_fc;
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_STREAM_CLASS_STATUS_NOMEM;
return stream_class->event_header_fc;
}
return stream_class->event_header_fc;
}
-int bt_stream_class_set_event_header_field_class(
+enum bt_stream_class_status bt_stream_class_set_event_header_field_class(
struct bt_stream_class *stream_class,
struct bt_field_class *field_class)
{
struct bt_stream_class *stream_class,
struct bt_field_class *field_class)
{
resolve_ctx.packet_context = stream_class->packet_context_fc;
ret = bt_resolve_field_paths(field_class, &resolve_ctx);
if (ret) {
resolve_ctx.packet_context = stream_class->packet_context_fc;
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_STREAM_CLASS_STATUS_NOMEM;
return stream_class->event_common_context_fc;
}
return stream_class->event_common_context_fc;
}
-int bt_stream_class_set_event_common_context_field_class(
+enum bt_stream_class_status
+bt_stream_class_set_event_common_context_field_class(
struct bt_stream_class *stream_class,
struct bt_field_class *field_class)
{
struct bt_stream_class *stream_class,
struct bt_field_class *field_class)
{
resolve_ctx.event_header = stream_class->event_header_fc;
ret = bt_resolve_field_paths(field_class, &resolve_ctx);
if (ret) {
resolve_ctx.event_header = stream_class->event_header_fc;
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_STREAM_CLASS_STATUS_NOMEM;
((struct bt_stream_class *) stream_class)->frozen = true;
}
((struct bt_stream_class *) stream_class)->frozen = true;
}
-int bt_stream_class_set_default_clock_class(
+enum bt_stream_class_status bt_stream_class_set_default_clock_class(
struct bt_stream_class *stream_class,
struct bt_clock_class *clock_class)
{
struct bt_stream_class *stream_class,
struct bt_clock_class *clock_class)
{
bt_clock_class_freeze(clock_class);
BT_LIB_LOGV("Set stream class's default clock class: %!+S",
stream_class);
bt_clock_class_freeze(clock_class);
BT_LIB_LOGV("Set stream class's default clock class: %!+S",
stream_class);
+ return BT_STREAM_CLASS_STATUS_OK;
}
struct bt_clock_class *bt_stream_class_borrow_default_clock_class(
}
struct bt_clock_class *bt_stream_class_borrow_default_clock_class(