X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=include%2Fbabeltrace%2Fctf-ir%2Ffield-path.h;h=7c435abcda81e22405a94a4fd3255d564dab33da;hp=d5e5e43dc9e12e9ced15fd5472282b9b63142637;hb=44c440bc5fe8219cc17d1b786d91fd83c4c9860a;hpb=c800eb3790218d2f33df01e77ec38cbd43cc02a1 diff --git a/include/babeltrace/ctf-ir/field-path.h b/include/babeltrace/ctf-ir/field-path.h index d5e5e43d..7c435abc 100644 --- a/include/babeltrace/ctf-ir/field-path.h +++ b/include/babeltrace/ctf-ir/field-path.h @@ -4,7 +4,7 @@ /* * BabelTrace - CTF IR: Field path * - * Copyright 2016 Philippe Proulx + * Copyright 2016-2018 Philippe Proulx * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -34,106 +34,25 @@ extern "C" { #endif -struct bt_field_type; - -/** -@defgroup ctfirfieldpath CTF IR field path -@ingroup ctfir -@brief CTF IR field path. - -@code -#include -@endcode - -A CTF IR field path represents an absolute -path to a field in the hierarchy of a -\link ctfirtraceclass CTF IR trace class\endlink, of a -\link ctfirstreamclass CTF IR stream class\endlink, or of a -\link ctfireventclass CTF IR event class\endlink. - -As a reminder, here's the structure of a CTF packet: - -@imgpacketstructure - -Sequence and variant \link ctfirfieldtypes CTF IR field types\endlink -can return a field path to resp. their length field and tag field -with resp. bt_field_type_sequence_get_length_field_path() and -bt_field_type_variant_get_tag_field_path(). - -A field path has a root scope which indicates from which of the -six CTF scopes to begin. It also has a list of structure field path -indexes which indicate the path to take to reach the destination -field. A path index set to -1 means that you need to continue the lookup -within the current element of an array or sequence field. - -As with any Babeltrace object, CTF IR field path objects have -reference -counts. See \ref refs to learn more about the reference counting -management of Babeltrace objects. - -@file -@brief CTF IR field path type and functions. -@sa ctfirfieldpath - -@addtogroup ctfirfieldpath -@{ -*/ - -/** -@struct bt_field_path -@brief A CTF IR field path. -@sa ctfirfieldpath -*/ struct bt_field_path; -/** -@brief Returns the root scope of the CTF IR field path \p field_path. +enum bt_scope { + BT_SCOPE_PACKET_HEADER, + BT_SCOPE_PACKET_CONTEXT, + BT_SCOPE_EVENT_HEADER, + BT_SCOPE_EVENT_COMMON_CONTEXT, + BT_SCOPE_EVENT_SPECIFIC_CONTEXT, + BT_SCOPE_EVENT_PAYLOAD, +}; -@param[in] field_path Field path of which to get the root scope. -@returns Root scope of \p field_path, or - #BT_SCOPE_UNKNOWN on error. - -@prenotnull{field_path} -@postrefcountsame{field_path} -*/ extern enum bt_scope bt_field_path_get_root_scope( - const struct bt_field_path *field_path); - -/** -@brief Returns the number of path indexes contained in the CTF IR field - path \p field_path. - -@param[in] field_path Field path of which to get the number of - path indexes. -@returns Number of path indexes contained in - \p field_path, or a negative value on error. - -@prenotnull{field_path} -@postrefcountsame{field_path} -*/ -extern int64_t bt_field_path_get_index_count( - const struct bt_field_path *field_path); - -/** -@brief Returns the path index contained in the CTF IR field - path \p field_path at index \p index. - -@param[in] field_path Field path of which to get the path index - at index \p index. -@param[in] index Index of path index to get. -@returns Path index of \p field_path at index \p index, - or \c INT_MIN on error. + struct bt_field_path *field_path); -@prenotnull{field_path} -@pre \p index is lesser than the number of path indexes contained in the - field path \p field_path (see - bt_field_path_get_index_count()). -@postrefcountsame{field_path} -*/ -extern int bt_field_path_get_index( - const struct bt_field_path *field_path, uint64_t index); +extern uint64_t bt_field_path_get_index_count( + struct bt_field_path *field_path); -/** @} */ +extern uint64_t bt_field_path_get_index_by_index( + struct bt_field_path *field_path, uint64_t index); #ifdef __cplusplus }