Remove the concept of event class attributes
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 15 Jun 2017 22:38:45 +0000 (18:38 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 16 Jun 2017 19:54:34 +0000 (15:54 -0400)
The concept of event class attributes could be confusing with the
eventual concept of user attributes to be introduced in CTF 2. This is
not strictly required for Babeltrace 2.0: we can create dedicated
accessors for CTF 1.8 attributes (ID, name, log level, EMF URI). This is
what this patch does, removing the attributes API and adding:

* bt_ctf_event_class_get_log_level()
* bt_ctf_event_class_set_log_level()
* bt_ctf_event_class_get_emf_uri()
* bt_ctf_event_class_set_emf_uri()

There are already accessors for the name and ID attributes. As to the
stream class ID (`stream_id`) attribute, it should never have existed in
the first place because you can always use the parent stream class's ID.
Thus this patch also fixes a bug where there was a synchronization
problem between a stream class's ID and the `stream_id` attribute of its
contained event classes.

The bt_ctf_event_class_get_log_level() and
bt_ctf_event_class_set_log_level() functions use the new
`enum bt_ctf_event_class_log_level` enumeration which contains all the
log levels of LTTng-UST, which happen to be CTF 1.8's log levels too
because Babeltrace 1 prints those names for those values whatever the
trace's producer. A translation is performed from the numeric values to
this enumeration in plugins/ctf/common/metadata/visitor-generate-ir.c,
and the reverse is done in plugins/text/pretty/print.c. Knowing this,
the `loglevel_string` attribute that visitor-generate-ir.c used to add
to event classes (and which plugins/text/pretty/print.c used to
pretty-print the names) is removed. This was also an issue because
Babeltrace 1 does not know `loglevel_string` and sink.ctf.fs, through
the CTF writer implementation, was serializing this attribute in the
generated metadata.

tests/lib/test_ctf_writer.c is updated to test the individual accessors
instead of the generic attribute API.

plugins/libctfcopytrace/ctfcopytrace.c is updated to copy the known
attributes intead of using the generic attribute API.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
include/babeltrace/ctf-ir/event-class-internal.h
include/babeltrace/ctf-ir/event-class.h
lib/ctf-ir/event-class.c
lib/ctf-ir/stream-class.c
plugins/ctf/common/metadata/visitor-generate-ir.c
plugins/libctfcopytrace/ctfcopytrace.c
plugins/text/pretty/print.c
tests/lib/test_ctf_writer.c

index e6475fcdc44ec5bd73c861770a2f680dace0e561..0844061bcbb601677962c496987a5c46ec2dbfc7 100644 (file)
 #include <babeltrace/ctf-ir/trace-internal.h>
 #include <babeltrace/ctf-ir/stream-class.h>
 #include <babeltrace/ctf-ir/stream.h>
+#include <babeltrace/ctf-ir/event-class.h>
 #include <babeltrace/object-internal.h>
 #include <glib.h>
 
-#define BT_CTF_EVENT_CLASS_ATTR_ID_INDEX       0
-#define BT_CTF_EVENT_CLASS_ATTR_NAME_INDEX     1
-
 struct bt_ctf_event_class {
        struct bt_object base;
-       struct bt_value *attributes;
        /* Structure type containing the event's context */
        struct bt_ctf_field_type *context;
        /* Structure type containing the event's fields */
@@ -57,9 +54,11 @@ struct bt_ctf_event_class {
         */
        int valid;
 
-       /* Cached values */
-       const char *name;
+       /* Attributes */
+       GString *name;
        int64_t id;
+       enum bt_ctf_event_class_log_level log_level;
+       GString *emf_uri;
 };
 
 BT_HIDDEN
@@ -74,10 +73,6 @@ void bt_ctf_event_class_set_native_byte_order(
                struct bt_ctf_event_class *event_class,
                int byte_order);
 
-BT_HIDDEN
-int bt_ctf_event_class_set_stream_id(struct bt_ctf_event_class *event_class,
-               uint64_t stream_id);
-
 static inline
 struct bt_ctf_stream_class *bt_ctf_event_class_borrow_stream_class(
                struct bt_ctf_event_class *event_class)
@@ -86,4 +81,48 @@ struct bt_ctf_stream_class *bt_ctf_event_class_borrow_stream_class(
        return (void *) bt_object_borrow_parent(event_class);
 }
 
+static inline
+const char *bt_ctf_event_class_log_level_string(
+               enum bt_ctf_event_class_log_level level)
+{
+       switch (level) {
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN:
+               return "BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN";
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED:
+               return "BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED";
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY:
+               return "BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY";
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT:
+               return "BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT";
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL:
+               return "BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL";
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR:
+               return "BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR";
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING:
+               return "BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING";
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE:
+               return "BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE";
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO:
+               return "BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO";
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM:
+               return "BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM";
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM:
+               return "BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM";
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS:
+               return "BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS";
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE:
+               return "BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE";
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT:
+               return "BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT";
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION:
+               return "BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION";
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE:
+               return "BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE";
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG:
+               return "BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG";
+       default:
+               return "(unknown)";
+       }
+};
+
 #endif /* BABELTRACE_CTF_IR_EVENT_CLASS_INTERNAL_H */
index fec7aa875a6e29b8227a0153ea83bcd03ed2bada..8a3b334bc5651f7e7216e8140d12c59a1176eb84 100644 (file)
@@ -50,12 +50,14 @@ extern "C" {
 A CTF IR <strong><em>event class</em></strong> is a template that you
 can use to create concrete \link ctfirevent CTF IR events\endlink.
 
-An event class has the following properties, both of which \em must
-be unique amongst all the event classes contained in the same
-\link ctfirstreamclass CTF IR stream class\endlink:
+An event class has the following properties:
 
 - A \b name.
-- A numeric \b ID.
+- A numeric \b ID (\em must be unique amongst all the event classes
+  contained in the same
+  \link ctfirstreamclass CTF IR stream class\endlink).
+- A optional <strong>log level</strong>.
+- An optional <strong>Eclipse Modeling Framework URI</strong>.
 
 A CTF IR event class owns two
 \link ctfirfieldtypes field types\endlink:
@@ -113,6 +115,62 @@ struct bt_ctf_field;
 struct bt_ctf_field_type;
 struct bt_ctf_stream_class;
 
+/**
+@brief Log level of an event class.
+*/
+enum bt_ctf_event_class_log_level {
+       /// Unknown, used for errors.
+       BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN            = -1,
+
+       /// Unspecified log level.
+       BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED        = 255,
+
+       /// System is unusable.
+       BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY          = 0,
+
+       /// Action must be taken immediately.
+       BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT              = 1,
+
+       /// Critical conditions.
+       BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL           = 2,
+
+       /// Error conditions.
+       BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR              = 3,
+
+       /// Warning conditions.
+       BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING            = 4,
+
+       /// Normal, but significant, condition.
+       BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE             = 5,
+
+       /// Informational message.
+       BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO               = 6,
+
+       /// Debug information with system-level scope (set of programs).
+       BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM       = 7,
+
+       /// Debug information with program-level scope (set of processes).
+       BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM      = 8,
+
+       /// Debug information with process-level scope (set of modules).
+       BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS      = 9,
+
+       /// Debug information with module (executable/library) scope (set of units).
+       BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE       = 10,
+
+       /// Debug information with compilation unit scope (set of functions).
+       BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT         = 11,
+
+       /// Debug information with function-level scope.
+       BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION     = 12,
+
+       /// Debug information with line-level scope (default log level).
+       BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE         = 13,
+
+       /// Debug-level message.
+       BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG              = 14,
+};
+
 /**
 @name Creation and parent access functions
 @{
@@ -133,6 +191,10 @@ is still unset when you call bt_ctf_stream_class_add_event_class(), then
 the stream class assigns a unique ID to this event class before
 freezing it.
 
+The created event class's log level is initially set to
+#BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED and it has no Eclipse Modeling
+Framework URI.
+
 @param[in] name        Name of the event class to create (copied on success).
 @returns       Created event class, or \c NULL on error.
 
@@ -228,133 +290,99 @@ extern int bt_ctf_event_class_set_id(
                struct bt_ctf_event_class *event_class, uint64_t id);
 
 /**
-@brief Returns the number of attributes contained in the CTF IR event
-       class \p event_class.
+@brief Returns the log level of the CTF IR event class \p event_class.
 
-@param[in] event_class Event class of which to get the number
-                       of contained attributes.
-@returns               Number of contained attributes in
-                       \p event_class, or a negative value on error.
+@param[in] event_class Event class of which to get the log level.
+@returns               Log level of event class \p event_class,
+                       #BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED if
+                       not specified, or
+                       #BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN on error.
 
 @prenotnull{event_class}
 @postrefcountsame{event_class}
 
-@sa bt_ctf_event_class_get_attribute_name_by_index(): Returns the name
-       of the attribute of a given event class at a given index.
-@sa bt_ctf_event_class_get_attribute_value_by_index(): Returns the value
-       of the attribute of a given event class at a given index.
+@sa bt_ctf_event_class_set_log_level(): Sets the log level of a given
+       event class.
 */
-extern int64_t bt_ctf_event_class_get_attribute_count(
+extern enum bt_ctf_event_class_log_level bt_ctf_event_class_get_log_level(
                struct bt_ctf_event_class *event_class);
 
 /**
-@brief Returns the name of the attribute at the index \p index of the
-       CTF IR event class \p event_class.
-
-On success, \p event_class remains the sole owner of the returned
-string.
+@brief Sets the log level of the CTF IR event class
+       \p event_class to \p log_level.
 
-@param[in] event_class Event class of which to get the name
-                       of an attribute.
-@param[in] index       Index of the attribute of which to get the name.
-@returns               Attribute name, or \c NULL on error.
+@param[in] event_class Event class of which to set the log level.
+@param[in] log_level   Log level of the event class.
+@returns               0 on success, or a negative value on error.
 
 @prenotnull{event_class}
-@pre \p index is lesser than the number of attributes contained by
-       \p event_class.
+@prehot{event_class}
+@pre \p log_level is #BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED,
+       #BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY,
+       #BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT,
+       #BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL,
+       #BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR,
+       #BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING,
+       #BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE,
+       #BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO,
+       #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM,
+       #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM,
+       #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS,
+       #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE,
+       #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT,
+       #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION,
+       #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE, or
+       #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG.
 @postrefcountsame{event_class}
 
-@sa bt_ctf_event_class_get_attribute_value_by_index(): Returns the value
-       of the attribute of a given event class at a given index.
+@sa bt_ctf_event_class_get_log_level(): Returns the log level of a given
+       event class.
 */
-extern const char *
-bt_ctf_event_class_get_attribute_name_by_index(
-               struct bt_ctf_event_class *event_class, uint64_t index);
+extern int bt_ctf_event_class_set_log_level(
+               struct bt_ctf_event_class *event_class,
+               enum bt_ctf_event_class_log_level log_level);
 
 /**
-@brief Returns the value of the attribute at the index \p index of the
-       CTF IR event class \p event_class.
+@brief  Returns the Eclipse Modeling Framework URI of the CTF IR event
+       class \p event_class.
 
-@param[in] event_class Event class of which to get the value
-                       of an attribute.
-@param[in] index       Index of the attribute of which to get the value.
-@returns               Attribute value, or \c NULL on error.
+@param[in] event_class Event class of which to get the
+                       Eclipse Modeling Framework URI.
+@returns               Eclipse Modeling Framework URI of event
+                       class \p event_class, or \c NULL on error.
 
 @prenotnull{event_class}
-@pre \p index is lesser than the number of attributes contained by
-       \p event_class.
-@postsuccessrefcountretinc
 @postrefcountsame{event_class}
 
-@sa bt_ctf_event_class_get_attribute_name_by_index(): Returns the name
-       of the attribute of a given event class at a given index.
+@sa bt_ctf_event_class_set_emf_uri(): Sets the Eclipse Modeling
+       Framework URI of a given event class.
 */
-extern struct bt_value *
-bt_ctf_event_class_get_attribute_value_by_index(
-               struct bt_ctf_event_class *event_class, uint64_t index);
-
-/**
-@brief Returns the value of the attribute named \p name of the CTF IR
-       event class \p event_class.
-
-On success, the reference count of the returned value object is
-incremented.
-
-@param[in] event_class Event class of which to get the value
-                       of an attribute.
-@param[in] name                Name of the attribute to get.
-@returns               Attribute value, or \c NULL on error.
-
-@prenotnull{event_class}
-@prenotnull{name}
-@postsuccessrefcountretinc
-@postrefcountsame{event_class}
-*/
-extern struct bt_value *
-bt_ctf_event_class_get_attribute_value_by_name(
-               struct bt_ctf_event_class *event_class, const char *name);
+extern const char *bt_ctf_event_class_get_emf_uri(
+               struct bt_ctf_event_class *event_class);
 
 /**
-@brief Sets the attribute named \p name of the CTF IR event class
-       \p event_class to the value \p value.
-
-Valid attributes, as of Babeltrace \btversion, are:
-
-- <code>id</code>: \em must be an integer value object with a raw value
-  that is greater than or equal to 0. This represents the event class's
-  numeric ID and you can also set it with bt_ctf_event_class_set_id().
+@brief Sets the Eclipse Modeling Framework URI of the CTF IR event class
+       \p event_class to \p emf_uri, or unsets the event class's EMF URI.
 
-- <code>name</code>: must be a string value object. This represents
-  the name of the event class.
-
-- <code>loglevel</code>: must be an integer value object with a raw
-  value greater than or equal to 0. This represents the numeric log level
-  associated with this event class. Log level values
-  are application-specific.
-
-- <code>model.emf.uri</code>: must be a string value object. This
-  represents the application-specific Eclipse Modeling Framework URI
-  of the event class.
-
-@param[in] event_class Event class of which to set an
-                       attribute.
-@param[in] name                Attribute name (copied on success).
-@param[in] value       Attribute value.
-@returns               0 on success, or a negative value on error.
+@param[in] event_class Event class of which to set the
+                       Eclipse Modeling Framework URI.
+@param[in] emf_uri     Eclipse Modeling Framework URI of the
+                       event class (copied on success), or \c NULL
+                       to unset the current EMF URI.
+@returns               0 on success, or a negative value if there's
+                       no EMF URI or on error.
 
 @prenotnull{event_class}
-@prenotnull{name}
-@prenotnull{value}
+@prenotnull{emf_uri}
 @prehot{event_class}
 @postrefcountsame{event_class}
-@postsuccessrefcountinc{value}
 
-@sa bt_ctf_event_class_get_attribute_value_by_name(): Returns the
-       attribute of a given event class having a given name.
+@sa bt_ctf_event_class_get_emf_uri(): Returns the Eclipse Modeling
+       Framework URI of a given event class.
 */
-extern int bt_ctf_event_class_set_attribute(
-               struct bt_ctf_event_class *event_class, const char *name,
-               struct bt_value *value);
+extern int bt_ctf_event_class_set_emf_uri(
+               struct bt_ctf_event_class *event_class,
+               const char *emf_uri);
 
 /** @} */
 
index 67cb1575ec054b4e05a797c2dacf7bba16e7ce23..b8bd96ece18384c66ab317e1baa6f29f78783d7f 100644 (file)
@@ -52,20 +52,23 @@ void bt_ctf_event_class_destroy(struct bt_object *obj);
 
 struct bt_ctf_event_class *bt_ctf_event_class_create(const char *name)
 {
-       int ret;
        struct bt_value *obj = NULL;
        struct bt_ctf_event_class *event_class = NULL;
 
        BT_LOGD("Creating event class object: name=\"%s\"",
                name);
 
+       if (!name) {
+               BT_LOGW_STR("Invalid parameter: name is NULL.");
+               goto error;
+       }
+
        event_class = g_new0(struct bt_ctf_event_class, 1);
        if (!event_class) {
                BT_LOGE_STR("Failed to allocate one event class.");
                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) {
@@ -73,42 +76,20 @@ struct bt_ctf_event_class *bt_ctf_event_class_create(const char *name)
                goto error;
        }
 
-       event_class->attributes = bt_ctf_attributes_create();
-       if (!event_class->attributes) {
-               BT_LOGE_STR("Cannot create event class's attributes object.");
-               goto error;
-       }
-
-       obj = bt_value_integer_create_init(-1);
-       if (!obj) {
-               BT_LOGE_STR("Cannot create integer value object.");
-               goto error;
-       }
-
-       ret = bt_ctf_attributes_set_field_value(event_class->attributes,
-               "id", obj);
-       if (ret) {
-               BT_LOGE("Cannot set event class's attributes's `id` field: ret=%d",
-                       ret);
-               goto error;
-       }
-
-       BT_PUT(obj);
-
-       obj = bt_value_string_create_init(name);
-       if (!obj) {
-               BT_LOGE_STR("Cannot create string value object.");
+       event_class->id = -1;
+       event_class->name = g_string_new(name);
+       if (!event_class->name) {
+               BT_LOGE_STR("Failed to allocate a GString.");
                goto error;
        }
 
-       ret = bt_ctf_attributes_set_field_value(event_class->attributes,
-               "name", obj);
-       if (ret) {
-               BT_LOGE("Cannot set event class's attributes's `name` field: ret=%d",
-                       ret);
+       event_class->emf_uri = g_string_new(NULL);
+       if (!event_class->emf_uri) {
+               BT_LOGE_STR("Failed to allocate a GString.");
                goto error;
        }
 
+       event_class->log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED;
        BT_PUT(obj);
        BT_LOGD("Created event class object: addr=%p, name=\"%s\"",
                event_class, bt_ctf_event_class_get_name(event_class));
@@ -122,36 +103,22 @@ error:
 
 const char *bt_ctf_event_class_get_name(struct bt_ctf_event_class *event_class)
 {
-       struct bt_value *obj = NULL;
        const char *name = NULL;
-       int ret;
 
        if (!event_class) {
                BT_LOGW_STR("Invalid parameter: event class is NULL.");
                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);
-       assert(obj);
-       ret = bt_value_string_get(obj, &name);
-       assert(ret == 0);
+       name = event_class->name->str;
 
 end:
-       BT_PUT(obj);
        return name;
 }
 
 int64_t bt_ctf_event_class_get_id(struct bt_ctf_event_class *event_class)
 {
-       struct bt_value *obj = NULL;
        int64_t ret = 0;
-       int int_ret;
 
        if (!event_class) {
                BT_LOGW_STR("Invalid parameter: event class is NULL.");
@@ -159,26 +126,9 @@ int64_t bt_ctf_event_class_get_id(struct bt_ctf_event_class *event_class)
                goto end;
        }
 
-       if (event_class->id >= 0) {
-               ret = (int64_t) event_class->id;
-               goto end;
-       }
-
-       obj = bt_ctf_attributes_get_field_value(event_class->attributes,
-               BT_CTF_EVENT_CLASS_ATTR_ID_INDEX);
-       assert(obj);
-       int_ret = bt_value_integer_get(obj, &ret);
-       assert(int_ret == 0);
-       if (ret < 0) {
-               /* means ID is not set */
-               BT_LOGV("Event class's ID is not set: addr=%p, name=\"%s\"",
-                       event_class, bt_ctf_event_class_get_name(event_class));
-               ret = (int64_t) -1;
-               goto end;
-       }
+       ret = event_class->id;
 
 end:
-       BT_PUT(obj);
        return ret;
 }
 
@@ -186,7 +136,6 @@ int bt_ctf_event_class_set_id(struct bt_ctf_event_class *event_class,
                uint64_t id_param)
 {
        int ret = 0;
-       struct bt_value *obj = NULL;
        int64_t id = (int64_t) id_param;
 
        if (!event_class) {
@@ -213,222 +162,150 @@ int bt_ctf_event_class_set_id(struct bt_ctf_event_class *event_class,
                goto end;
        }
 
-       obj = bt_ctf_attributes_get_field_value(event_class->attributes,
-               BT_CTF_EVENT_CLASS_ATTR_ID_INDEX);
-       assert(obj);
-       ret = bt_value_integer_set(obj, id);
-       assert(ret == 0);
+       event_class->id = id;
        BT_LOGV("Set event class's ID: "
                "addr=%p, name=\"%s\", id=%" PRId64,
                event_class, bt_ctf_event_class_get_name(event_class), id);
 
 end:
-       BT_PUT(obj);
        return ret;
 }
 
-int bt_ctf_event_class_set_attribute(
-               struct bt_ctf_event_class *event_class, const char *name,
-               struct bt_value *value)
+enum bt_ctf_event_class_log_level bt_ctf_event_class_get_log_level(
+               struct bt_ctf_event_class *event_class)
+{
+       enum bt_ctf_event_class_log_level log_level;
+
+       if (!event_class) {
+               BT_LOGW_STR("Invalid parameter: event class is NULL.");
+               log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN;
+               goto end;
+       }
+
+       log_level = event_class->log_level;
+
+end:
+       return log_level;
+}
+
+int bt_ctf_event_class_set_log_level(struct bt_ctf_event_class *event_class,
+               enum bt_ctf_event_class_log_level log_level)
 {
        int ret = 0;
 
-       if (!event_class || !name || !value) {
-               BT_LOGW("Invalid parameter: event class, name, or value is NULL: "
-                       "event-class-addr=%p, name-addr=%p, value-addr=%p",
-                       event_class, name, value);
+       if (!event_class) {
+               BT_LOGW_STR("Invalid parameter: event class is NULL.");
                ret = -1;
                goto end;
        }
 
        if (event_class->frozen) {
                BT_LOGW("Invalid parameter: event class is frozen: "
-                       "addr=%p, name=\"%s\", id=%" PRId64 ", attr-name=\"%s\"",
+                       "addr=%p, name=\"%s\", id=%" PRId64,
                        event_class, bt_ctf_event_class_get_name(event_class),
-                       bt_ctf_event_class_get_id(event_class), name);
+                       bt_ctf_event_class_get_id(event_class));
                ret = -1;
                goto end;
        }
 
-       if (!strcmp(name, "id") || !strcmp(name, "loglevel") ||
-                       !strcmp(name, "stream_id")) {
-               if (!bt_value_is_integer(value)) {
-                       BT_LOGW("Invalid parameter: this event class's attribute must have an integer value: "
-                               "event-class-addr=%p, event-class-name=\"%s\", "
-                               "event-class-id=%" PRId64 ", attr-name=\"%s\", "
-                               "attr-type=%s", event_class,
-                               bt_ctf_event_class_get_name(event_class),
-                               bt_ctf_event_class_get_id(event_class), name,
-                               bt_value_type_string(bt_value_get_type(value)));
-                       ret = -1;
-                       goto end;
-               }
-       } else if (!strcmp(name, "name") || !strcmp(name, "model.emf.uri") ||
-                       !strcmp(name, "loglevel_string")) {
-               if (!bt_value_is_string(value)) {
-                       BT_LOGW("Invalid parameter: this event class's attribute must have a string value: "
-                               "event-class-addr=%p, event-class-name=\"%s\", "
-                               "event-class-id=%" PRId64 ", attr-name=\"%s\", "
-                               "attr-type=%s", event_class,
-                               bt_ctf_event_class_get_name(event_class),
-                               bt_ctf_event_class_get_id(event_class), name,
-                               bt_value_type_string(bt_value_get_type(value)));
-                       ret = -1;
-                       goto end;
-               }
-       } else {
-               /* unknown attribute */
-               BT_LOGW("Invalid parameter: unknown event class's attribute name: "
-                       "event-class-addr=%p, event-class-name=\"%s\", "
-                       "event-class-id=%" PRId64 ", attr-name=\"%s\"",
+       switch (log_level) {
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED:
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY:
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT:
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL:
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR:
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING:
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE:
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO:
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM:
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM:
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS:
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE:
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT:
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION:
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE:
+       case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG:
+               break;
+       default:
+               BT_LOGW("Invalid parameter: unknown event class log level: "
+                       "addr=%p, name=\"%s\", id=%" PRId64 ", log-level=%d",
                        event_class, bt_ctf_event_class_get_name(event_class),
-                       bt_ctf_event_class_get_id(event_class), name);
+                       bt_ctf_event_class_get_id(event_class), log_level);
                ret = -1;
                goto end;
        }
 
-       /* "id" special case: >= 0 */
-       if (!strcmp(name, "id")) {
-               int64_t val;
-
-               ret = bt_value_integer_get(value, &val);
-               assert(ret == 0);
-               BT_LOGV("Setting event's ID: id=%" PRId64, val);
-               ret = bt_ctf_event_class_set_id(event_class, (uint64_t) val);
-               if (ret) {
-                       goto end;
-               }
-       }
-
-       ret = bt_ctf_attributes_set_field_value(event_class->attributes,
-                       name, value);
-       assert(ret == 0);
-
-       if (BT_LOG_ON_VERBOSE) {
-               if (bt_value_is_integer(value)) {
-                       int64_t val;
-
-                       ret = bt_value_integer_get(value, &val);
-                       assert(ret == 0);
-                       BT_LOGV("Set event class's integer attribute: "
-                               "event-class-addr=%p, event-class-name=\"%s\", "
-                               "event-class-id=%" PRId64 ", attr-name=\"%s\", "
-                               "attr-value=%" PRId64,
-                               event_class, bt_ctf_event_class_get_name(event_class),
-                               bt_ctf_event_class_get_id(event_class), name,
-                               val);
-               } else if (bt_value_is_string(value)) {
-                       const char *val;
-
-                       ret = bt_value_string_get(value, &val);
-                       assert(ret == 0);
-                       BT_LOGV("Set event class's string attribute: "
-                               "event-class-addr=%p, event-class-name=\"%s\", "
-                               "event-class-id=%" PRId64 ", attr-name=\"%s\", "
-                               "attr-value=\"%s\"",
-                               event_class, bt_ctf_event_class_get_name(event_class),
-                               bt_ctf_event_class_get_id(event_class), name,
-                               val);
-               }
-       }
+       event_class->log_level = log_level;
+       BT_LOGV("Set event class's log level: "
+               "addr=%p, name=\"%s\", id=%" PRId64 ", log-level=%s",
+               event_class, bt_ctf_event_class_get_name(event_class),
+               bt_ctf_event_class_get_id(event_class),
+               bt_ctf_event_class_log_level_string(log_level));
 
 end:
        return ret;
 }
 
-int64_t bt_ctf_event_class_get_attribute_count(
+const char *bt_ctf_event_class_get_emf_uri(
                struct bt_ctf_event_class *event_class)
 {
-       int64_t ret;
+       const char *emf_uri = NULL;
 
        if (!event_class) {
                BT_LOGW_STR("Invalid parameter: event class is NULL.");
-               ret = (int64_t) -1;
                goto end;
        }
 
-       ret = bt_ctf_attributes_get_count(event_class->attributes);
-       assert(ret >= 0);
+       if (event_class->emf_uri->len > 0) {
+               emf_uri = event_class->emf_uri->str;
+       }
 
 end:
-       return ret;
+       return emf_uri;
 }
 
-const char *
-bt_ctf_event_class_get_attribute_name_by_index(
-               struct bt_ctf_event_class *event_class, uint64_t index)
+int bt_ctf_event_class_set_emf_uri(struct bt_ctf_event_class *event_class,
+               const char *emf_uri)
 {
-       const char *ret;
+       int ret = 0;
 
        if (!event_class) {
                BT_LOGW_STR("Invalid parameter: event class is NULL.");
-               ret = NULL;
+               ret = -1;
                goto end;
        }
 
-       ret = bt_ctf_attributes_get_field_name(event_class->attributes, index);
-       if (!ret) {
-               BT_LOGW("Cannot get event class's attribute name by index: "
-                       "addr=%p, name=\"%s\", id=%" PRId64 ", index=%" PRIu64,
-                       event_class, bt_ctf_event_class_get_name(event_class),
-                       bt_ctf_event_class_get_id(event_class), index);
-       }
-
-end:
-       return ret;
-}
-
-struct bt_value *
-bt_ctf_event_class_get_attribute_value_by_index(
-               struct bt_ctf_event_class *event_class, uint64_t index)
-{
-       struct bt_value *ret;
-
-       if (!event_class) {
-               BT_LOGW_STR("Invalid parameter: event class is NULL.");
-               ret = NULL;
+       if (emf_uri && strlen(emf_uri) == 0) {
+               BT_LOGW_STR("Invalid parameter: EMF URI is empty.");
+               ret = -1;
                goto end;
        }
 
-       ret = bt_ctf_attributes_get_field_value(event_class->attributes, index);
-       if (!ret) {
-               BT_LOGW("Cannot get event class's attribute value by index: "
-                       "addr=%p, name=\"%s\", id=%" PRId64 ", index=%" PRIu64,
+       if (event_class->frozen) {
+               BT_LOGW("Invalid parameter: event class is frozen: "
+                       "addr=%p, name=\"%s\", id=%" PRId64,
                        event_class, bt_ctf_event_class_get_name(event_class),
-                       bt_ctf_event_class_get_id(event_class), index);
-       }
-
-end:
-       return ret;
-}
-
-struct bt_value *
-bt_ctf_event_class_get_attribute_value_by_name(
-               struct bt_ctf_event_class *event_class, const char *name)
-{
-       struct bt_value *ret;
-
-       if (!event_class || !name) {
-               BT_LOGW("Invalid parameter: event class or name is NULL: "
-                       "event-class-addr=%p, name-addr=%p",
-                       event_class, name);
-               ret = NULL;
+                       bt_ctf_event_class_get_id(event_class));
+               ret = -1;
                goto end;
        }
 
-       ret = bt_ctf_attributes_get_field_value_by_name(event_class->attributes,
-               name);
-       if (!ret) {
-               BT_LOGV("Cannot find event class's attribute: "
-                       "addr=%p, event-class-name=\"%s\", id=%" PRId64 ", "
-                       "attr-name=\"%s\"",
+       if (emf_uri) {
+               g_string_assign(event_class->emf_uri, emf_uri);
+               BT_LOGV("Set event class's EMF URI: "
+                       "addr=%p, name=\"%s\", id=%" PRId64 ", emf-uri=\"%s\"",
                        event_class, bt_ctf_event_class_get_name(event_class),
-                       bt_ctf_event_class_get_id(event_class), name);
+                       bt_ctf_event_class_get_id(event_class), emf_uri);
+       } else {
+               g_string_assign(event_class->emf_uri, "");
+               BT_LOGV("Reset event class's EMF URI: "
+                       "addr=%p, name=\"%s\", id=%" PRId64,
+                       event_class, bt_ctf_event_class_get_name(event_class),
+                       bt_ctf_event_class_get_id(event_class));
        }
 
 end:
        return ret;
-
 }
 
 struct bt_ctf_stream_class *bt_ctf_event_class_get_stream_class(
@@ -724,49 +601,6 @@ void bt_ctf_event_class_put(struct bt_ctf_event_class *event_class)
        bt_put(event_class);
 }
 
-BT_HIDDEN
-int bt_ctf_event_class_set_stream_id(struct bt_ctf_event_class *event_class,
-               uint64_t stream_id_param)
-{
-       int ret = 0;
-       struct bt_value *obj = NULL;
-       int64_t stream_id = (int64_t) stream_id_param;
-
-       assert(event_class);
-       assert(stream_id >= 0);
-       obj = bt_value_integer_create_init(stream_id);
-       if (!obj) {
-               BT_LOGE_STR("Cannot create integer value object.");
-               ret = -1;
-               goto end;
-       }
-
-       ret = bt_ctf_attributes_set_field_value(event_class->attributes,
-               "stream_id", obj);
-       if (ret) {
-               BT_LOGE("Cannot set event class's attributes's `stream_id` field: "
-                       "addr=%p, name=\"%s\", id=%" PRId64 ", ret=%d",
-                       event_class, bt_ctf_event_class_get_name(event_class),
-                       bt_ctf_event_class_get_id(event_class), ret);
-               goto end;
-       }
-
-       if (event_class->frozen) {
-               BT_LOGV_STR("Freezing event class's attributes because event class is frozen.");
-               bt_ctf_attributes_freeze(event_class->attributes);
-       }
-
-       BT_LOGV("Set event class's stream class ID: "
-               "event-class-addr=%p, event-class-name=\"%s\", "
-               "event-class-id=%" PRId64 ", stream-class-id=%" PRId64,
-               event_class, bt_ctf_event_class_get_name(event_class),
-               bt_ctf_event_class_get_id(event_class), stream_id);
-
-end:
-       BT_PUT(obj);
-       return ret;
-}
-
 static
 void bt_ctf_event_class_destroy(struct bt_object *obj)
 {
@@ -776,8 +610,8 @@ void bt_ctf_event_class_destroy(struct bt_object *obj)
        BT_LOGD("Destroying event class: addr=%p, name=\"%s\", id=%" PRId64,
                event_class, bt_ctf_event_class_get_name(event_class),
                bt_ctf_event_class_get_id(event_class));
-       BT_LOGD_STR("Destroying event class's attributes.");
-       bt_ctf_attributes_destroy(event_class->attributes);
+       g_string_free(event_class->name, TRUE);
+       g_string_free(event_class->emf_uri, TRUE);
        BT_LOGD_STR("Putting context field type.");
        bt_put(event_class->context);
        BT_LOGD_STR("Putting payload field type.");
@@ -798,22 +632,16 @@ void bt_ctf_event_class_freeze(struct bt_ctf_event_class *event_class)
                event_class, bt_ctf_event_class_get_name(event_class),
                bt_ctf_event_class_get_id(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_LOGD_STR("Freezing event class's context field type.");
        bt_ctf_field_type_freeze(event_class->context);
        BT_LOGD_STR("Freezing event class's payload field type.");
        bt_ctf_field_type_freeze(event_class->fields);
-       BT_LOGD_STR("Freezing event class's attributes.");
-       bt_ctf_attributes_freeze(event_class->attributes);
 }
 
 BT_HIDDEN
 int bt_ctf_event_class_serialize(struct bt_ctf_event_class *event_class,
                struct metadata_context *context)
 {
-       int64_t i;
-       int64_t count;
        int ret = 0;
        struct bt_value *attr_value = NULL;
 
@@ -827,51 +655,28 @@ int bt_ctf_event_class_serialize(struct bt_ctf_event_class *event_class,
        context->current_indentation_level = 1;
        g_string_assign(context->field_name, "");
        g_string_append(context->string, "event {\n");
-       count = bt_ctf_event_class_get_attribute_count(event_class);
-       assert(count >= 0);
-
-       for (i = 0; i < count; ++i) {
-               const char *attr_name = NULL;
-
-               attr_name = bt_ctf_event_class_get_attribute_name_by_index(
-                       event_class, i);
-               assert(attr_name);
-               attr_value = bt_ctf_event_class_get_attribute_value_by_index(
-                       event_class, i);
-               assert(attr_value);
-
-               switch (bt_value_get_type(attr_value)) {
-               case BT_VALUE_TYPE_INTEGER:
-               {
-                       int64_t value;
-
-                       ret = bt_value_integer_get(attr_value, &value);
-                       assert(ret == 0);
-                       g_string_append_printf(context->string,
-                               "\t%s = %" PRId64 ";\n", attr_name, value);
-                       break;
-               }
 
-               case BT_VALUE_TYPE_STRING:
-               {
-                       const char *value;
+       /* Serialize attributes */
+       g_string_append_printf(context->string, "\tname = \"%s\";\n",
+               event_class->name->str);
+       assert(event_class->id >= 0);
+       g_string_append_printf(context->string, "\tid = %" PRId64 ";\n",
+               event_class->id);
+       g_string_append_printf(context->string, "\tstream_id = %" PRId64 ";\n",
+               bt_ctf_stream_class_get_id(
+                       bt_ctf_event_class_borrow_stream_class(event_class)));
 
-                       ret = bt_value_string_get(attr_value, &value);
-                       assert(ret == 0);
-                       g_string_append_printf(context->string,
-                               "\t%s = \"%s\";\n", attr_name, value);
-                       break;
-               }
-
-               default:
-                       /* should never happen */
-                       abort();
-                       break;
-               }
+       if (event_class->log_level != BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED) {
+               g_string_append_printf(context->string, "\tloglevel = %d;\n",
+                       (int) event_class->log_level);
+       }
 
-               BT_PUT(attr_value);
+       if (event_class->emf_uri->len > 0) {
+               g_string_append_printf(context->string, "\tmodel.emf.uri = \"%s\";\n",
+                       event_class->emf_uri->str);
        }
 
+       /* Serialize context field type */
        if (event_class->context) {
                g_string_append(context->string, "\tcontext := ");
                BT_LOGD_STR("Serializing event class's context field type metadata.");
@@ -885,6 +690,7 @@ int bt_ctf_event_class_serialize(struct bt_ctf_event_class *event_class,
                g_string_append(context->string, ";\n");
        }
 
+       /* Serialize payload field type */
        if (event_class->fields) {
                g_string_append(context->string, "\tfields := ");
                BT_LOGD_STR("Serializing event class's payload field type metadata.");
index db666c4371252a1e530ea5b290ab8afbf2a39927..1ac20cc55ee339157093f4e9f70fab50b4c78d1d 100644 (file)
@@ -283,41 +283,12 @@ struct event_class_set_stream_class_id_data {
        int ret;
 };
 
-static
-void event_class_set_stream_id(gpointer event_class, gpointer data)
-{
-       struct event_class_set_stream_class_id_data *typed_data = data;
-
-       typed_data->ret |= bt_ctf_event_class_set_stream_id(event_class,
-               typed_data->stream_class_id);
-}
-
 BT_HIDDEN
 int bt_ctf_stream_class_set_id_no_check(
                struct bt_ctf_stream_class *stream_class, int64_t id)
 {
-       int ret = 0;
-       struct event_class_set_stream_class_id_data data =
-               { .stream_class_id = id, .ret = 0 };
-
-       /*
-        * Make sure all event classes have their "stream_id" attribute
-        * set to this value.
-        */
-       g_ptr_array_foreach(stream_class->event_classes,
-               event_class_set_stream_id, &data);
-       ret = data.ret;
-       if (ret) {
-               BT_LOGE("Cannot set the IDs of all stream class's event classes: "
-                       "addr=%p, name=\"%s\", id=%" PRId64,
-                       stream_class, bt_ctf_stream_class_get_name(stream_class),
-                       bt_ctf_stream_class_get_id(stream_class));
-               goto end;
-       }
-
        _bt_ctf_stream_class_set_id(stream_class, id);
-end:
-       return ret;
+       return 0;
 }
 
 int bt_ctf_stream_class_set_id(struct bt_ctf_stream_class *stream_class,
@@ -551,13 +522,6 @@ int bt_ctf_stream_class_add_event_class(
                *event_id = stream_class->next_event_id;
        }
 
-       ret = bt_ctf_event_class_set_stream_id(event_class, stream_class->id);
-       if (ret) {
-               BT_LOGE("Cannot set event class's stream class ID attribute: ret=%d",
-                       ret);
-               goto end;
-       }
-
        bt_object_set_parent(event_class, stream_class);
 
        if (trace) {
index 4188d45bdc6fcedc85acac5b6db4030287ecffad..56069e5cd6d6d26c9a236ec1325598c21c0d9598 100644 (file)
@@ -226,37 +226,6 @@ struct ctx {
  */
 struct ctf_visitor_generate_ir { };
 
-static
-const char *loglevel_str [] = {
-       [ LOGLEVEL_EMERG ] = "TRACE_EMERG",
-       [ LOGLEVEL_ALERT ] = "TRACE_ALERT",
-       [ LOGLEVEL_CRIT ] = "TRACE_CRIT",
-       [ LOGLEVEL_ERR ] = "TRACE_ERR",
-       [ LOGLEVEL_WARNING ] = "TRACE_WARNING",
-       [ LOGLEVEL_NOTICE ] = "TRACE_NOTICE",
-       [ LOGLEVEL_INFO ] = "TRACE_INFO",
-       [ LOGLEVEL_DEBUG_SYSTEM ] = "TRACE_DEBUG_SYSTEM",
-       [ LOGLEVEL_DEBUG_PROGRAM ] = "TRACE_DEBUG_PROGRAM",
-       [ LOGLEVEL_DEBUG_PROCESS ] = "TRACE_DEBUG_PROCESS",
-       [ LOGLEVEL_DEBUG_MODULE ] = "TRACE_DEBUG_MODULE",
-       [ LOGLEVEL_DEBUG_UNIT ] = "TRACE_DEBUG_UNIT",
-       [ LOGLEVEL_DEBUG_FUNCTION ] = "TRACE_DEBUG_FUNCTION",
-       [ LOGLEVEL_DEBUG_LINE ] = "TRACE_DEBUG_LINE",
-       [ LOGLEVEL_DEBUG ] = "TRACE_DEBUG",
-};
-
-static
-const char *print_loglevel(int64_t value)
-{
-       if (value < 0) {
-               return NULL;
-       }
-       if (value >= _NR_LOGLEVELS) {
-               return "<<UNKNOWN>>";
-       }
-       return loglevel_str[value];
-}
-
 /**
  * Creates a new declaration scope.
  *
@@ -3318,8 +3287,8 @@ int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node,
                        _SET(set, _EVENT_FIELDS_SET);
                } else if (!strcmp(left, "loglevel")) {
                        uint64_t loglevel_value;
-                       const char *loglevel_str;
-                       struct bt_value *value_obj, *str_obj;
+                       enum bt_ctf_event_class_log_level log_level =
+                               BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED;
 
                        if (_IS_SET(set, _EVENT_LOGLEVEL_SET)) {
                                _BT_LOGE_DUP_ATTR(node, "loglevel",
@@ -3336,39 +3305,71 @@ int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node,
                                ret = -EINVAL;
                                goto error;
                        }
-                       value_obj = bt_value_integer_create_init(loglevel_value);
-                       if (!value_obj) {
-                               _BT_LOGE_NODE(node,
-                                       "Cannot create integer value object.");
-                               ret = -ENOMEM;
-                               goto error;
-                       }
-                       if (bt_ctf_event_class_set_attribute(event_class,
-                                       "loglevel", value_obj) != BT_VALUE_STATUS_OK) {
-                               _BT_LOGE_NODE(node,
-                                       "Cannot set event class's `loglevel` attribute.");
-                               ret = -EINVAL;
-                               bt_put(value_obj);
-                               goto error;
+
+                       switch (loglevel_value) {
+                       case 0:
+                               log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY;
+                               break;
+                       case 1:
+                               log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT;
+                               break;
+                       case 2:
+                               log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL;
+                               break;
+                       case 3:
+                               log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR;
+                               break;
+                       case 4:
+                               log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING;
+                               break;
+                       case 5:
+                               log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE;
+                               break;
+                       case 6:
+                               log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO;
+                               break;
+                       case 7:
+                               log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM;
+                               break;
+                       case 8:
+                               log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM;
+                               break;
+                       case 9:
+                               log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS;
+                               break;
+                       case 10:
+                               log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE;
+                               break;
+                       case 11:
+                               log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT;
+                               break;
+                       case 12:
+                               log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION;
+                               break;
+                       case 13:
+                               log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE;
+                               break;
+                       case 14:
+                               log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG;
+                               break;
+                       default:
+                               _BT_LOGW_NODE(node, "Not setting event class's log level because its value is unknown: "
+                                       "log-level=%" PRIu64, loglevel_value);
                        }
-                       loglevel_str = print_loglevel(loglevel_value);
-                       if (loglevel_str) {
-                               str_obj = bt_value_string_create_init(loglevel_str);
-                               if (bt_ctf_event_class_set_attribute(event_class,
-                                               "loglevel_string", str_obj) != BT_VALUE_STATUS_OK) {
+
+                       if (log_level != BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED) {
+                               ret = bt_ctf_event_class_set_log_level(
+                                       event_class, log_level);
+                               if (ret) {
                                        _BT_LOGE_NODE(node,
-                                               "Cannot set event class's `loglevel_string` attribute.");
-                                       ret = -EINVAL;
-                                       bt_put(str_obj);
+                                               "Cannot set event class's log level.");
                                        goto error;
                                }
-                               bt_put(str_obj);
                        }
-                       bt_put(value_obj);
+
                        _SET(set, _EVENT_LOGLEVEL_SET);
                } else if (!strcmp(left, "model.emf.uri")) {
                        char *right;
-                       struct bt_value *str_obj;
 
                        if (_IS_SET(set, _EVENT_MODEL_EMF_URI_SET)) {
                                _BT_LOGE_DUP_ATTR(node, "model.emf.uri",
@@ -3386,16 +3387,19 @@ int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node,
                                goto error;
                        }
 
-                       str_obj = bt_value_string_create_init(right);
-                       if (bt_ctf_event_class_set_attribute(event_class,
-                                       "model.emf.uri", str_obj) != BT_VALUE_STATUS_OK) {
-                               _BT_LOGE_NODE(node,
-                                       "Cannot set event class's `model.emf.uri` attribute.");
-                               ret = -EINVAL;
-                               bt_put(str_obj);
-                               goto error;
+                       if (strlen(right) == 0) {
+                               _BT_LOGW_NODE(node,
+                                       "Not setting event class's EMF URI because it's empty.");
+                       } else {
+                               ret = bt_ctf_event_class_set_emf_uri(
+                                       event_class, right);
+                               if (ret) {
+                                       _BT_LOGE_NODE(node,
+                                               "Cannot set event class's EMF URI.");
+                                       goto error;
+                               }
                        }
-                       bt_put(str_obj);
+
                        g_free(right);
                        _SET(set, _EVENT_MODEL_EMF_URI_SET);
                } else {
index 894ce2f39f4b7016a4d7f1ee8763f6418bb41240..22f2785e285db5bddf7da999b2811c68f428d0c7 100644 (file)
@@ -212,7 +212,10 @@ struct bt_ctf_event_class *ctf_copy_event_class(FILE *err,
        struct bt_ctf_event_class *writer_event_class = NULL;
        struct bt_ctf_field_type *context, *payload_type;
        const char *name;
-       int count, i, ret;
+       int ret;
+       int64_t id;
+       enum bt_ctf_event_class_log_level log_level;
+       const char *emf_uri;
 
        name = bt_ctf_event_class_get_name(event_class);
        if (!name) {
@@ -228,31 +231,39 @@ struct bt_ctf_event_class *ctf_copy_event_class(FILE *err,
                goto end;
        }
 
-       count = bt_ctf_event_class_get_attribute_count(event_class);
-       for (i = 0; i < count; i++) {
-               const char *attr_name;
-               struct bt_value *attr_value;
-               int ret;
+       id = bt_ctf_event_class_get_id(event_class);
+       if (id < 0) {
+               fprintf(err, "[error] %s in %s:%d\n", __func__,
+                               __FILE__, __LINE__);
+               goto error;
+       }
 
-               attr_name = bt_ctf_event_class_get_attribute_name_by_index(
-                       event_class, i);
-               if (!attr_name) {
-                       fprintf(err, "[error] %s in %s:%d\n", __func__,
-                                       __FILE__, __LINE__);
-                       goto error;
-               }
-               attr_value = bt_ctf_event_class_get_attribute_value_by_index(
-                       event_class, i);
-               if (!attr_value) {
-                       fprintf(err, "[error] %s in %s:%d\n", __func__,
-                                       __FILE__, __LINE__);
-                       goto error;
-               }
+       ret = bt_ctf_event_class_set_id(writer_event_class, id);
+       if (ret) {
+               fprintf(err, "[error] %s in %s:%d\n", __func__,
+                               __FILE__, __LINE__);
+               goto error;
+       }
 
-               ret = bt_ctf_event_class_set_attribute(writer_event_class,
-                               attr_name, attr_value);
-               BT_PUT(attr_value);
-               if (ret < 0) {
+       log_level = bt_ctf_event_class_get_log_level(event_class);
+       if (log_level < 0) {
+               fprintf(err, "[error] %s in %s:%d\n", __func__,
+                               __FILE__, __LINE__);
+               goto error;
+       }
+
+       ret = bt_ctf_event_class_set_log_level(writer_event_class, log_level);
+       if (ret) {
+               fprintf(err, "[error] %s in %s:%d\n", __func__,
+                               __FILE__, __LINE__);
+               goto error;
+       }
+
+       emf_uri = bt_ctf_event_class_get_emf_uri(event_class);
+       if (emf_uri) {
+               ret = bt_ctf_event_class_set_emf_uri(writer_event_class,
+                       emf_uri);
+               if (ret) {
                        fprintf(err, "[error] %s in %s:%d\n", __func__,
                                        __FILE__, __LINE__);
                        goto error;
index 1d941e914a7792f0eede6d74ebbdddf1855715ec..1161a3869d969ac707860d6e3ed9cb0343acff74 100644 (file)
@@ -499,15 +499,33 @@ enum bt_component_status print_event_header(struct pretty_component *pretty,
                }
        }
        if (pretty->options.print_loglevel_field) {
-               struct bt_value *loglevel_str, *loglevel_value;
-
-               loglevel_str = bt_ctf_event_class_get_attribute_value_by_name(event_class,
-                               "loglevel_string");
-               loglevel_value = bt_ctf_event_class_get_attribute_value_by_name(event_class,
-                               "loglevel");
-               if (loglevel_str || loglevel_value) {
-                       bool has_str = false;
+               static const char *log_level_names[] = {
+                       [ BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY ] = "TRACE_EMERG",
+                       [ BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT ] = "TRACE_ALERT",
+                       [ BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL ] = "TRACE_CRIT",
+                       [ BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR ] = "TRACE_ERR",
+                       [ BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING ] = "TRACE_WARNING",
+                       [ BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE ] = "TRACE_NOTICE",
+                       [ BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO ] = "TRACE_INFO",
+                       [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM ] = "TRACE_DEBUG_SYSTEM",
+                       [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM ] = "TRACE_DEBUG_PROGRAM",
+                       [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS ] = "TRACE_DEBUG_PROCESS",
+                       [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE ] = "TRACE_DEBUG_MODULE",
+                       [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT ] = "TRACE_DEBUG_UNIT",
+                       [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION ] = "TRACE_DEBUG_FUNCTION",
+                       [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE ] = "TRACE_DEBUG_LINE",
+                       [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG ] = "TRACE_DEBUG",
+               };
+               enum bt_ctf_event_class_log_level log_level;
+               const char *log_level_str = NULL;
+
+               log_level = bt_ctf_event_class_get_log_level(event_class);
+               assert(log_level != BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN);
+               if (log_level != BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED) {
+                       log_level_str = log_level_names[log_level];
+               }
 
+               if (log_level_str) {
                        if (!pretty->start_line) {
                                g_string_append(pretty->string, ", ");
                        }
@@ -516,34 +534,17 @@ enum bt_component_status print_event_header(struct pretty_component *pretty,
                        } else if (dom_print) {
                                g_string_append(pretty->string, ":");
                        }
-                       if (loglevel_str) {
-                               const char *str;
-
-                               if (bt_value_string_get(loglevel_str, &str)
-                                               == BT_VALUE_STATUS_OK) {
-                                       g_string_append(pretty->string, str);
-                                       has_str = true;
-                               }
-                       }
-                       if (loglevel_value) {
-                               int64_t value;
-
-                               if (bt_value_integer_get(loglevel_value, &value)
-                                               == BT_VALUE_STATUS_OK) {
-                                       g_string_append_printf(pretty->string, "%s(%" PRId64 ")",
-                                               has_str ? " " : "", value);
-                               }
-                       }
-                       bt_put(loglevel_str);
-                       bt_put(loglevel_value);
+
+                       g_string_append(pretty->string, log_level_str);
+                       g_string_append_printf(
+                               pretty->string, " (%d)", (int) log_level);
                        dom_print = 1;
                }
        }
        if (pretty->options.print_emf_field) {
-               struct bt_value *uri_str;
+               const char *uri_str;
 
-               uri_str = bt_ctf_event_class_get_attribute_value_by_name(event_class,
-                               "model.emf.uri");
+               uri_str = bt_ctf_event_class_get_emf_uri(event_class);
                if (uri_str) {
                        if (!pretty->start_line) {
                                g_string_append(pretty->string, ", ");
@@ -553,15 +554,8 @@ enum bt_component_status print_event_header(struct pretty_component *pretty,
                        } else if (dom_print) {
                                g_string_append(pretty->string, ":");
                        }
-                       if (uri_str) {
-                               const char *str;
 
-                               if (bt_value_string_get(uri_str, &str)
-                                               == BT_VALUE_STATUS_OK) {
-                                       g_string_append(pretty->string, str);
-                               }
-                       }
-                       bt_put(uri_str);
+                       g_string_append(pretty->string, uri_str);
                        dom_print = 1;
                }
        }
index 6c2defc64b8bc90274180302e412c5671bd92ae0..e5a7af3775aa11ca7a7a0563db330b6ed572943a 100644 (file)
@@ -51,7 +51,7 @@
 #define METADATA_LINE_SIZE 512
 #define SEQUENCE_TEST_LENGTH 10
 #define ARRAY_TEST_LENGTH 5
-#define PACKET_RESIZE_TEST_LENGTH 100000
+#define PACKET_RESIZE_TEST_LENGTH 5
 
 #define DEFAULT_CLOCK_FREQ 1000000000
 #define DEFAULT_CLOCK_PRECISION 1
@@ -61,7 +61,7 @@
 #define DEFAULT_CLOCK_TIME 0
 #define DEFAULT_CLOCK_VALUE 0
 
-#define NR_TESTS 633
+#define NR_TESTS 621
 
 static int64_t current_time = 42;
 
@@ -586,17 +586,7 @@ static
 void append_complex_event(struct bt_ctf_stream_class *stream_class,
                struct bt_ctf_stream *stream, struct bt_ctf_clock *clock)
 {
-       struct event_class_attrs_counts {
-               int id;
-               int name;
-               int loglevel;
-               int modelemfuri;
-               int unknown;
-       } attrs_count;
-
        int i;
-       int ret;
-       int64_t int64_value;
        struct event_class_attrs_counts ;
        const char *complex_test_event_string = "Complex Test Event";
        const char *test_string_1 = "Test ";
@@ -638,7 +628,6 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
        struct bt_ctf_event_class *ret_event_class;
        struct bt_ctf_field *packet_context, *packet_context_field;
        struct bt_ctf_field_type_enumeration_mapping_iterator *iter = NULL;
-       struct bt_value *obj;
 
        ok(bt_ctf_field_type_set_alignment(int_16_type, 0),
                "bt_ctf_field_type_set_alignment handles 0-alignment correctly");
@@ -818,115 +807,32 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
                "bt_ctf_event_class_get_id returns the correct value");
 
        /* Test event class attributes */
-       obj = bt_value_integer_create_init(15);
-       assert(obj);
-       ok(bt_ctf_event_class_set_attribute(NULL, "id", obj),
-               "bt_ctf_event_class_set_attribute handles a NULL event class correctly");
-       ok(bt_ctf_event_class_set_attribute(event_class, NULL, obj),
-               "bt_ctf_event_class_set_attribute handles a NULL name correctly");
-       ok(bt_ctf_event_class_set_attribute(event_class, "id", NULL),
-               "bt_ctf_event_class_set_attribute handles a NULL value correctly");
-       assert(!bt_value_integer_set(obj, -3));
-       ok(bt_ctf_event_class_set_attribute(event_class, "id", obj),
-               "bt_ctf_event_class_set_attribute fails with a negative \"id\" attribute");
-       assert(!bt_value_integer_set(obj, 11));
-       ret = bt_ctf_event_class_set_attribute(event_class, "id", obj);
-       ok(!ret && bt_ctf_event_class_get_id(event_class) == 11,
-               "bt_ctf_event_class_set_attribute succeeds in replacing the existing \"id\" attribute");
-       ret = bt_ctf_event_class_set_attribute(event_class, "name", obj);
-       ret &= bt_ctf_event_class_set_attribute(event_class, "model.emf.uri", obj);
-       ok(ret,
-               "bt_ctf_event_class_set_attribute cannot set \"name\" or \"model.emf.uri\" to an integer value");
-       BT_PUT(obj);
-
-       obj = bt_value_integer_create_init(5);
-       assert(obj);
-       ok(!bt_ctf_event_class_set_attribute(event_class, "loglevel", obj),
-               "bt_ctf_event_class_set_attribute succeeds in setting the \"loglevel\" attribute");
-       BT_PUT(obj);
-       ok(!bt_ctf_event_class_get_attribute_value_by_name(NULL, "loglevel"),
-               "bt_ctf_event_class_get_attribute_value_by_name handles a NULL event class correctly");
-       ok(!bt_ctf_event_class_get_attribute_value_by_name(event_class, NULL),
-               "bt_ctf_event_class_get_attribute_value_by_name handles a NULL name correctly");
-       ok(!bt_ctf_event_class_get_attribute_value_by_name(event_class, "meow"),
-               "bt_ctf_event_class_get_attribute_value_by_name fails with a non-existing attribute name");
-       obj = bt_ctf_event_class_get_attribute_value_by_name(event_class,
-               "loglevel");
-       int64_value = 0;
-       ret = bt_value_integer_get(obj, &int64_value);
-       ok(obj && !ret && int64_value == 5,
-               "bt_ctf_event_class_get_attribute_value_by_name returns the correct value");
-       BT_PUT(obj);
-
-       obj = bt_value_string_create_init("nu name");
-       assert(obj);
-       assert(!bt_ctf_event_class_set_attribute(event_class, "name", obj));
-       ret_string = bt_ctf_event_class_get_name(event_class);
-       ok(!strcmp(ret_string, "nu name"),
-               "bt_ctf_event_class_set_attribute succeeds in replacing the existing \"name\" attribute");
-       ret = bt_ctf_event_class_set_attribute(event_class, "id", obj);
-       ret &= bt_ctf_event_class_set_attribute(event_class, "loglevel", obj);
-       ok(ret,
-               "bt_ctf_event_class_set_attribute cannot set \"id\" or \"loglevel\" to a string value");
-       BT_PUT(obj);
-       obj = bt_value_string_create_init("http://kernel.org/");
-       assert(obj);
-       assert(!bt_ctf_event_class_set_attribute(event_class, "model.emf.uri", obj));
-       BT_PUT(obj);
-
-       ok(bt_ctf_event_class_get_attribute_count(NULL),
-               "bt_ctf_event_class_get_attribute_count handles a NULL event class");
-       ok(bt_ctf_event_class_get_attribute_count(event_class) == 4,
-               "bt_ctf_event_class_get_attribute_count returns the correct count");
-       ok(!bt_ctf_event_class_get_attribute_name_by_index(NULL, 0),
-               "bt_ctf_event_class_get_attribute_name handles a NULL event class correctly");
-       ok(!bt_ctf_event_class_get_attribute_name_by_index(event_class, 4),
-               "bt_ctf_event_class_get_attribute_name handles a too large index correctly");
-       ok(!bt_ctf_event_class_get_attribute_value_by_index(NULL, 0),
-               "bt_ctf_event_class_get_attribute_value handles a NULL event class correctly");
-       ok(!bt_ctf_event_class_get_attribute_value_by_index(event_class, 4),
-               "bt_ctf_event_class_get_attribute_value handles a too large index correctly");
-
-       memset(&attrs_count, 0, sizeof(attrs_count));
-
-       for (i = 0; i < 4; ++i) {
-               ret_string = bt_ctf_event_class_get_attribute_name_by_index(
-                       event_class, i);
-               obj = bt_ctf_event_class_get_attribute_value_by_index(
-                       event_class, i);
-               assert(ret_string && obj);
-
-               if (!strcmp(ret_string, "id")) {
-                       attrs_count.id++;
-                       ok(bt_value_is_integer(obj),
-                               "bt_ctf_event_class_get_attribute_value returns the correct type (\"%s\")",
-                               ret_string);
-               } else if (!strcmp(ret_string, "name")) {
-                       attrs_count.name++;
-                       ok(bt_value_is_string(obj),
-                               "bt_ctf_event_class_get_attribute_value returns the correct type (\"%s\")",
-                               ret_string);
-               } else if (!strcmp(ret_string, "loglevel")) {
-                       attrs_count.loglevel++;
-                       ok(bt_value_is_integer(obj),
-                               "bt_ctf_event_class_get_attribute_value returns the correct type (\"%s\")",
-                               ret_string);
-               } else if (!strcmp(ret_string, "model.emf.uri")) {
-                       attrs_count.modelemfuri++;
-                       ok(bt_value_is_string(obj),
-                               "bt_ctf_event_class_get_attribute_value returns the correct type (\"%s\")",
-                               ret_string);
-               } else {
-                       attrs_count.unknown++;
-               }
-
-               BT_PUT(obj);
-       }
-
-       ok(attrs_count.unknown == 0, "event class has no unknown attributes");
-       ok(attrs_count.id == 1 && attrs_count.name == 1 &&
-               attrs_count.loglevel == 1 && attrs_count.modelemfuri == 1,
-               "event class has one instance of each known attribute");
+       ok(bt_ctf_event_class_get_log_level(event_class) == BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED,
+               "event class has the expected initial log level");
+       ok(!bt_ctf_event_class_get_emf_uri(event_class),
+               "as expected, event class has no initial EMF URI");
+       ok(bt_ctf_event_class_set_log_level(NULL, BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO),
+               "bt_ctf_event_class_set_log_level handles a NULL event class correctly");
+       ok(bt_ctf_event_class_set_log_level(event_class, BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN),
+               "bt_ctf_event_class_set_log_level handles an unknown log level correctly");
+       ok(!bt_ctf_event_class_set_log_level(event_class, BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO),
+               "bt_ctf_event_class_set_log_level succeeds with a valid log level");
+       ok(bt_ctf_event_class_get_log_level(NULL) == BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN,
+               "bt_ctf_event_class_get_log_level handles a NULL event class correctly");
+       ok(bt_ctf_event_class_get_log_level(event_class) == BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO,
+               "bt_ctf_event_class_get_log_level returns the expected log level");
+       ok(bt_ctf_event_class_set_emf_uri(NULL, "http://diamon.org/babeltrace/"),
+               "bt_ctf_event_class_set_emf_uri handles a NULL event class correctly");
+       ok(!bt_ctf_event_class_set_emf_uri(event_class, "http://diamon.org/babeltrace/"),
+               "bt_ctf_event_class_set_emf_uri succeeds with a valid EMF URI");
+       ok(!bt_ctf_event_class_get_emf_uri(NULL),
+               "bt_ctf_event_class_get_emf_uri handles a NULL event class correctly");
+       ok(strcmp(bt_ctf_event_class_get_emf_uri(event_class), "http://diamon.org/babeltrace/") == 0,
+               "bt_ctf_event_class_get_emf_uri returns the expected EMF URI");
+       ok(!bt_ctf_event_class_set_emf_uri(event_class, NULL),
+               "bt_ctf_event_class_set_emf_uri succeeds with NULL (to reset)");
+       ok(!bt_ctf_event_class_get_emf_uri(event_class),
+               "as expected, event class has no EMF URI after reset");
 
        /* Add event class to the stream class */
        ok(bt_ctf_stream_class_add_event_class(stream_class, NULL),
@@ -2497,7 +2403,7 @@ void append_existing_event_class(struct bt_ctf_stream_class *stream_class)
 
        event_class = bt_ctf_event_class_create("different name, ok");
        assert(event_class);
-       assert(!bt_ctf_event_class_set_id(event_class, 11));
+       assert(!bt_ctf_event_class_set_id(event_class, 13));
        ok(bt_ctf_stream_class_add_event_class(stream_class, event_class),
                "two event classes with the same ID cannot cohabit within the same stream class");
        bt_put(event_class);
This page took 0.047912 seconds and 4 git commands to generate.