X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace%2Fctf-ir%2Fevent-class.h;h=fec7aa875a6e29b8227a0153ea83bcd03ed2bada;hb=c55a9f585da53ea54ac458155fac3cdec1779d47;hp=12e31fcb99a8ec6936493efb991f0e8c9e9c48af;hpb=c2f29fb98a1e9088434fe8872d68695afd8e9dd3;p=babeltrace.git diff --git a/include/babeltrace/ctf-ir/event-class.h b/include/babeltrace/ctf-ir/event-class.h index 12e31fcb..fec7aa87 100644 --- a/include/babeltrace/ctf-ir/event-class.h +++ b/include/babeltrace/ctf-ir/event-class.h @@ -121,9 +121,11 @@ struct bt_ctf_stream_class; /** @brief Creates a default CTF IR event class named \p name­. -The event class is created \em without an event context -\link ctfirfieldtypes field type\endlink and with an empty event -payload field type. +On success, the context and payload field types are empty structure +field types. You can modify those default field types after the +event class is created with +bt_ctf_event_class_set_context_type() and +bt_ctf_event_class_set_payload_type(). Upon creation, the event class's ID is not set. You can set it to a specific value with bt_ctf_event_class_set_id(). If it @@ -216,13 +218,14 @@ of the stream class to which you eventually add \p event_class. @prenotnull{event_class} @prehot{event_class} +@pre \p id is lesser than or equal to 9223372036854775807 (\c INT64_MAX). @postrefcountsame{event_class} @sa bt_ctf_event_class_get_id(): Returns the numeric ID of a given event class. */ extern int bt_ctf_event_class_set_id( - struct bt_ctf_event_class *event_class, uint32_t id); + struct bt_ctf_event_class *event_class, uint64_t id); /** @brief Returns the number of attributes contained in the CTF IR event @@ -236,12 +239,12 @@ extern int bt_ctf_event_class_set_id( @prenotnull{event_class} @postrefcountsame{event_class} -@sa bt_ctf_event_class_get_attribute_name(): Returns the name of - the attribute of a given event class at a given index. -@sa bt_ctf_event_class_get_attribute_value(): Returns the value of - the attribute of a given event class at a given index. +@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. */ -extern int bt_ctf_event_class_get_attribute_count( +extern int64_t bt_ctf_event_class_get_attribute_count( struct bt_ctf_event_class *event_class); /** @@ -261,12 +264,12 @@ string. \p event_class. @postrefcountsame{event_class} -@sa bt_ctf_event_class_get_attribute_value(): Returns the value 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. */ extern const char * -bt_ctf_event_class_get_attribute_name( - struct bt_ctf_event_class *event_class, int index); +bt_ctf_event_class_get_attribute_name_by_index( + struct bt_ctf_event_class *event_class, uint64_t index); /** @brief Returns the value of the attribute at the index \p index of the @@ -283,12 +286,12 @@ bt_ctf_event_class_get_attribute_name( @postsuccessrefcountretinc @postrefcountsame{event_class} -@sa bt_ctf_event_class_get_attribute_name(): Returns the name of - the attribute of a given event class at a given index. +@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. */ extern struct bt_value * -bt_ctf_event_class_get_attribute_value(struct bt_ctf_event_class *event_class, - int index); +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 @@ -364,42 +367,49 @@ extern int bt_ctf_event_class_set_attribute( @brief Returns the context field type of the CTF IR event class \p event_class. -@param[in] event_class Event class of which to get the - context field type. -@returns Context field type of \p event_class, - or \c NULL on error. +@param[in] event_class Event class of which to get the context field type. +@returns Context field type of \p event_class, or \c NULL if + \p event_class has no context field type or on error. @prenotnull{event_class} @postrefcountsame{event_class} -@postsuccessrefcountretinc +@post On success, if the return value is a field type, its + reference count is incremented. -@sa bt_ctf_event_class_set_context_type(): Sets the context field - type of a given event class. +@sa bt_ctf_event_class_set_context_type(): Sets the context field type of a + given event class. */ extern struct bt_ctf_field_type *bt_ctf_event_class_get_context_type( struct bt_ctf_event_class *event_class); /** -@brief Sets the context field type of the CTF IR event class - \p event_class to \p context_type. +@brief Sets the context field type of the CTF IR event class \p event_class to + \p context_type, or unsets the current context field type from + \p event_class. -As of Babeltrace \btversion, \p context_type \em must be a -CTF IR structure field type object. +If \p context_type is \c NULL, then this function unsets the current context +field type from \p event_class, effectively making \p event_class an event class +without a context field type. -@param[in] event_class Event class of which to set the context - field type. -@param[in] context_type Context field type. -@returns 0 on success, or a negative value on error. +As of Babeltrace \btversion, if \p context_type is not \c NULL, +\p context_type \em must be a CTF IR structure field type object. + +@param[in] event_class Event class of which to set the context field + type. +@param[in] context_type Context field type, or \c NULL to unset the + current context field type. +@returns 0 on success, or a negative value on error. @prenotnull{event_class} -@prenotnull{context_type} @prehot{event_class} -@preisstructft{context_type} +@pre If \p context_type is not \c NULL, \p context_type is a + CTF IR structure field type. @postrefcountsame{event_class} -@postsuccessrefcountinc{context_type} +@post On success, if \p context_type is not \c NULL, + the reference count of \p context_type is incremented. -@sa bt_ctf_event_class_get_context_type(): Returns the context field - type of a given event class. +@sa bt_ctf_event_class_get_context_type(): Returns the context field type of a + given event class. */ extern int bt_ctf_event_class_set_context_type( struct bt_ctf_event_class *event_class, @@ -409,42 +419,49 @@ extern int bt_ctf_event_class_set_context_type( @brief Returns the payload field type of the CTF IR event class \p event_class. -@param[in] event_class Event class of which to get the - payload field type. -@returns Payload field type of \p event_class, - or \c NULL on error. +@param[in] event_class Event class of which to get the payload field type. +@returns Payload field type of \p event_class, or \c NULL if + \p event_class has no payload field type or on error. @prenotnull{event_class} @postrefcountsame{event_class} -@postsuccessrefcountretinc +@post On success, if the return value is a field type, its + reference count is incremented. -@sa bt_ctf_event_class_set_payload_type(): Sets the payload field - type of a given event class. +@sa bt_ctf_event_class_set_payload_type(): Sets the payload field type of a + given event class. */ extern struct bt_ctf_field_type *bt_ctf_event_class_get_payload_type( struct bt_ctf_event_class *event_class); /** -@brief Sets the payload field type of the CTF IR event class - \p event_class to \p payload_type. +@brief Sets the payload field type of the CTF IR event class \p event_class to + \p payload_type, or unsets the current payload field type from + \p event_class. -As of Babeltrace \btversion, \p payload_type \em must be a -CTF IR structure field type object. +If \p payload_type is \c NULL, then this function unsets the current payload +field type from \p event_class, effectively making \p event_class an event class +without a payload field type. -@param[in] event_class Event class of which to set the payload - field type. -@param[in] payload_type Payload field type. -@returns 0 on success, or a negative value on error. +As of Babeltrace \btversion, if \p payload_type is not \c NULL, +\p payload_type \em must be a CTF IR structure field type object. + +@param[in] event_class Event class of which to set the payload field + type. +@param[in] payload_type Payload field type, or \c NULL to unset the + current payload field type. +@returns 0 on success, or a negative value on error. @prenotnull{event_class} -@prenotnull{payload_type} @prehot{event_class} -@preisstructft{payload_type} +@pre If \p payload_type is not \c NULL, \p payload_type is a + CTF IR structure field type. @postrefcountsame{event_class} -@postsuccessrefcountinc{payload_type} +@post On success, if \p payload_type is not \c NULL, + the reference count of \p payload_type is incremented. -@sa bt_ctf_event_class_get_payload_type(): Returns the payload field - type of a given event class. +@sa bt_ctf_event_class_get_payload_type(): Returns the payload field type of a + given event class. */ extern int bt_ctf_event_class_set_payload_type( struct bt_ctf_event_class *event_class, @@ -468,7 +485,7 @@ bt_ctf_field_type_structure_get_field_count(). @prenotnull{event_class} @postrefcountsame{event_class} */ -extern int bt_ctf_event_class_get_field_count( +extern int64_t bt_ctf_event_class_get_payload_type_field_count( struct bt_ctf_event_class *event_class); /** @@ -504,14 +521,15 @@ bt_ctf_field_type_structure_get_field(). @prenotnull{event_class} @pre \p index is lesser than the number of fields contained in the payload field type of \p event_class (see - bt_ctf_event_class_get_field_count()). + bt_ctf_event_class_get_payload_type_field_count()). @postrefcountsame{event_class} @post On success, if \p field_type is not \c NULL, the reference count of \p *field_type is incremented. */ -extern int bt_ctf_event_class_get_field(struct bt_ctf_event_class *event_class, +extern int bt_ctf_event_class_get_payload_type_field_by_index( + struct bt_ctf_event_class *event_class, const char **field_name, struct bt_ctf_field_type **field_type, - int index); + uint64_t index); /** @brief Returns the type of the field named \p name in the payload @@ -536,9 +554,13 @@ bt_ctf_field_type_structure_get_field_type_by_name(). @postrefcountsame{event_class} @postsuccessrefcountretinc */ -extern struct bt_ctf_field_type *bt_ctf_event_class_get_field_by_name( +extern struct bt_ctf_field_type * +bt_ctf_event_class_get_payload_type_field_type_by_name( struct bt_ctf_event_class *event_class, const char *name); +/* Pre-2.0 CTF writer compatibility */ +#define bt_ctf_event_class_get_field_by_name bt_ctf_event_class_get_payload_type_field_type_by_name + /** @brief Adds a field named \p name with the type \p field_type to the payload field type of the CTF IR event class \p event_class.