Babeltrace 2 C API
2.0.0
Open-source trace manipulation framework
|
Path to a field.
A field path indicates how to reach a given field from a given root scope.
More specifically, a field path indicates how to reach:
You can borrow the field path from the classes of such fields with bt_field_class_array_dynamic_with_length_field_borrow_length_field_path_const(), bt_field_class_option_with_selector_field_borrow_selector_field_path_const(), and bt_field_class_variant_with_selector_field_borrow_selector_field_path_const(). Note that the field path properties of those field classes only becomes available when the field class becomes part of an event class or of a stream class. See Field classes with links to other field classes.
A field path is a trace IR metadata object.
A field path is a shared object: get a new reference with bt_field_path_get_ref() and put an existing reference with bt_field_path_put_ref().
The type of a field path is bt_field_path.
A field path has the following properties:
Indicates from which structure field to start a lookup.
See Lookup algorithm to learn more.
Get a field path's root scope with bt_field_path_get_root_scope().
Each item in a field path's item list indicates which action to take to follow the path to the linked field.
See Lookup algorithm to learn more.
Get the number of items in a field path with bt_field_path_get_item_count().
Borrow an item from a field path with bt_field_path_borrow_item_by_index_const(). This function returns the bt_field_path_item type.
A field path item is a unique object: it belongs to the field path which contains it.
The field resolution algorithm using a field path is:
Use the appropriate function to set a current field variable from the root scope (as returned by bt_field_path_get_root_scope()):
For each field path item (use bt_field_path_get_item_count() and bt_field_path_borrow_item_by_index_const()), depending on the item's type (as returned by bt_field_path_item_get_type()):
Call bt_field_path_item_index_get_index() to get the item's index value.
Depending on the current field's class's type (as returned by bt_field_get_class_type()):
Call bt_field_structure_borrow_member_field_by_index_const() with the current field and with the item's index to set the new current field.
Call bt_field_array_borrow_element_field_by_index_const() with the index of the field eventually containing the field with a link (dynamic array field, option field, or variant field) and the current field to set the new current field.
After applying this procedure, the current field is the linked field.
Field path | |
enum | bt_field_path_scope { BT_FIELD_PATH_SCOPE_PACKET_CONTEXT, BT_FIELD_PATH_SCOPE_EVENT_COMMON_CONTEXT, BT_FIELD_PATH_SCOPE_EVENT_SPECIFIC_CONTEXT, BT_FIELD_PATH_SCOPE_EVENT_PAYLOAD } |
Field path scopes. More... | |
typedef enum bt_field_path_scope | bt_field_path_scope |
Field path scopes. | |
typedef struct bt_field_path | bt_field_path |
Field path. | |
bt_field_path_scope | bt_field_path_get_root_scope (const bt_field_path *field_path) |
Returns the root scope of the field path field_path. More... | |
uint64_t | bt_field_path_get_item_count (const bt_field_path *field_path) |
Returns the number of items contained in the field path field_path. More... | |
const bt_field_path_item * | bt_field_path_borrow_item_by_index_const (const bt_field_path *field_path, uint64_t index) |
Borrows the item at index index from the field path field_path. More... | |
void | bt_field_path_get_ref (const bt_field_path *field_path) |
Increments the reference count of the field path field_path. More... | |
void | bt_field_path_put_ref (const bt_field_path *field_path) |
Decrements the reference count of the field path field_path. More... | |
#define | BT_FIELD_PATH_PUT_REF_AND_RESET(_field_path) |
Decrements the reference count of the field path _field_path, and then sets _field_path to NULL . More... | |
#define | BT_FIELD_PATH_MOVE_REF(_dst, _src) |
Decrements the reference count of the field path _dst, sets _dst to _src, and then sets _src to NULL . More... | |
Field path item | |
enum | bt_field_path_item_type { BT_FIELD_PATH_ITEM_TYPE_INDEX, BT_FIELD_PATH_ITEM_TYPE_CURRENT_ARRAY_ELEMENT, BT_FIELD_PATH_ITEM_TYPE_CURRENT_OPTION_CONTENT } |
Field path item type enumerators. More... | |
typedef enum bt_field_path_item_type | bt_field_path_item_type |
Field path item type enumerators. | |
typedef struct bt_field_path_item | bt_field_path_item |
Field path item. | |
bt_field_path_item_type | bt_field_path_item_get_type (const bt_field_path_item *item) |
Returns the type enumerator of the field path item item. More... | |
uint64_t | bt_field_path_item_index_get_index (const bt_field_path_item *item) |
Returns the index value of the index field path item item. More... | |
enum bt_field_path_scope |
Field path item type enumerators.
Enumerator | |
---|---|
BT_FIELD_PATH_ITEM_TYPE_INDEX | Index of a structure field member or selected variant field option's field. |
BT_FIELD_PATH_ITEM_TYPE_CURRENT_ARRAY_ELEMENT | Common field of an array field. |
BT_FIELD_PATH_ITEM_TYPE_CURRENT_OPTION_CONTENT | Current field of an option field. |
#define BT_FIELD_PATH_PUT_REF_AND_RESET | ( | _field_path | ) |
Decrements the reference count of the field path _field_path, and then sets _field_path to NULL
.
_field_path | Field path of which to decrement the reference count. Can contain |
#define BT_FIELD_PATH_MOVE_REF | ( | _dst, | |
_src | |||
) |
Decrements the reference count of the field path _dst, sets _dst to _src, and then sets _src to NULL
.
This macro effectively moves a field path reference from the expression _src to the expression _dst, putting the existing _dst reference.
_dst | Destination expression. Can contain |
_src | Source expression. Can contain |
bt_field_path_scope bt_field_path_get_root_scope | ( | const bt_field_path * | field_path | ) |
Returns the root scope of the field path field_path.
See the root scope property.
[in] | field_path | Field path of which to get the root scope. |
NULL
. uint64_t bt_field_path_get_item_count | ( | const bt_field_path * | field_path | ) |
Returns the number of items contained in the field path field_path.
See the items property.
[in] | field_path | Field path of which to get the number of contained items. |
NULL
. const bt_field_path_item* bt_field_path_borrow_item_by_index_const | ( | const bt_field_path * | field_path, |
uint64_t | index | ||
) |
Borrows the item at index index from the field path field_path.
See the items property.
[in] | field_path | Field path from which to borrow the item at index index. |
[in] | index | Index of the item to borrow from field_path. |
Borrowed reference of the item of field_path at index index.
The returned pointer remains valid as long as field_path exists.
NULL
. void bt_field_path_get_ref | ( | const bt_field_path * | field_path | ) |
Increments the reference count of the field path field_path.
[in] | field_path | Field path of which to increment the reference count. Can be |
void bt_field_path_put_ref | ( | const bt_field_path * | field_path | ) |
Decrements the reference count of the field path field_path.
[in] | field_path | Field path of which to decrement the reference count. Can be |
bt_field_path_item_type bt_field_path_item_get_type | ( | const bt_field_path_item * | item | ) |
Returns the type enumerator of the field path item item.
See the items property.
[in] | item | Field path item of which to get the type enumerator |
NULL
. uint64_t bt_field_path_item_index_get_index | ( | const bt_field_path_item * | item | ) |
Returns the index value of the index field path item item.
See the items property.
[in] | item | Index field path item of which to get the index value. |
NULL
.