2 * SPDX-License-Identifier: MIT
4 * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation
7 #ifndef BABELTRACE2_TRACE_IR_EVENT_CLASS_H
8 #define BABELTRACE2_TRACE_IR_EVENT_CLASS_H
10 /* IWYU pragma: private, include <babeltrace2/babeltrace.h> */
12 #ifndef __BT_IN_BABELTRACE_H
13 # error "Please include <babeltrace2/babeltrace.h> instead."
18 #include <babeltrace2/types.h>
25 @defgroup api-tir-ev-cls Event class
31 An <strong><em>event class</em></strong> is the class of \bt_p_ev,
32 which \bt_p_ev_msg contain:
34 @image html trace-structure.png
36 In the illustration above, notice that:
38 - A \bt_stream is a conceptual \ref api-msg-seq "sequence of messages",
39 some of which are \bt_p_ev_msg.
40 - An event message contains an \bt_ev.
41 - An event is an instance of an event class.
42 - The \ref api-tir-ev-prop-payload "payload field" of an event is an
43 instance of the \ref api-tir-ev-cls-prop-p-fc "payload field class"
44 which an event class contains.
46 An event class is a \ref api-tir "trace IR" metadata object.
48 An event class is a \ref api-fund-shared-object "shared object": get a
49 new reference with bt_event_class_get_ref() and put an existing
50 reference with bt_event_class_put_ref().
52 Some library functions \ref api-fund-freezing "freeze" event classes on
53 success. The documentation of those functions indicate this
56 The type of an event class is #bt_event_class.
58 A \bt_stream_cls contains event classes. All the event classes of a
59 given stream class have unique
60 \ref api-tir-ev-cls-prop-id "numeric IDs". Borrow the stream class
61 which contains an event class with bt_event_class_borrow_stream_class()
62 or bt_event_class_borrow_stream_class_const().
64 To create a default event class:
68 If bt_stream_class_assigns_automatic_event_class_id() returns
69 #BT_TRUE (the default) for the stream class to use
71 <dd>Use bt_event_class_create().</dd>
74 If bt_stream_class_assigns_automatic_event_class_id() returns
75 #BT_FALSE for the stream class to use
77 <dd>Use bt_event_class_create_with_id().</dd>
82 An event class has the following properties:
85 <dt>\anchor api-tir-ev-cls-prop-id Numeric ID</dt>
87 Numeric ID, unique amongst the numeric IDs of the event class's
88 \bt_stream_cls's event classes.
90 Depending on whether or not the event class's stream class
91 automatically assigns event class IDs
92 (see bt_stream_class_assigns_automatic_event_class_id()),
93 set the event class's numeric ID on creation with
94 bt_event_class_create() or
95 bt_event_class_create_with_id().
97 You cannot change the numeric ID once the event class is created.
99 Get an event class's numeric ID with bt_event_class_get_id().
103 \anchor api-tir-ev-cls-prop-ns
105 (only available when the parent \bt_trace_cls was created
106 from a \bt_comp which belongs to a trace processing \bt_graph
107 with the effective \bt_mip version 1)
110 Namespace of the event class.
112 Use bt_event_class_set_namespace() and
113 bt_event_class_get_namespace().
116 <dt>\anchor api-tir-ev-cls-prop-name \bt_dt_opt Name</dt>
118 Name of the event class.
120 Use bt_event_class_set_name() and bt_event_class_get_name().
124 \anchor api-tir-ev-cls-prop-uid
126 (only available when the parent \bt_trace_cls was created
127 from a \bt_comp which belongs to a trace processing \bt_graph
128 with the effective \bt_mip version 1)
131 <a href="https://en.wikipedia.org/wiki/Unique_identifier">Unique identifier</a>
132 (UID) of the event class.
134 Use bt_event_class_set_uid() and
135 bt_event_class_get_uid().
138 <dt>\anchor api-tir-ev-cls-prop-log-lvl \bt_dt_opt Log level</dt>
140 Log level of the event class.
142 The event class's log level corresponds to the log level of the
143 tracer's original instrumentation point.
145 Use bt_event_class_set_log_level() and
146 bt_event_class_get_log_level().
150 \anchor api-tir-ev-cls-prop-emf-uri
151 \bt_dt_opt Eclipse Modeling Framework (EMF) URI
154 EMF URI of the event class.
156 Use bt_event_class_set_emf_uri() and
157 bt_event_class_get_emf_uri().
161 \anchor api-tir-ev-cls-prop-p-fc
162 \bt_dt_opt Payload field class
165 Payload \bt_fc of the event class.
167 The payload of an event class instance (\bt_ev) contains the
170 Use bt_event_class_set_payload_field_class()
171 bt_event_class_borrow_payload_field_class(),
172 and bt_event_class_borrow_payload_field_class_const().
176 \anchor api-tir-ev-cls-prop-sc-fc
177 \bt_dt_opt Specific context field class
180 Specific context \bt_fc of the event class.
182 The specific context of an event class instance (\bt_ev) contains
183 any contextual data of which the layout is specific to the
184 event's class and which does not belong to the payload.
186 Use bt_event_class_set_specific_context_field_class()
187 bt_event_class_borrow_specific_context_field_class(),
188 and bt_event_class_borrow_specific_context_field_class_const().
192 \anchor api-tir-ev-cls-prop-user-attrs
193 \bt_dt_opt User attributes
196 User attributes of the event class.
198 User attributes are custom attributes attached to an event class.
200 Use bt_event_class_set_user_attributes(),
201 bt_event_class_borrow_user_attributes(), and
202 bt_event_class_borrow_user_attributes_const().
213 @typedef struct bt_event_class bt_event_class;
228 Creates a default event class and adds it to the \bt_stream_cls
233 Only use this function if
236 bt_stream_class_assigns_automatic_event_class_id(stream_class)
241 Otherwise, use bt_event_class_create_with_id().
244 On success, the returned event class has the following property values:
251 <td>\ref api-tir-ev-cls-prop-id "Numeric ID"
252 <td>Automatically assigned by \bt_p{stream_class}
254 <td>\bt_mip version 1: \ref api-tir-ev-cls-prop-ns "namespace"
257 <td>\ref api-tir-ev-cls-prop-name "Name"
260 <td>\bt_mip version 1: \ref api-tir-ev-cls-prop-uid "UID"
263 <td>\ref api-tir-ev-cls-prop-log-lvl "Log level"
266 <td>\ref api-tir-ev-cls-prop-emf-uri "EMF URI"
269 <td>\ref api-tir-ev-cls-prop-p-fc "Payload field class"
272 <td>\ref api-tir-ev-cls-prop-sc-fc "Specific context field class"
275 <td>\ref api-tir-ev-cls-prop-user-attrs "User attributes"
276 <td>Empty \bt_map_val
279 @param[in] stream_class
280 Stream class to add the created event class to.
283 New event class reference, or \c NULL on memory error.
285 @bt_pre_not_null{stream_class}
287 <code>bt_stream_class_assigns_automatic_event_class_id(stream_class)</code>
290 @bt_post_success_frozen{stream_class}
292 @sa bt_event_class_create_with_id() —
293 Creates an event class with a specific numeric ID and adds it to a
296 extern bt_event_class
*bt_event_class_create(
297 bt_stream_class
*stream_class
) __BT_NOEXCEPT
;
301 Creates a default event class with the numeric ID \bt_p{id} and adds
302 it to the \bt_stream_cls \bt_p{stream_class}.
306 Only use this function if
309 bt_stream_class_assigns_automatic_event_class_id(stream_class)
314 Otherwise, use bt_event_class_create().
317 On success, the returned event class has the following property values:
324 <td>\ref api-tir-ev-cls-prop-id "Numeric ID"
327 <td>\bt_mip version 1: \ref api-tir-ev-cls-prop-ns "namespace"
330 <td>\ref api-tir-ev-cls-prop-name "Name"
333 <td>\bt_mip version 1: \ref api-tir-ev-cls-prop-uid "UID"
336 <td>\ref api-tir-ev-cls-prop-log-lvl "Log level"
339 <td>\ref api-tir-ev-cls-prop-emf-uri "EMF URI"
342 <td>\ref api-tir-ev-cls-prop-p-fc "Payload field class"
345 <td>\ref api-tir-ev-cls-prop-sc-fc "Specific context field class"
348 <td>\ref api-tir-ev-cls-prop-user-attrs "User attributes"
349 <td>Empty \bt_map_val
352 @param[in] stream_class
353 Stream class to add the created event class to.
355 Numeric ID of the event class to create and add to
359 New event class reference, or \c NULL on memory error.
361 @bt_pre_not_null{stream_class}
363 <code>bt_stream_class_assigns_automatic_event_class_id(stream_class)</code>
366 \bt_p{stream_class} does not contain an event class with the numeric
369 @bt_post_success_frozen{stream_class}
371 @sa bt_event_class_create() —
372 Creates an event class with an automatic numeric ID and adds it to a
375 extern bt_event_class
*bt_event_class_create_with_id(
376 bt_stream_class
*stream_class
, uint64_t id
) __BT_NOEXCEPT
;
381 @name Stream class access
387 Borrows the \bt_stream_cls which contains the event class
390 @param[in] event_class
391 Event class from which to borrow the stream class which contains it.
394 Stream class which contains \bt_p{event_class}.
396 @bt_pre_not_null{event_class}
398 @sa bt_event_class_borrow_stream_class_const() —
399 \c const version of this function.
401 extern bt_stream_class
*bt_event_class_borrow_stream_class(
402 bt_event_class
*event_class
) __BT_NOEXCEPT
;
406 Borrows the \bt_stream_cls which contains the event class
407 \bt_p{event_class} (\c const version).
409 See bt_event_class_borrow_stream_class().
411 extern const bt_stream_class
*bt_event_class_borrow_stream_class_const(
412 const bt_event_class
*event_class
) __BT_NOEXCEPT
;
423 Returns the numeric ID of the event class \bt_p{event_class}.
425 See the \ref api-tir-ev-cls-prop-id "numeric ID" property.
427 @param[in] event_class
428 Event class of which to get the numeric ID.
431 Numeric ID of \bt_p{event_class}.
433 @bt_pre_not_null{event_class}
435 @sa bt_event_class_create_with_id() —
436 Creates an event class with a specific numeric ID and adds it to a
439 extern uint64_t bt_event_class_get_id(
440 const bt_event_class
*event_class
) __BT_NOEXCEPT
;
444 Status codes for bt_event_class_set_namespace().
446 typedef enum bt_event_class_set_namespace_status
{
451 BT_EVENT_CLASS_SET_NAMESPACE_STATUS_OK
= __BT_FUNC_STATUS_OK
,
457 BT_EVENT_CLASS_SET_NAMESPACE_STATUS_MEMORY_ERROR
= __BT_FUNC_STATUS_MEMORY_ERROR
,
458 } bt_event_class_set_namespace_status
;
462 Sets the namespace of the event class \bt_p{event_class} to
465 See the \ref api-tir-ev-cls-prop-ns "namespace" property.
467 @param[in] event_class
468 Event class of which to set the namespace to \bt_p{ns}.
470 New namespace of \bt_p{event_class} (copied).
472 @retval #BT_EVENT_CLASS_SET_NAMESPACE_STATUS_OK
474 @retval #BT_EVENT_CLASS_SET_NAMESPACE_STATUS_MEMORY_ERROR
477 @bt_pre_not_null{event_class}
478 @bt_pre_hot{event_class}
479 @bt_pre_ev_cls_with_mip{event_class, 1}
482 @sa bt_event_class_get_namespace() —
483 Returns the namespace of an event class.
485 extern bt_event_class_set_namespace_status
bt_event_class_set_namespace(
486 bt_event_class
*event_class
, const char *ns
) __BT_NOEXCEPT
;
490 Returns the namespace of the event class \bt_p{event_class}.
492 See the \ref api-tir-ev-cls-prop-ns "namespace" property.
494 If \bt_p{event_class} has no namespace, this function returns \c NULL.
496 @param[in] event_class
497 Event class of which to get the namespace.
501 Namespace of \bt_p{event_class}, or \c NULL if none.
503 The returned pointer remains valid as long as \bt_p{event_class}
507 @bt_pre_not_null{event_class}
508 @bt_pre_ev_cls_with_mip{event_class, 1}
510 @sa bt_event_class_set_namespace() —
511 Sets the namespace of a event class.
514 bt_event_class_get_namespace(const bt_event_class
*event_class
) __BT_NOEXCEPT
;
518 Status codes for bt_event_class_set_name().
520 typedef enum bt_event_class_set_name_status
{
525 BT_EVENT_CLASS_SET_NAME_STATUS_OK
= __BT_FUNC_STATUS_OK
,
531 BT_EVENT_CLASS_SET_NAME_STATUS_MEMORY_ERROR
= __BT_FUNC_STATUS_MEMORY_ERROR
,
532 } bt_event_class_set_name_status
;
536 Sets the name of the event class \bt_p{event_class} to
537 a copy of \bt_p{name}.
539 See the \ref api-tir-ev-cls-prop-name "name" property.
541 @param[in] event_class
542 Event class of which to set the name to \bt_p{name}.
544 New name of \bt_p{event_class} (copied).
546 @retval #BT_EVENT_CLASS_SET_NAME_STATUS_OK
548 @retval #BT_EVENT_CLASS_SET_NAME_STATUS_MEMORY_ERROR
551 @bt_pre_not_null{event_class}
552 @bt_pre_hot{event_class}
553 @bt_pre_not_null{name}
555 @sa bt_event_class_get_name() —
556 Returns the name of an event class.
558 extern bt_event_class_set_name_status
bt_event_class_set_name(
559 bt_event_class
*event_class
, const char *name
) __BT_NOEXCEPT
;
563 Status codes for bt_event_class_set_uid().
565 typedef enum bt_event_class_set_uid_status
{
570 BT_EVENT_CLASS_SET_UID_STATUS_OK
= __BT_FUNC_STATUS_OK
,
576 BT_EVENT_CLASS_SET_UID_STATUS_MEMORY_ERROR
= __BT_FUNC_STATUS_MEMORY_ERROR
,
577 } bt_event_class_set_uid_status
;
582 <a href="https://en.wikipedia.org/wiki/Unique_identifier">unique identifier</a> (UID)
583 of the stream class \bt_p{event_class} to
584 a copy of \bt_p{uid}.
586 See the \ref api-tir-ev-cls-prop-uid "UID" property.
588 @param[in] event_class
589 Event class of which to set the UID to \bt_p{uid}.
591 New UID of \bt_p{event_class} (copied).
593 @retval #BT_EVENT_CLASS_SET_UID_STATUS_OK
595 @retval #BT_EVENT_CLASS_SET_UID_STATUS_MEMORY_ERROR
598 @bt_pre_not_null{event_class}
599 @bt_pre_hot{event_class}
600 @bt_pre_ev_cls_with_mip{event_class, 1}
601 @bt_pre_not_null{uid}
603 @sa bt_event_class_get_uid() —
604 Returns the UID of an event class.
606 extern bt_event_class_set_uid_status
bt_event_class_set_uid(
607 bt_event_class
*event_class
, const char *uid
) __BT_NOEXCEPT
;
611 Returns the UID of the event class \bt_p{event_class}.
613 See the \ref api-tir-ev-cls-prop-uid "UID" property.
615 If \bt_p{event_class} has no UID, this function returns \c NULL.
617 @param[in] event_class
618 Event class of which to get the UID.
622 UID of \bt_p{event_class}, or \c NULL if none.
624 The returned pointer remains valid as long as \bt_p{event_class}
628 @bt_pre_not_null{event_class}
629 @bt_pre_ev_cls_with_mip{event_class, 1}
631 @sa bt_event_class_set_uid() —
632 Sets the UID of an event class.
635 bt_event_class_get_uid(const bt_event_class
*event_class
) __BT_NOEXCEPT
;
639 Returns the name of the event class \bt_p{event_class}.
641 See the \ref api-tir-ev-cls-prop-name "name" property.
643 If \bt_p{event_class} has no name, this function returns \c NULL.
645 @param[in] event_class
646 Event class of which to get the name.
650 Name of \bt_p{event_class}, or \c NULL if none.
652 The returned pointer remains valid as long as \bt_p{event_class}
656 @bt_pre_not_null{event_class}
658 @sa bt_event_class_set_name() —
659 Sets the name of an event class.
661 extern const char *bt_event_class_get_name(
662 const bt_event_class
*event_class
) __BT_NOEXCEPT
;
666 Event class log level enumerators.
668 typedef enum bt_event_class_log_level
{
673 BT_EVENT_CLASS_LOG_LEVEL_EMERGENCY
= 0,
677 Action must be taken immediately.
679 BT_EVENT_CLASS_LOG_LEVEL_ALERT
= 1,
685 BT_EVENT_CLASS_LOG_LEVEL_CRITICAL
= 2,
691 BT_EVENT_CLASS_LOG_LEVEL_ERROR
= 3,
697 BT_EVENT_CLASS_LOG_LEVEL_WARNING
= 4,
701 Normal, but significant, condition.
703 BT_EVENT_CLASS_LOG_LEVEL_NOTICE
= 5,
707 Informational message.
709 BT_EVENT_CLASS_LOG_LEVEL_INFO
= 6,
713 Debugging information with system-level scope
716 BT_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM
= 7,
720 Debugging information with program-level scope
723 BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM
= 8,
727 Debugging information with process-level scope
730 BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS
= 9,
734 Debugging information with module (executable/library) scope
737 BT_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE
= 10,
741 Debugging information with compilation unit scope
744 BT_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT
= 11,
748 Debugging information with function-level scope.
750 BT_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION
= 12,
754 Debugging information with function-level scope.
756 BT_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE
= 13,
760 Debugging-level message.
762 BT_EVENT_CLASS_LOG_LEVEL_DEBUG
= 14,
763 } bt_event_class_log_level
;
767 Sets the log level of the event class \bt_p{event_class} to
770 See the \ref api-tir-ev-cls-prop-log-lvl "log level" property.
772 @param[in] event_class
773 Event class of which to set the log level to \bt_p{log_level}.
775 New log level of \bt_p{event_class}.
777 @bt_pre_not_null{event_class}
778 @bt_pre_hot{event_class}
780 @sa bt_event_class_get_log_level() —
781 Returns the log level of an event class.
783 extern void bt_event_class_set_log_level(bt_event_class
*event_class
,
784 bt_event_class_log_level log_level
) __BT_NOEXCEPT
;
788 Returns the log level of the event class \bt_p{event_class}.
790 See the \ref api-tir-ev-cls-prop-log-lvl "log level" property.
792 @param[in] event_class
793 Event class of which to get the log level.
794 @param[out] log_level
795 <strong>If this function returns
796 #BT_PROPERTY_AVAILABILITY_AVAILABLE</strong>, \bt_p{*log_level} is
797 the log level of \bt_p{event_class}.
799 @retval #BT_PROPERTY_AVAILABILITY_AVAILABLE
800 The log level of \bt_p{event_class} is available.
801 @retval #BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE
802 The log level of \bt_p{event_class} is not available.
804 @bt_pre_not_null{event_class}
805 @bt_pre_not_null{log_level}
807 @sa bt_event_class_set_log_level() —
808 Sets the log level of an event class.
810 extern bt_property_availability
bt_event_class_get_log_level(
811 const bt_event_class
*event_class
,
812 bt_event_class_log_level
*log_level
) __BT_NOEXCEPT
;
816 Status codes for bt_event_class_set_emf_uri().
818 typedef enum bt_event_class_set_emf_uri_status
{
823 BT_EVENT_CLASS_SET_EMF_URI_STATUS_OK
= __BT_FUNC_STATUS_OK
,
829 BT_EVENT_CLASS_SET_EMF_URI_STATUS_MEMORY_ERROR
= __BT_FUNC_STATUS_MEMORY_ERROR
,
830 } bt_event_class_set_emf_uri_status
;
834 Sets the Eclipse Modeling Framework (EMF) URI of the event class
835 \bt_p{event_class} to a copy of \bt_p{emf_uri}.
837 See the \ref api-tir-ev-cls-prop-emf-uri "EMF URI" property.
839 @param[in] event_class
840 Event class of which to set the EMF URI to \bt_p{emf_uri}.
842 New EMF URI of \bt_p{event_class} (copied).
844 @retval #BT_EVENT_CLASS_SET_EMF_URI_STATUS_OK
846 @retval #BT_EVENT_CLASS_SET_EMF_URI_STATUS_MEMORY_ERROR
849 @bt_pre_not_null{event_class}
850 @bt_pre_hot{event_class}
851 @bt_pre_not_null{emf_uri}
853 @sa bt_event_class_get_emf_uri() —
854 Returns the EMF URI of an event class.
856 extern bt_event_class_set_emf_uri_status
bt_event_class_set_emf_uri(
857 bt_event_class
*event_class
, const char *emf_uri
) __BT_NOEXCEPT
;
861 Returns the Eclipse Modeling Framework (EMF) URI of the event
862 class \bt_p{event_class}.
864 See the \ref api-tir-ev-cls-prop-emf-uri "EMF URI" property.
866 If \bt_p{event_class} has no EMF URI, this function returns \c NULL.
868 @param[in] event_class
869 Event class of which to get the EMF URI.
873 EMF URI of \bt_p{event_class}, or \c NULL if none.
875 The returned pointer remains valid as long as \bt_p{event_class}
879 @bt_pre_not_null{event_class}
881 @sa bt_event_class_set_emf_uri() —
882 Sets the EMF URI of an event class.
884 extern const char *bt_event_class_get_emf_uri(
885 const bt_event_class
*event_class
) __BT_NOEXCEPT
;
889 Status codes for bt_event_class_set_payload_field_class() and
890 bt_event_class_set_specific_context_field_class().
892 typedef enum bt_event_class_set_field_class_status
{
897 BT_EVENT_CLASS_SET_FIELD_CLASS_STATUS_OK
= __BT_FUNC_STATUS_OK
,
903 BT_EVENT_CLASS_SET_FIELD_CLASS_STATUS_MEMORY_ERROR
= __BT_FUNC_STATUS_MEMORY_ERROR
,
904 } bt_event_class_set_field_class_status
;
908 Sets the payload \bt_fc of the event class
909 \bt_p{event_class} to \bt_p{field_class}.
911 See the \ref api-tir-ev-cls-prop-p-fc "payload field class" property.
913 @param[in] event_class
914 Event class of which to set the payload field class to
916 @param[in] field_class
917 New payload field class of \bt_p{event_class}.
919 @retval #BT_EVENT_CLASS_SET_FIELD_CLASS_STATUS_OK
921 @retval #BT_EVENT_CLASS_SET_FIELD_CLASS_STATUS_MEMORY_ERROR
924 @bt_pre_not_null{event_class}
925 @bt_pre_hot{event_class}
926 @bt_pre_not_null{field_class}
927 @bt_pre_is_struct_fc{field_class}
929 \bt_p{field_class}, or any of its contained field classes,
930 is not already part of a \bt_stream_cls or of an event class.
932 If any of the field classes recursively contained in
933 \bt_p{field_class} has a
934 \ref api-tir-fc-link "link to another field class", it must honor
935 the field class link rules.
937 @bt_post_success_frozen{field_class}
939 @sa bt_event_class_borrow_payload_field_class() —
940 Borrows the payload field class of an event class.
941 @sa bt_event_class_borrow_payload_field_class_const() —
942 Borrows the payload field class of an event class
945 extern bt_event_class_set_field_class_status
946 bt_event_class_set_payload_field_class(bt_event_class
*event_class
,
947 bt_field_class
*field_class
) __BT_NOEXCEPT
;
951 Borrows the payload \bt_fc from the event class \bt_p{event_class}.
953 See the \ref api-tir-ev-cls-prop-p-fc "payload field class" property.
955 If \bt_p{event_class} has no payload field class, this function
958 @param[in] event_class
959 Event class from which to borrow the payload field class.
962 \em Borrowed reference of the payload field class of
963 \bt_p{event_class}, or \c NULL if none.
965 @bt_pre_not_null{event_class}
967 @sa bt_event_class_set_payload_field_class() —
968 Sets the payload field class of an event class.
969 @sa bt_event_class_borrow_payload_field_class_const() —
970 \c const version of this function.
972 extern bt_field_class
*bt_event_class_borrow_payload_field_class(
973 bt_event_class
*event_class
) __BT_NOEXCEPT
;
977 Borrows the payload \bt_fc from the event class \bt_p{event_class}
980 See bt_event_class_borrow_payload_field_class().
982 extern const bt_field_class
*bt_event_class_borrow_payload_field_class_const(
983 const bt_event_class
*event_class
) __BT_NOEXCEPT
;
987 Sets the specific context \bt_fc of the event class
988 \bt_p{event_class} to \bt_p{field_class}.
990 See the \ref api-tir-ev-cls-prop-sc-fc "specific context field class"
993 @param[in] event_class
994 Event class of which to set the specific context field class to
996 @param[in] field_class
997 New specific context field class of \bt_p{event_class}.
999 @retval #BT_EVENT_CLASS_SET_FIELD_CLASS_STATUS_OK
1001 @retval #BT_EVENT_CLASS_SET_FIELD_CLASS_STATUS_MEMORY_ERROR
1004 @bt_pre_not_null{event_class}
1005 @bt_pre_hot{event_class}
1006 @bt_pre_not_null{field_class}
1007 @bt_pre_is_struct_fc{field_class}
1009 \bt_p{field_class}, or any of its contained field classes,
1010 is not already part of a \bt_stream_cls or of an event class.
1012 If any of the field classes recursively contained in
1013 \bt_p{field_class} has a
1014 \ref api-tir-fc-link "link to another field class", it must honor
1015 the field class link rules.
1017 @bt_post_success_frozen{field_class}
1019 @sa bt_event_class_borrow_specific_context_field_class() —
1020 Borrows the specific context field class of an event class.
1021 @sa bt_event_class_borrow_specific_context_field_class_const() —
1022 Borrows the specific context field class of an event class
1025 extern bt_event_class_set_field_class_status
1026 bt_event_class_set_specific_context_field_class(bt_event_class
*event_class
,
1027 bt_field_class
*field_class
) __BT_NOEXCEPT
;
1031 Borrows the specific context \bt_fc from the event class
1034 See the \ref api-tir-ev-cls-prop-sc-fc "specific context field class"
1037 If \bt_p{event_class} has no specific context field class, this function
1040 @param[in] event_class
1041 Event class from which to borrow the specific context field class.
1044 \em Borrowed reference of the specific context field class of
1045 \bt_p{event_class}, or \c NULL if none.
1047 @bt_pre_not_null{event_class}
1049 @sa bt_event_class_set_specific_context_field_class() —
1050 Sets the specific context field class of an event class.
1051 @sa bt_event_class_borrow_specific_context_field_class_const() —
1052 \c const version of this function.
1054 extern bt_field_class
*
1055 bt_event_class_borrow_specific_context_field_class(
1056 bt_event_class
*event_class
) __BT_NOEXCEPT
;
1060 Borrows the specific context \bt_fc from the event class
1061 \bt_p{event_class} (\c const version).
1063 See bt_event_class_borrow_specific_context_field_class().
1065 extern const bt_field_class
*
1066 bt_event_class_borrow_specific_context_field_class_const(
1067 const bt_event_class
*event_class
) __BT_NOEXCEPT
;
1071 Sets the user attributes of the event class \bt_p{event_class} to
1072 \bt_p{user_attributes}.
1074 See the \ref api-tir-ev-cls-prop-user-attrs "user attributes" property.
1077 When you create a default event class with bt_event_class_create()
1078 or bt_event_class_create_with_id(), the event class's initial user
1079 attributes is an empty \bt_map_val. Therefore you can borrow it with
1080 bt_event_class_borrow_user_attributes() and fill it directly instead
1081 of setting a new one with this function.
1083 @param[in] event_class
1084 Event class of which to set the user attributes to
1085 \bt_p{user_attributes}.
1086 @param[in] user_attributes
1087 New user attributes of \bt_p{event_class}.
1089 @bt_pre_not_null{event_class}
1090 @bt_pre_hot{event_class}
1091 @bt_pre_not_null{user_attributes}
1092 @bt_pre_is_map_val{user_attributes}
1094 @sa bt_event_class_borrow_user_attributes() —
1095 Borrows the user attributes of an event class.
1097 extern void bt_event_class_set_user_attributes(
1098 bt_event_class
*event_class
, const bt_value
*user_attributes
)
1103 Borrows the user attributes of the event class \bt_p{event_class}.
1105 See the \ref api-tir-ev-cls-prop-user-attrs "user attributes" property.
1108 When you create a default event class with bt_event_class_create()
1109 or bt_event_class_create_with_id(), the event class's initial user
1110 attributes is an empty \bt_map_val.
1112 @param[in] event_class
1113 Event class from which to borrow the user attributes.
1116 User attributes of \bt_p{event_class} (a \bt_map_val).
1118 @bt_pre_not_null{event_class}
1120 @sa bt_event_class_set_user_attributes() —
1121 Sets the user attributes of an event class.
1122 @sa bt_event_class_borrow_user_attributes_const() —
1123 \c const version of this function.
1125 extern bt_value
*bt_event_class_borrow_user_attributes(
1126 bt_event_class
*event_class
) __BT_NOEXCEPT
;
1130 Borrows the user attributes of the event class \bt_p{event_class}
1133 See bt_event_class_borrow_user_attributes().
1135 extern const bt_value
*bt_event_class_borrow_user_attributes_const(
1136 const bt_event_class
*event_class
) __BT_NOEXCEPT
;
1141 @name Reference count
1147 Increments the \ref api-fund-shared-object "reference count" of
1148 the event class \bt_p{event_class}.
1150 @param[in] event_class
1152 Event class of which to increment the reference count.
1157 @sa bt_event_class_put_ref() —
1158 Decrements the reference count of an event class.
1160 extern void bt_event_class_get_ref(
1161 const bt_event_class
*event_class
) __BT_NOEXCEPT
;
1165 Decrements the \ref api-fund-shared-object "reference count" of
1166 the event class \bt_p{event_class}.
1168 @param[in] event_class
1170 Event class of which to decrement the reference count.
1175 @sa bt_event_class_get_ref() —
1176 Increments the reference count of an event class.
1178 extern void bt_event_class_put_ref(
1179 const bt_event_class
*event_class
) __BT_NOEXCEPT
;
1183 Decrements the reference count of the event class
1184 \bt_p{_event_class}, and then sets \bt_p{_event_class} to \c NULL.
1188 Event class of which to decrement the reference count.
1190 Can contain \c NULL.
1193 @bt_pre_assign_expr{_event_class}
1195 #define BT_EVENT_CLASS_PUT_REF_AND_RESET(_event_class) \
1197 bt_event_class_put_ref(_event_class); \
1198 (_event_class) = NULL; \
1203 Decrements the reference count of the event class \bt_p{_dst}, sets
1204 \bt_p{_dst} to \bt_p{_src}, and then sets \bt_p{_src} to \c NULL.
1206 This macro effectively moves an event class reference from the expression
1207 \bt_p{_src} to the expression \bt_p{_dst}, putting the existing
1208 \bt_p{_dst} reference.
1212 Destination expression.
1214 Can contain \c NULL.
1220 Can contain \c NULL.
1223 @bt_pre_assign_expr{_dst}
1224 @bt_pre_assign_expr{_src}
1226 #define BT_EVENT_CLASS_MOVE_REF(_dst, _src) \
1228 bt_event_class_put_ref(_dst); \
1241 #endif /* BABELTRACE2_TRACE_IR_EVENT_CLASS_H */