1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
= YAML dynamic array field type objects
A _**dynamic array field type object**_ is the type of dynamic
(variable-length) array data fields, found in
xref:how-barectf-works:ctf-primer.adoc#ds[data streams].
A dynamic array data field is a sequence of data fields, or _elements_.
In CTF, the number of elements in a dynamic array data field (its
length) is the value of a prior integer data field.
[[props]]
== Properties
[%autowidth.stretch, cols="d,d,a,d"]
|===
|Name |Type |Description |{req-abbr}
|[[class-prop]]`class`
|String
|This property's value must be `dynamic-array`.
|Yes if the <<inherit-prop,`$inherit`>> property is not set.
include::partial$ft-obj-inherit-prop.adoc[]
|[[element-ft-prop]]`element-field-type`
|xref:ft-obj.adoc[Field type object] (except a
xref:struct-ft-obj.adoc[structure field type object] and a
dynamic array field type object) or string
|Type of each element (data fields) in this field type's instances.
If this property's value is a string, it must be the name of an existing
xref:trace-type-obj.adoc#ft-aliases-prop[field type alias]. This
field type must _not_ be a structure field type or a dynamic array
field type.
|Yes
|===
== Generated C{nbsp}types
barectf always generates two packet opening or tracing function
parameters for a dynamic array field type object. Their C{nbsp}types
are:
Dynamic array's length::
`uint32_t`
Dynamic array's data::
Pointer to `const __T__`, where `__T__` is the generated C{nbsp}type
for the field type object of the
<<element-ft-prop,`element-field-type` property>>.
+
include::partial$array-ft-obj-gen-c-types-example.adoc[]
== Examples
.Dynamic array field type object: 8-bit unsigned xref:int-ft-obj.adoc[integers].
====
[source,yaml]
----
class: dynamic-array
element-field-type: uint8
----
====
.Dynamic array field type object: xref:str-ft-obj.adoc[strings].
====
[source,yaml]
----
class: dynamic-array
element-field-type:
class: string
----
====
.Dynamic array field type object: xref:static-array-ft-obj.adoc[static arrays] of 32{nbsp}double-precision xref:real-ft-obj.adoc[reals].
====
[source,yaml]
----
class: dynamic-array
element-field-type:
class: static-array
length: 32
element-field-type:
class: real
size: 64
----
====
|