1 #ifndef BABELTRACE_CTF_IR_EVENT_TYPES_H
2 #define BABELTRACE_CTF_IR_EVENT_TYPES_H
5 * BabelTrace - CTF IR: Event Types
7 * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
9 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 * The Common Trace Format (CTF) Specification is available at
30 * http://www.efficios.com/ctf
33 #include <babeltrace/ctf/events.h>
40 struct bt_ctf_event_class
;
42 struct bt_ctf_field_type
;
45 enum bt_ctf_integer_base
{
46 BT_CTF_INTEGER_BASE_UNKNOWN
= -1,
47 BT_CTF_INTEGER_BASE_BINARY
= 2,
48 BT_CTF_INTEGER_BASE_OCTAL
= 8,
49 BT_CTF_INTEGER_BASE_DECIMAL
= 10,
50 BT_CTF_INTEGER_BASE_HEXADECIMAL
= 16,
53 enum bt_ctf_byte_order
{
54 BT_CTF_BYTE_ORDER_UNKNOWN
= -1,
56 * Note that native, in the context of the CTF specification, is defined as
57 * "the byte order described in the trace" and does not mean that the host's
58 * endianness will be used.
60 BT_CTF_BYTE_ORDER_NATIVE
= 0,
61 BT_CTF_BYTE_ORDER_LITTLE_ENDIAN
,
62 BT_CTF_BYTE_ORDER_BIG_ENDIAN
,
63 BT_CTF_BYTE_ORDER_NETWORK
,
67 * bt_ctf_field_type_integer_create: create an integer field type.
69 * Allocate a new integer field type of the given size. The creation of a field
70 * type sets its reference count to 1.
72 * @param size Integer field type size/length in bits.
74 * Returns an allocated field type on success, NULL on error.
76 extern struct bt_ctf_field_type
*bt_ctf_field_type_integer_create(
80 * bt_ctf_field_type_integer_get_size: get an integer type's size.
82 * Get an integer type's size.
84 * @param integer Integer type.
86 * Returns the integer type's size, a negative value on error.
88 extern int bt_ctf_field_type_integer_get_size(
89 struct bt_ctf_field_type
*integer
);
92 * bt_ctf_field_type_integer_get_signed: get an integer type's signedness.
94 * Get an integer type's signedness attribute.
96 * @param integer Integer type.
98 * Returns the integer's signedness, a negative value on error.
100 extern int bt_ctf_field_type_integer_get_signed(
101 struct bt_ctf_field_type
*integer
);
104 * bt_ctf_field_type_integer_set_signed: set an integer type's signedness.
106 * Set an integer type's signedness attribute.
108 * @param integer Integer type.
109 * @param is_signed Integer's signedness, defaults to FALSE.
111 * Returns 0 on success, a negative value on error.
113 extern int bt_ctf_field_type_integer_set_signed(
114 struct bt_ctf_field_type
*integer
, int is_signed
);
117 * bt_ctf_field_type_integer_get_base: get an integer type's base.
119 * Get an integer type's base used to pretty-print the resulting trace.
121 * @param integer Integer type.
123 * Returns the integer type's base on success, BT_CTF_INTEGER_BASE_UNKNOWN on
126 extern enum bt_ctf_integer_base
bt_ctf_field_type_integer_get_base(
127 struct bt_ctf_field_type
*integer
);
130 * bt_ctf_field_type_integer_set_base: set an integer type's base.
132 * Set an integer type's base used to pretty-print the resulting trace.
134 * @param integer Integer type.
135 * @param base Integer base, defaults to BT_CTF_INTEGER_BASE_DECIMAL.
137 * Returns 0 on success, a negative value on error.
139 extern int bt_ctf_field_type_integer_set_base(struct bt_ctf_field_type
*integer
,
140 enum bt_ctf_integer_base base
);
143 * bt_ctf_field_type_integer_get_encoding: get an integer type's encoding.
145 * @param integer Integer type.
147 * Returns the string field's encoding on success, CTF_STRING_UNKNOWN on error.
149 extern enum ctf_string_encoding
bt_ctf_field_type_integer_get_encoding(
150 struct bt_ctf_field_type
*integer
);
153 * bt_ctf_field_type_integer_set_encoding: set an integer type's encoding.
155 * An integer encoding may be set to signal that the integer must be printed as
158 * @param integer Integer type.
159 * @param encoding Integer output encoding, defaults to CTF_STRING_ENCODING_NONE
161 * Returns 0 on success, a negative value on error.
163 extern int bt_ctf_field_type_integer_set_encoding(
164 struct bt_ctf_field_type
*integer
,
165 enum ctf_string_encoding encoding
);
168 * bt_ctf_field_type_integer_get_mapped_clock: get an integer type's mapped clock.
170 * @param integer Integer type.
172 * Returns the integer's mapped clock (if any), NULL on error.
174 extern struct bt_ctf_clock
*bt_ctf_field_type_integer_get_mapped_clock(
175 struct bt_ctf_field_type
*integer
);
178 * bt_ctf_field_type_integer_set_mapped_clock: set an integer type's mapped clock.
180 * @param integer Integer type.
181 * @param clock Clock to map.
183 * Returns 0 on success, a negative value on error.
185 extern int bt_ctf_field_type_integer_set_mapped_clock(
186 struct bt_ctf_field_type
*integer
,
187 struct bt_ctf_clock
*clock
);
190 * bt_ctf_field_type_enumeration_create: create an enumeration field type.
192 * Allocate a new enumeration field type with the given underlying type. The
193 * creation of a field type sets its reference count to 1.
194 * The resulting enumeration will share the integer_container_type's ownership
195 * by increasing its reference count.
197 * @param integer_container_type Underlying integer type of the enumeration
200 * Returns an allocated field type on success, NULL on error.
202 extern struct bt_ctf_field_type
*bt_ctf_field_type_enumeration_create(
203 struct bt_ctf_field_type
*integer_container_type
);
206 * bt_ctf_field_type_enumeration_get_container_type: get underlying container.
208 * Get the enumeration type's underlying integer container type.
210 * @param enumeration Enumeration type.
212 * Returns an allocated field type on success, NULL on error.
215 struct bt_ctf_field_type
*bt_ctf_field_type_enumeration_get_container_type(
216 struct bt_ctf_field_type
*enumeration
);
219 * bt_ctf_field_type_enumeration_add_mapping: add an enumeration mapping.
221 * Add a mapping to the enumeration. The range's values are inclusive.
223 * @param enumeration Enumeration type.
224 * @param name Enumeration mapping name (will be copied).
225 * @param range_start Enumeration mapping range start.
226 * @param range_end Enumeration mapping range end.
228 * Returns 0 on success, a negative value on error.
230 extern int bt_ctf_field_type_enumeration_add_mapping(
231 struct bt_ctf_field_type
*enumeration
, const char *name
,
232 int64_t range_start
, int64_t range_end
);
235 * bt_ctf_field_type_enumeration_add_mapping_unsigned: add an enumeration
238 * Add a mapping to the enumeration. The range's values are inclusive.
240 * @param enumeration Enumeration type.
241 * @param name Enumeration mapping name (will be copied).
242 * @param range_start Enumeration mapping range start.
243 * @param range_end Enumeration mapping range end.
245 * Returns 0 on success, a negative value on error.
247 extern int bt_ctf_field_type_enumeration_add_mapping_unsigned(
248 struct bt_ctf_field_type
*enumeration
, const char *name
,
249 uint64_t range_start
, uint64_t range_end
);
252 * bt_ctf_field_type_enumeration_get_mapping_count: Get the number of mappings
253 * defined in the enumeration.
255 * @param enumeration Enumeration type.
257 * Returns the mapping count on success, a negative value on error.
259 extern int bt_ctf_field_type_enumeration_get_mapping_count(
260 struct bt_ctf_field_type
*enumeration
);
263 * bt_ctf_field_type_enumeration_get_mapping: get an enumeration mapping.
265 * @param enumeration Enumeration type.
266 * @param index Index of mapping.
267 * @param name Pointer where the mapping's name will be returned (valid for
268 * the lifetime of the enumeration).
269 * @param range_start Pointer where the enumeration mapping's range start will
271 * @param range_end Pointer where the enumeration mapping's range end will
274 * Returns 0 on success, a negative value on error.
276 extern int bt_ctf_field_type_enumeration_get_mapping(
277 struct bt_ctf_field_type
*enumeration
, int index
,
278 const char **name
, int64_t *range_start
, int64_t *range_end
);
281 * bt_ctf_field_type_enumeration_get_mapping_unsigned: get a mapping.
283 * @param enumeration Enumeration type.
284 * @param index Index of mapping.
285 * @param name Pointer where the mapping's name will be returned (valid for
286 * the lifetime of the enumeration).
287 * @param range_start Pointer where the enumeration mapping's range start will
289 * @param range_end Pointer where the enumeration mapping's range end will
292 * Returns 0 on success, a negative value on error.
294 extern int bt_ctf_field_type_enumeration_get_mapping_unsigned(
295 struct bt_ctf_field_type
*enumeration
, int index
,
296 const char **name
, uint64_t *range_start
,
297 uint64_t *range_end
);
300 * bt_ctf_field_type_enumeration_get_mapping_index_by_name: get an enumerations'
301 * mapping index by name.
303 * @param enumeration Enumeration type.
304 * @param name Mapping name.
306 * Returns mapping index on success, a negative value on error.
308 extern int bt_ctf_field_type_enumeration_get_mapping_index_by_name(
309 struct bt_ctf_field_type
*enumeration
, const char *name
);
312 * bt_ctf_field_type_enumeration_get_mapping_index_by_value: get an
313 * enumerations' mapping index by value.
315 * @param enumeration Enumeration type.
316 * @param value Value.
318 * Returns mapping index on success, a negative value on error.
320 extern int bt_ctf_field_type_enumeration_get_mapping_index_by_value(
321 struct bt_ctf_field_type
*enumeration
, int64_t value
);
324 * bt_ctf_field_type_enumeration_get_mapping_index_by_unsigned_value: get an
325 * enumerations' mapping index by value.
327 * @param enumeration Enumeration type.
328 * @param value Value.
330 * Returns 0 on success, a negative value on error.
332 extern int bt_ctf_field_type_enumeration_get_mapping_index_by_unsigned_value(
333 struct bt_ctf_field_type
*enumeration
, uint64_t value
);
336 * bt_ctf_field_type_floating_point_create: create a floating point field type.
338 * Allocate a new floating point field type. The creation of a field type sets
339 * its reference count to 1.
341 * Returns an allocated field type on success, NULL on error.
343 extern struct bt_ctf_field_type
*bt_ctf_field_type_floating_point_create(void);
346 * bt_ctf_field_type_floating_point_get_exponent_digits: get exponent digit
349 * @param floating_point Floating point type.
351 * Returns the exponent digit count on success, a negative value on error.
353 extern int bt_ctf_field_type_floating_point_get_exponent_digits(
354 struct bt_ctf_field_type
*floating_point
);
357 * bt_ctf_field_type_floating_point_set_exponent_digits: set exponent digit
360 * Set the number of exponent digits to use to store the floating point field.
361 * The only values currently supported are FLT_EXP_DIG and DBL_EXP_DIG.
363 * @param floating_point Floating point type.
364 * @param exponent_digits Number of digits to allocate to the exponent (defaults
367 * Returns 0 on success, a negative value on error.
369 extern int bt_ctf_field_type_floating_point_set_exponent_digits(
370 struct bt_ctf_field_type
*floating_point
,
371 unsigned int exponent_digits
);
374 * bt_ctf_field_type_floating_point_get_mantissa_digits: get mantissa digit
377 * @param floating_point Floating point type.
379 * Returns the mantissa digit count on success, a negative value on error.
381 extern int bt_ctf_field_type_floating_point_get_mantissa_digits(
382 struct bt_ctf_field_type
*floating_point
);
385 * bt_ctf_field_type_floating_point_set_mantissa_digits: set mantissa digit
388 * Set the number of mantissa digits to use to store the floating point field.
389 * The only values currently supported are FLT_MANT_DIG and DBL_MANT_DIG.
391 * @param floating_point Floating point type.
392 * @param mantissa_digits Number of digits to allocate to the mantissa (defaults
395 * Returns 0 on success, a negative value on error.
397 extern int bt_ctf_field_type_floating_point_set_mantissa_digits(
398 struct bt_ctf_field_type
*floating_point
,
399 unsigned int mantissa_digits
);
402 * bt_ctf_field_type_structure_create: create a structure field type.
404 * Allocate a new structure field type. The creation of a field type sets
405 * its reference count to 1.
407 * Returns an allocated field type on success, NULL on error.
409 extern struct bt_ctf_field_type
*bt_ctf_field_type_structure_create(void);
412 * bt_ctf_field_type_structure_add_field: add a field to a structure.
414 * Add a field of type "field_type" to the structure. The structure will share
415 * field_type's ownership by increasing its reference count.
417 * @param structure Structure type.
418 * @param field_type Type of the field to add to the structure type.
419 * @param field_name Name of the structure's new field (will be copied).
421 * Returns 0 on success, a negative value on error.
423 extern int bt_ctf_field_type_structure_add_field(
424 struct bt_ctf_field_type
*structure
,
425 struct bt_ctf_field_type
*field_type
,
426 const char *field_name
);
429 * bt_ctf_field_type_structure_get_field_count: Get the number of fields defined
432 * @param structure Structure type.
434 * Returns the field count on success, a negative value on error.
436 extern int bt_ctf_field_type_structure_get_field_count(
437 struct bt_ctf_field_type
*structure
);
440 * bt_ctf_field_type_structure_get_field: get a structure's field type and name.
442 * @param structure Structure type.
443 * @param field_type Pointer to a const char* where the field's name will
445 * @param field_type Pointer to a bt_ctf_field_type* where the field's type will
447 * @param index Index of field.
449 * Returns 0 on success, a negative value on error.
451 extern int bt_ctf_field_type_structure_get_field(
452 struct bt_ctf_field_type
*structure
,
453 const char **field_name
, struct bt_ctf_field_type
**field_type
,
457 * bt_ctf_field_type_structure_get_field_type_by_name: get a structure field's
460 * @param structure Structure type.
461 * @param field_name Name of the structure's field.
463 * Returns a field type instance on success, NULL on error.
466 struct bt_ctf_field_type
*bt_ctf_field_type_structure_get_field_type_by_name(
467 struct bt_ctf_field_type
*structure
, const char *field_name
);
470 * bt_ctf_field_type_variant_create: create a variant field type.
472 * Allocate a new variant field type. The creation of a field type sets
473 * its reference count to 1. tag_name must be the name of an enumeration
474 * field declared in the same scope as this variant.
476 * @param enum_tag Type of the variant's tag/selector (must be an enumeration).
477 * @param tag_name Name of the variant's tag/selector field (will be copied).
479 * Returns an allocated field type on success, NULL on error.
481 extern struct bt_ctf_field_type
*bt_ctf_field_type_variant_create(
482 struct bt_ctf_field_type
*enum_tag
, const char *tag_name
);
485 * bt_ctf_field_type_variant_get_tag_type: get a variant's tag type.
487 * @param variant Variant type.
489 * Returns a field type instance on success, NULL if unset.
491 extern struct bt_ctf_field_type
*bt_ctf_field_type_variant_get_tag_type(
492 struct bt_ctf_field_type
*variant
);
495 * bt_ctf_field_type_variant_get_tag_name: get a variant's tag name.
497 * @param variant Variant type.
499 * Returns the tag field's name, NULL if unset.
501 extern const char *bt_ctf_field_type_variant_get_tag_name(
502 struct bt_ctf_field_type
*variant
);
505 * bt_ctf_field_type_variant_set_tag_name: set a variant's tag name.
507 * @param variant Variant type.
508 * @param name Tag field name.
510 * Returns 0 on success, a negative value on error.
512 extern int bt_ctf_field_type_variant_set_tag_name(
513 struct bt_ctf_field_type
*variant
, const char *name
);
516 * bt_ctf_field_type_variant_add_field: add a field to a variant.
518 * Add a field of type "field_type" to the variant. The variant will share
519 * field_type's ownership by increasing its reference count. The "field_name"
520 * will be copied. field_name must match a mapping in the tag/selector
523 * @param variant Variant type.
524 * @param field_type Type of the variant type's new field.
525 * @param field_name Name of the variant type's new field (will be copied).
527 * Returns 0 on success, a negative value on error.
529 extern int bt_ctf_field_type_variant_add_field(
530 struct bt_ctf_field_type
*variant
,
531 struct bt_ctf_field_type
*field_type
,
532 const char *field_name
);
535 * bt_ctf_field_type_variant_get_field_type_by_name: get variant field's type.
537 * @param structure Variant type.
538 * @param field_name Name of the variant's field.
540 * Returns a field type instance on success, NULL on error.
543 struct bt_ctf_field_type
*bt_ctf_field_type_variant_get_field_type_by_name(
544 struct bt_ctf_field_type
*variant
, const char *field_name
);
547 * bt_ctf_field_type_variant_get_field_type_from_tag: get variant field's type.
549 * @param variant Variant type.
550 * @param tag Type tag (enum).
552 * Returns a field type instance on success, NULL on error.
555 struct bt_ctf_field_type
*bt_ctf_field_type_variant_get_field_type_from_tag(
556 struct bt_ctf_field_type
*variant
, struct bt_ctf_field
*tag
);
559 * bt_ctf_field_type_variant_get_field_count: Get the number of fields defined
562 * @param variant Variant type.
564 * Returns the field count on success, a negative value on error.
566 extern int bt_ctf_field_type_variant_get_field_count(
567 struct bt_ctf_field_type
*variant
);
570 * bt_ctf_field_type_variant_get_field: get a variant's field name and type.
572 * @param variant Variant type.
573 * @param field_type Pointer to a const char* where the field's name will
575 * @param field_type Pointer to a bt_ctf_field_type* where the field's type will
577 * @param index Index of field.
579 * Returns 0 on success, a negative value on error.
581 extern int bt_ctf_field_type_variant_get_field(
582 struct bt_ctf_field_type
*variant
, const char **field_name
,
583 struct bt_ctf_field_type
**field_type
, int index
);
586 * bt_ctf_field_type_array_create: create an array field type.
588 * Allocate a new array field type. The creation of a field type sets
589 * its reference count to 1.
591 * @param element_type Array's element type.
592 * @oaram length Array type's length.
594 * Returns an allocated field type on success, NULL on error.
596 extern struct bt_ctf_field_type
*bt_ctf_field_type_array_create(
597 struct bt_ctf_field_type
*element_type
, unsigned int length
);
600 * bt_ctf_field_type_array_get_element_type: get an array's element type.
602 * @param array Array type.
604 * Returns a field type instance on success, NULL on error.
606 extern struct bt_ctf_field_type
*bt_ctf_field_type_array_get_element_type(
607 struct bt_ctf_field_type
*array
);
610 * bt_ctf_field_type_array_get_length: get an array's length.
612 * @param array Array type.
614 * Returns the array's length on success, a negative value on error.
616 extern int64_t bt_ctf_field_type_array_get_length(
617 struct bt_ctf_field_type
*array
);
620 * bt_ctf_field_type_sequence_create: create a sequence field type.
622 * Allocate a new sequence field type. The creation of a field type sets
623 * its reference count to 1. "length_field_name" must match an integer field
624 * declared in the same scope.
626 * @param element_type Sequence's element type.
627 * @param length_field_name Name of the sequence's length field (will be
630 * Returns an allocated field type on success, NULL on error.
632 extern struct bt_ctf_field_type
*bt_ctf_field_type_sequence_create(
633 struct bt_ctf_field_type
*element_type
,
634 const char *length_field_name
);
637 * bt_ctf_field_type_sequence_get_element_type: get a sequence's element type.
639 * @param sequence Sequence type.
641 * Returns a field type instance on success, NULL on error.
643 extern struct bt_ctf_field_type
*bt_ctf_field_type_sequence_get_element_type(
644 struct bt_ctf_field_type
*sequence
);
647 * bt_ctf_field_type_sequence_get_length_field_name: get length field name.
649 * @param sequence Sequence type.
651 * Returns the sequence's length field on success, NULL on error.
653 extern const char *bt_ctf_field_type_sequence_get_length_field_name(
654 struct bt_ctf_field_type
*sequence
);
657 * bt_ctf_field_type_string_create: create a string field type.
659 * Allocate a new string field type. The creation of a field type sets
660 * its reference count to 1.
662 * Returns an allocated field type on success, NULL on error.
664 extern struct bt_ctf_field_type
*bt_ctf_field_type_string_create(void);
667 * bt_ctf_field_type_string_get_encoding: get a string type's encoding.
669 * Get the string type's encoding.
671 * @param string_type String type.
673 * Returns the string's encoding on success, a CTF_STRING_UNKNOWN on error.
675 extern enum ctf_string_encoding
bt_ctf_field_type_string_get_encoding(
676 struct bt_ctf_field_type
*string_type
);
679 * bt_ctf_field_type_string_set_encoding: set a string type's encoding.
681 * Set the string type's encoding.
683 * @param string_type String type.
684 * @param encoding String field encoding, default CTF_STRING_ENCODING_ASCII.
685 * Valid values are CTF_STRING_ENCODING_ASCII and CTF_STRING_ENCODING_UTF8.
687 * Returns 0 on success, a negative value on error.
689 extern int bt_ctf_field_type_string_set_encoding(
690 struct bt_ctf_field_type
*string_type
,
691 enum ctf_string_encoding encoding
);
694 * bt_ctf_field_type_get_alignment: get a field type's alignment.
696 * Get the field type's alignment.
698 * @param type Field type.
700 * Returns the field type's alignment on success, a negative value on error and
701 * 0 if the alignment is undefined (as in the case of a variant).
703 extern int bt_ctf_field_type_get_alignment(struct bt_ctf_field_type
*type
);
706 * bt_ctf_field_type_set_alignment: set a field type's alignment.
708 * Set the field type's alignment.
710 * @param type Field type.
711 * @param alignment Type's alignment. Defaults to 1 (bit-aligned). However,
712 * some types, such as structures and string, may impose other alignment
715 * Returns 0 on success, a negative value on error.
717 extern int bt_ctf_field_type_set_alignment(struct bt_ctf_field_type
*type
,
718 unsigned int alignment
);
721 * bt_ctf_field_type_get_byte_order: get a field type's byte order.
723 * @param type Field type.
725 * Returns the field type's byte order on success, a negative value on error.
727 extern enum bt_ctf_byte_order
bt_ctf_field_type_get_byte_order(
728 struct bt_ctf_field_type
*type
);
731 * bt_ctf_field_type_set_byte_order: set a field type's byte order.
733 * Set the field type's byte order.
735 * @param type Field type.
736 * @param byte_order Field type's byte order. Defaults to
737 * BT_CTF_BYTE_ORDER_NATIVE; the trace's endianness.
739 * Returns 0 on success, a negative value on error.
741 extern int bt_ctf_field_type_set_byte_order(struct bt_ctf_field_type
*type
,
742 enum bt_ctf_byte_order byte_order
);
745 * bt_ctf_field_type_compare: compare two field types recursively
747 * Compare two field types recursively.
749 * The registered tag field type of a variant field type is ignored:
750 * only the tag strings are compared.
752 * @param type_a Field type A.
753 * @param type_b Field type B.
755 * Returns 0 if both field types are semantically equivalent, a positive
756 * value if they are not equivalent, or a negative value on error.
758 extern int bt_ctf_field_type_compare(struct bt_ctf_field_type
*type_a
,
759 struct bt_ctf_field_type
*type_b
);
762 * bt_ctf_field_type_get_type_id: get a field type's ctf_type_id.
764 * @param type Field type.
766 * Returns the field type's ctf_type_id, CTF_TYPE_UNKNOWN on error.
768 extern enum ctf_type_id
bt_ctf_field_type_get_type_id(
769 struct bt_ctf_field_type
*type
);
772 * bt_ctf_field_type_is_integer: returns whether or not a given field
773 * type is an integer type.
775 * @param type Field type.
777 * Returns 1 if the field type is an integer type, 0 otherwise.
779 extern int bt_ctf_field_type_is_integer(struct bt_ctf_field_type
*type
);
782 * bt_ctf_field_type_is_floating_point: returns whether or not a given field
783 * type is a floating point number type.
785 * @param type Field type.
787 * Returns 1 if the field type is a floating point number type, 0 otherwise.
789 extern int bt_ctf_field_type_is_floating_point(struct bt_ctf_field_type
*type
);
792 * bt_ctf_field_type_is_enumeration: returns whether or not a given field
793 * type is an enumeration type.
795 * @param type Field type.
797 * Returns 1 if the field type is an enumeration type, 0 otherwise.
799 extern int bt_ctf_field_type_is_enumeration(struct bt_ctf_field_type
*type
);
802 * bt_ctf_field_type_is_string: returns whether or not a given field
803 * type is a string type.
805 * @param type Field type.
807 * Returns 1 if the field type is a string type, 0 otherwise.
809 extern int bt_ctf_field_type_is_string(struct bt_ctf_field_type
*type
);
812 * bt_ctf_field_type_is_structure: returns whether or not a given field
813 * type is a structure type.
815 * @param type Field type.
817 * Returns 1 if the field type is a structure type, 0 otherwise.
819 extern int bt_ctf_field_type_is_structure(struct bt_ctf_field_type
*type
);
822 * bt_ctf_field_type_is_array: returns whether or not a given field
823 * type is an array type.
825 * @param type Field type.
827 * Returns 1 if the field type is an array type, 0 otherwise.
829 extern int bt_ctf_field_type_is_array(struct bt_ctf_field_type
*type
);
832 * bt_ctf_field_type_is_sequence: returns whether or not a given field
833 * type is a sequence type.
835 * @param type Field type.
837 * Returns 1 if the field type is a sequence type, 0 otherwise.
839 extern int bt_ctf_field_type_is_sequence(struct bt_ctf_field_type
*type
);
842 * bt_ctf_field_type_is_variant: returns whether or not a given field
843 * type is a variant type.
845 * @param type Field type.
847 * Returns 1 if the field type is a variant type, 0 otherwise.
849 extern int bt_ctf_field_type_is_variant(struct bt_ctf_field_type
*type
);
852 * bt_ctf_field_type_get and bt_ctf_field_type_put: increment and decrement
853 * the field type's reference count.
855 * You may also use bt_ctf_get() and bt_ctf_put() with field type objects.
857 * These functions ensure that the field type won't be destroyed while it
858 * is in use. The same number of get and put (plus one extra put to
859 * release the initial reference done at creation) have to be done to
860 * destroy a field type.
862 * When the field type's reference count is decremented to 0 by a
863 * bt_ctf_field_type_put, the field type is freed.
865 * @param type Field type.
867 extern void bt_ctf_field_type_get(struct bt_ctf_field_type
*type
);
868 extern void bt_ctf_field_type_put(struct bt_ctf_field_type
*type
);
874 #endif /* BABELTRACE_CTF_IR_EVENT_TYPES_H */