for (i = 0; i < bt_plugin_get_component_class_count(plugin); i++) {
struct bt_component_class *comp_cls =
- bt_plugin_get_component_class(plugin, i);
+ bt_plugin_get_component_class_by_index(plugin, i);
const char *comp_class_name =
bt_component_class_get_name(comp_cls);
const char *comp_class_description =
for (j = 0; j < component_classes_count; j++) {
struct bt_component_class *comp_class =
- bt_plugin_get_component_class(plugin, j);
+ bt_plugin_get_component_class_by_index(
+ plugin, j);
const char *comp_class_name =
bt_component_class_get_name(comp_class);
const char *comp_class_description =
BT_HIDDEN
int bt_ctf_event_class_set_stream_id(struct bt_ctf_event_class *event_class,
- uint32_t stream_id);
+ uint64_t stream_id);
static inline
struct bt_ctf_stream_class *bt_ctf_event_class_borrow_stream_class(
@prenotnull{event_class}
@prehot{event_class}
+@pre \p id is lesser than or equal to 9223372036854775807 (\c INT64_MAX).
@postrefcountsame{event_class}
@sa bt_ctf_event_class_get_id(): Returns the numeric ID of a given
event class.
*/
extern int bt_ctf_event_class_set_id(
- struct bt_ctf_event_class *event_class, uint32_t id);
+ struct bt_ctf_event_class *event_class, uint64_t id);
/**
@brief Returns the number of attributes contained in the CTF IR event
@prenotnull{event_class}
@postrefcountsame{event_class}
-@sa bt_ctf_event_class_get_attribute_name(): Returns the name of
- the attribute of a given event class at a given index.
-@sa bt_ctf_event_class_get_attribute_value(): Returns the value of
- the attribute of a given event class at a given index.
+@sa bt_ctf_event_class_get_attribute_name_by_index(): Returns the name
+ of the attribute of a given event class at a given index.
+@sa bt_ctf_event_class_get_attribute_value_by_index(): Returns the value
+ of the attribute of a given event class at a given index.
*/
extern int64_t bt_ctf_event_class_get_attribute_count(
struct bt_ctf_event_class *event_class);
\p event_class.
@postrefcountsame{event_class}
-@sa bt_ctf_event_class_get_attribute_value(): Returns the value of
- the attribute of a given event class at a given index.
+@sa bt_ctf_event_class_get_attribute_value_by_index(): Returns the value
+ of the attribute of a given event class at a given index.
*/
extern const char *
-bt_ctf_event_class_get_attribute_name(
- struct bt_ctf_event_class *event_class, int index);
+bt_ctf_event_class_get_attribute_name_by_index(
+ struct bt_ctf_event_class *event_class, uint64_t index);
/**
@brief Returns the value of the attribute at the index \p index of the
@postsuccessrefcountretinc
@postrefcountsame{event_class}
-@sa bt_ctf_event_class_get_attribute_name(): Returns the name of
- the attribute of a given event class at a given index.
+@sa bt_ctf_event_class_get_attribute_name_by_index(): Returns the name
+ of the attribute of a given event class at a given index.
*/
extern struct bt_value *
-bt_ctf_event_class_get_attribute_value(struct bt_ctf_event_class *event_class,
- int index);
+bt_ctf_event_class_get_attribute_value_by_index(
+ struct bt_ctf_event_class *event_class, uint64_t index);
/**
@brief Returns the value of the attribute named \p name of the CTF IR
@prenotnull{event_class}
@postrefcountsame{event_class}
*/
-extern int64_t bt_ctf_event_class_get_field_count(
+extern int64_t bt_ctf_event_class_get_payload_type_field_count(
struct bt_ctf_event_class *event_class);
/**
@prenotnull{event_class}
@pre \p index is lesser than the number of fields contained in the
payload field type of \p event_class (see
- bt_ctf_event_class_get_field_count()).
+ bt_ctf_event_class_get_payload_type_field_count()).
@postrefcountsame{event_class}
@post <strong>On success, if \p field_type is not \c NULL</strong>, the
reference count of \p *field_type is incremented.
*/
-extern int bt_ctf_event_class_get_field(struct bt_ctf_event_class *event_class,
+extern int bt_ctf_event_class_get_payload_type_field_by_index(
+ struct bt_ctf_event_class *event_class,
const char **field_name, struct bt_ctf_field_type **field_type,
- int index);
+ uint64_t index);
/**
@brief Returns the type of the field named \p name in the payload
@postrefcountsame{event_class}
@postsuccessrefcountretinc
*/
-extern struct bt_ctf_field_type *bt_ctf_event_class_get_field_by_name(
+extern struct bt_ctf_field_type *
+bt_ctf_event_class_get_payload_type_field_type_by_name(
struct bt_ctf_event_class *event_class, const char *name);
+/* Pre-2.0 CTF writer compatibility */
+#define bt_ctf_event_class_get_field_by_name bt_ctf_event_class_get_payload_type_field_type_by_name
+
/**
@brief Adds a field named \p name with the type \p field_type to the
payload field type of the CTF IR event class \p event_class.
On success, the four fields of the created event object are not set. You
can set them with bt_ctf_event_set_header(),
bt_ctf_event_set_stream_event_context(),
-bt_ctf_event_set_event_context(), and bt_ctf_event_set_payload_field().
+bt_ctf_event_set_event_context(), and bt_ctf_event_set_event_payload().
This function tries to resolve the needed
\link ctfirfieldtypes CTF IR field type\endlink of the dynamic field
@postrefcountsame{event}
@postsuccessrefcountretinc
-@sa bt_ctf_event_set_payload_field(): Sets the payload field of a given
+@sa bt_ctf_event_set_event_payload(): Sets the payload field of a given
event.
*/
-extern struct bt_ctf_field *bt_ctf_event_get_payload_field(
+extern struct bt_ctf_field *bt_ctf_event_get_event_payload(
struct bt_ctf_event *event);
/**
@sa bt_ctf_event_get_payload(): Returns the payload field of a given event.
*/
-extern int bt_ctf_event_set_payload_field(struct bt_ctf_event *event,
+extern int bt_ctf_event_set_event_payload(struct bt_ctf_event *event,
struct bt_ctf_field *payload);
/** @cond DOCUMENT */
* Note: Will return an error if the payload's type is not a structure.
*/
extern struct bt_ctf_field *bt_ctf_event_get_payload_by_index(
- struct bt_ctf_event *event, int index);
+ struct bt_ctf_event *event, uint64_t index);
/*
* TODO: Doxygenize.
@sa bt_ctf_event_set_clock_value(): Sets the clock value of a given event.
*/
extern struct bt_ctf_clock_value *bt_ctf_event_get_clock_value(
- struct bt_ctf_event *event, struct bt_ctf_clock_class *clock_class);
+ struct bt_ctf_event *event,
+ struct bt_ctf_clock_class *clock_class);
/**
@brief Sets the value, as of the CTF IR event \p event, of the
@postrefcountsame{field_path}
*/
extern int bt_ctf_field_path_get_index(
- const struct bt_ctf_field_path *field_path,
- int index);
+ const struct bt_ctf_field_path *field_path, uint64_t index);
/** @} */
at a given index.
*/
extern int bt_ctf_field_type_enumeration_get_mapping_signed(
- struct bt_ctf_field_type *enum_field_type, int index,
+ struct bt_ctf_field_type *enum_field_type, uint64_t index,
const char **name, int64_t *range_begin, int64_t *range_end);
/**
at a given index.
*/
extern int bt_ctf_field_type_enumeration_get_mapping_unsigned(
- struct bt_ctf_field_type *enum_field_type, int index,
+ struct bt_ctf_field_type *enum_field_type, uint64_t index,
const char **name, uint64_t *range_begin,
uint64_t *range_end);
@sa bt_ctf_field_type_structure_get_field_type_by_name(): Finds a
structure field type's field by name.
*/
-extern int bt_ctf_field_type_structure_get_field(
+extern int bt_ctf_field_type_structure_get_field_by_index(
struct bt_ctf_field_type *struct_field_type,
const char **field_name, struct bt_ctf_field_type **field_type,
- int index);
+ uint64_t index);
+
+/* Pre-2.0 CTF writer compatibility */
+#define bt_ctf_field_type_structure_get_field bt_ctf_field_type_structure_get_field_by_index
/**
@brief Returns the type of the field named \p field_name found in
@postrefcountsame{struct_field_type}
@postsuccessrefcountretinc
-@sa bt_ctf_field_type_structure_get_field(): Finds a
+@sa bt_ctf_field_type_structure_get_field_by_index(): Finds a
structure field type's field by index.
*/
extern
@sa bt_ctf_field_type_variant_get_field_type_from_tag(): Finds a variant
field type's field by current tag value.
*/
-extern int bt_ctf_field_type_variant_get_field(
+extern int bt_ctf_field_type_variant_get_field_by_index(
struct bt_ctf_field_type *variant_field_type,
const char **field_name,
- struct bt_ctf_field_type **field_type, int index);
+ struct bt_ctf_field_type **field_type, uint64_t index);
+
+/* Pre-2.0 CTF writer compatibility */
+#define bt_ctf_field_type_variant_get_field bt_ctf_field_type_variant_get_field_by_index
/**
@brief Returns the type of the field (choice) named \p field_name
@postrefcountsame{variant_field_type}
@postsuccessrefcountretinc
-@sa bt_ctf_field_type_variant_get_field(): Finds a variant field type's
+@sa bt_ctf_field_type_variant_get_field_by_index(): Finds a variant field type's
field by index.
@sa bt_ctf_field_type_variant_get_field_type_from_tag(): Finds a variant
field type's field by current tag value.
@postrefcountsame{tag_field}
@postsuccessrefcountretinc
-@sa bt_ctf_field_type_variant_get_field(): Finds a variant field type's
+@sa bt_ctf_field_type_variant_get_field_by_index(): Finds a variant field type's
field by index.
@sa bt_ctf_field_type_variant_get_field_type_by_name(): Finds a variant
field type's field by name.
@sa bt_ctf_field_structure_set_field(): Sets the field of a given
structure field.
*/
-extern struct bt_ctf_field *bt_ctf_field_structure_get_field(
+extern struct bt_ctf_field *bt_ctf_field_structure_get_field_by_name(
struct bt_ctf_field *struct_field, const char *name);
+/* Pre-2.0 CTF writer compatibility */
+#define bt_ctf_field_structure_get_field bt_ctf_field_structure_get_field_by_name
+
/**
@brief Returns the @field at index \p index in the @structfield
\p struct_field.
structure field.
*/
extern struct bt_ctf_field *bt_ctf_field_structure_get_field_by_index(
- struct bt_ctf_field *struct_field, int index);
+ struct bt_ctf_field *struct_field, uint64_t index);
/**
@brief Sets the field of the @structfield \p struct_field named \p name
/* event class id (int64_t) to event class */
GHashTable *event_classes_ht;
int id_set;
- uint32_t id;
- uint32_t next_event_id;
- uint32_t next_stream_id;
+ int64_t id;
+ int64_t next_event_id;
+ int64_t next_stream_id;
struct bt_ctf_field_type *packet_context_type;
struct bt_ctf_field_type *event_header_type;
struct bt_ctf_field_type *event_context_type;
/* Set stream_class id without checking if the stream class is frozen */
BT_HIDDEN
int _bt_ctf_stream_class_set_id(struct bt_ctf_stream_class *stream_class,
- uint32_t id);
+ int64_t id);
BT_HIDDEN
int bt_ctf_stream_class_set_id_no_check(
- struct bt_ctf_stream_class *stream_class, uint32_t id);
+ struct bt_ctf_stream_class *stream_class, int64_t id);
static inline
struct bt_ctf_trace *bt_ctf_stream_class_borrow_trace(
@prenotnull{stream_class}
@prehot{stream_class}
+@pre \p id is lesser than or equal to 9223372036854775807 (\c INT64_MAX).
@postrefcountsame{stream_class}
@sa bt_ctf_stream_class_get_id(): Returns the numeric ID of a given
stream class.
*/
extern int bt_ctf_stream_class_set_id(
- struct bt_ctf_stream_class *stream_class, uint32_t id);
+ struct bt_ctf_stream_class *stream_class, uint64_t id);
/** @} */
@sa bt_ctf_stream_class_get_event_class_by_name(): Finds an event class
by name.
*/
-extern struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class(
- struct bt_ctf_stream_class *stream_class, int index);
+extern struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_index(
+ struct bt_ctf_stream_class *stream_class, uint64_t index);
/**
@brief Returns the event class named \c name found in the CTF IR stream
by name.
*/
extern struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_id(
- struct bt_ctf_stream_class *stream_class, uint32_t id);
+ struct bt_ctf_stream_class *stream_class, uint64_t id);
/**
@brief Adds the CTF IR event class \p event_class to the
GPtrArray *stream_classes; /* Array of ptrs to bt_ctf_stream_class */
GPtrArray *streams; /* Array of ptrs to bt_ctf_stream */
struct bt_ctf_field_type *packet_header_type;
- uint64_t next_stream_id;
+ int64_t next_stream_id;
int is_created_by_writer;
/*
You can access the streams of a trace, that is, the streams which were
created from the trace's stream classes with bt_ctf_stream_create(),
-with bt_ctf_trace_get_stream().
+with bt_ctf_trace_get_stream_by_index().
A trace class owns the <strong>trace packet header</strong>
\link ctfirfieldtypes field type\endlink, which represents the
\p trace_class (see bt_ctf_trace_get_environment_field_count()).
@postrefcountsame{trace_class}
-@sa bt_ctf_trace_get_environment_field_value(): Finds a trace class's
+@sa bt_ctf_trace_get_environment_field_value_by_index(): Finds a trace class's
environment entry by index.
@sa bt_ctf_trace_get_environment_field_value_by_name(): Finds a trace
class's environment entry by name.
class's environment entry.
*/
extern const char *
-bt_ctf_trace_get_environment_field_name(struct bt_ctf_trace *trace_class,
- int index);
+bt_ctf_trace_get_environment_field_name_by_index(
+ struct bt_ctf_trace *trace_class, uint64_t index);
/**
@brief Returns the value of the environment entry at index
class's environment entry.
*/
extern struct bt_value *
-bt_ctf_trace_get_environment_field_value(struct bt_ctf_trace *trace_class,
- int index);
+bt_ctf_trace_get_environment_field_value_by_index(struct bt_ctf_trace *trace_class,
+ uint64_t index);
/**
@brief Returns the value of the environment entry named \p name
@postrefcountsame{trace_class}
@postsuccessrefcountretinc
-@sa bt_ctf_trace_get_environment_field_value(): Finds a trace class's
+@sa bt_ctf_trace_get_environment_field_value_by_index(): Finds a trace class's
environment entry by index.
@sa bt_ctf_trace_set_environment_field(): Sets the value of a trace
class's environment entry.
@postrefcountsame{trace_class}
@postsuccessrefcountinc{value}
-@sa bt_ctf_trace_get_environment_field_value(): Finds a trace class's
+@sa bt_ctf_trace_get_environment_field_value_by_index(): Finds a trace class's
environment entry by index.
@sa bt_ctf_trace_get_environment_field_value_by_name(): Finds a trace
class's environment entry by name.
in a given trace class.
@sa bt_ctf_trace_add_clock_class(): Adds a clock class to a trace class.
*/
-extern struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class(
- struct bt_ctf_trace *trace_class, int index);
+extern struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class_by_index(
+ struct bt_ctf_trace *trace_class, uint64_t index);
/**
@brief Returns the CTF IR clock class named \c name found in the CTF
@postrefcountsame{trace_class}
@postsuccessrefcountretinc
-@sa bt_ctf_trace_get_clock_class(): Returns the clock class contained
+@sa bt_ctf_trace_get_clock_class_by_index(): Returns the clock class contained
in a given trace class at a given index.
@sa bt_ctf_trace_add_clock_class(): Adds a clock class to a trace class.
*/
@post <strong>On success, if \p trace_class is frozen</strong>,
\p clock_class is frozen.
-@sa bt_ctf_trace_get_clock_class(): Returns the clock class contained
+@sa bt_ctf_trace_get_clock_class_by_index(): Returns the clock class contained
in a given trace class at a given index.
@sa bt_ctf_trace_get_clock_class_by_name(): Finds a clock class by name
in a given trace class.
@sa bt_ctf_trace_get_stream_class_by_id(): Finds a stream class by ID.
@sa bt_ctf_trace_add_stream_class(): Adds a stream class to a trace class.
*/
-extern struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class(
- struct bt_ctf_trace *trace_class, int index);
+extern struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_index(
+ struct bt_ctf_trace *trace_class, uint64_t index);
/**
@brief Returns the stream class with ID \c id found in the CTF IR
@postrefcountsame{trace_class}
@postsuccessrefcountretinc
-@sa bt_ctf_trace_get_stream_class(): Returns the stream class contained
+@sa bt_ctf_trace_get_stream_class_by_index(): Returns the stream class contained
in a given trace class at a given index.
@sa bt_ctf_trace_add_stream_class(): Adds a stream class to a trace class.
*/
extern struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_id(
- struct bt_ctf_trace *trace_class, uint32_t id);
+ struct bt_ctf_trace *trace_class, uint64_t id);
/**
@brief Adds the CTF IR stream class \p stream_class to the
@postsuccessrefcountinc{stream_class}
@postsuccessfrozen{stream_class}
-@sa bt_ctf_trace_get_stream_class(): Returns the stream class contained
+@sa bt_ctf_trace_get_stream_class_by_index(): Returns the stream class contained
in a given trace class at a given index.
@sa bt_ctf_trace_get_stream_class_by_id(): Finds a stream class by ID.
*/
bt_ctf_trace_get_stream_count()).
@postrefcountsame{trace_class}
*/
-extern struct bt_ctf_stream *bt_ctf_trace_get_stream(
- struct bt_ctf_trace *trace_class, int index);
+extern struct bt_ctf_stream *bt_ctf_trace_get_stream_by_index(
+ struct bt_ctf_trace *trace_class, uint64_t index);
/** @} */
@sa bt_clock_class_priority_map_add_clock_class(): Adds a clock class
to a clock class priority map.
*/
-extern struct bt_ctf_clock_class *bt_clock_class_priority_map_get_clock_class(
+extern struct bt_ctf_clock_class *
+bt_clock_class_priority_map_get_clock_class_by_index(
struct bt_clock_class_priority_map *clock_class_priority_map,
- unsigned int index);
+ uint64_t index);
/**
@brief Returns the CTF IR clock class named \c name found in the clock
@postrefcountsame{clock_class_priority_map}
@postsuccessrefcountretinc
-@sa bt_clock_class_priority_map_get_clock_class(): Returns the clock
+@sa bt_clock_class_priority_map_get_clock_class_by_index(): Returns the clock
class contained in a given clock class priority map at
a given index.
@sa bt_clock_class_priority_map_get_highest_priority_clock_class():
@postrefcountsame{clock_class_priority_map}
@postsuccessrefcountretinc
-@sa bt_clock_class_priority_map_get_clock_class(): Returns the clock
+@sa bt_clock_class_priority_map_get_clock_class_by_index(): Returns the clock
class contained in a given clock class priority map at
a given index.
@sa bt_clock_class_priority_map_get_clock_class_by_name(): Finds a
@postrefcountsame{clock_class_priority_map}
@postsuccessrefcountinc{clock_class}
-@sa bt_clock_class_priority_map_get_clock_class(): Returns the clock
+@sa bt_clock_class_priority_map_get_clock_class_by_index(): Returns the clock
class contained in a given clock class priority map
at a given index.
@sa bt_clock_class_priority_map_get_clock_class_by_name(): Finds a
extern int64_t bt_component_filter_get_input_port_count(
struct bt_component *component);
-extern struct bt_port *bt_component_filter_get_input_port(
+extern struct bt_port *bt_component_filter_get_input_port_by_name(
struct bt_component *component, const char *name);
-extern struct bt_port *bt_component_filter_get_input_port_at_index(
- struct bt_component *component, int index);
+extern struct bt_port *bt_component_filter_get_input_port_by_index(
+ struct bt_component *component, uint64_t index);
extern struct bt_port *bt_component_filter_get_default_input_port(
struct bt_component *component);
extern int64_t bt_component_filter_get_output_port_count(
struct bt_component *component);
-extern struct bt_port *bt_component_filter_get_output_port(
+extern struct bt_port *bt_component_filter_get_output_port_by_name(
struct bt_component *component, const char *name);
-extern struct bt_port *bt_component_filter_get_output_port_at_index(
- struct bt_component *component, int index);
+extern struct bt_port *bt_component_filter_get_output_port_by_index(
+ struct bt_component *component, uint64_t index);
extern struct bt_port *bt_component_filter_get_default_output_port(
struct bt_component *component);
int64_t bt_component_get_output_port_count(struct bt_component *comp);
BT_HIDDEN
-struct bt_port *bt_component_get_input_port_at_index(struct bt_component *comp,
- int index);
+struct bt_port *bt_component_get_input_port_by_index(struct bt_component *comp,
+ uint64_t index);
BT_HIDDEN
-struct bt_port *bt_component_get_output_port_at_index(struct bt_component *comp,
- int index);
+struct bt_port *bt_component_get_output_port_by_index(struct bt_component *comp,
+ uint64_t index);
BT_HIDDEN
-struct bt_port *bt_component_get_input_port(struct bt_component *comp,
+struct bt_port *bt_component_get_input_port_by_name(struct bt_component *comp,
const char *name);
BT_HIDDEN
-struct bt_port *bt_component_get_output_port(struct bt_component *comp,
+struct bt_port *bt_component_get_output_port_by_name(struct bt_component *comp,
const char *name);
BT_HIDDEN
* SOFTWARE.
*/
+#include <stdint.h>
#include <babeltrace/graph/component.h>
#ifdef __cplusplus
extern int64_t bt_component_sink_get_input_port_count(
struct bt_component *component);
-extern struct bt_port *bt_component_sink_get_input_port(
+extern struct bt_port *bt_component_sink_get_input_port_by_name(
struct bt_component *component, const char *name);
-extern struct bt_port *bt_component_sink_get_input_port_at_index(
- struct bt_component *component, int index);
+extern struct bt_port *bt_component_sink_get_input_port_by_index(
+ struct bt_component *component, uint64_t index);
extern struct bt_port *bt_component_sink_get_default_input_port(
struct bt_component *component);
extern int64_t bt_component_source_get_output_port_count(
struct bt_component *component);
-extern struct bt_port *bt_component_source_get_output_port(
+extern struct bt_port *bt_component_source_get_output_port_by_name(
struct bt_component *component, const char *name);
-extern struct bt_port *bt_component_source_get_output_port_at_index(
- struct bt_component *component, int index);
+extern struct bt_port *bt_component_source_get_output_port_by_index(
+ struct bt_component *component, uint64_t index);
extern struct bt_port *bt_component_source_get_default_output_port(
struct bt_component *component);
* SOFTWARE.
*/
+#include <stdint.h>
#include <babeltrace/graph/component.h>
#ifdef __cplusplus
struct bt_private_port;
extern struct bt_private_port *
-bt_private_component_filter_get_output_private_port(
+bt_private_component_filter_get_output_private_port_by_name(
struct bt_private_component *private_component,
const char *name);
extern struct bt_private_port *
-bt_private_component_filter_get_output_private_port_at_index(
- struct bt_private_component *private_component, int index);
+bt_private_component_filter_get_output_private_port_by_index(
+ struct bt_private_component *private_component, uint64_t index);
extern struct bt_private_port *
bt_private_component_filter_get_default_output_private_port(
const char *name);
extern struct bt_private_port *
-bt_private_component_filter_get_input_private_port(
+bt_private_component_filter_get_input_private_port_by_name(
struct bt_private_component *private_component,
const char *name);
extern struct bt_private_port *
-bt_private_component_filter_get_input_private_port_at_index(
- struct bt_private_component *private_component, int index);
+bt_private_component_filter_get_input_private_port_by_index(
+ struct bt_private_component *private_component, uint64_t index);
extern struct bt_private_port *
bt_private_component_filter_get_default_input_private_port(
* SOFTWARE.
*/
+#include <stdint.h>
#include <babeltrace/graph/component.h>
#ifdef __cplusplus
struct bt_private_port;
extern struct bt_private_port *
-bt_private_component_sink_get_input_private_port(
+bt_private_component_sink_get_input_private_port_by_name(
struct bt_private_component *private_component,
const char *name);
extern struct bt_private_port *
-bt_private_component_sink_get_input_private_port_at_index(
- struct bt_private_component *private_component, int index);
+bt_private_component_sink_get_input_private_port_by_index(
+ struct bt_private_component *private_component, uint64_t index);
extern struct bt_private_port *
bt_private_component_sink_get_default_input_private_port(
* SOFTWARE.
*/
+#include <stdint.h>
#include <babeltrace/graph/component.h>
#ifdef __cplusplus
struct bt_private_port;
extern struct bt_private_port *
-bt_private_component_source_get_output_private_port(
+bt_private_component_source_get_output_private_port_by_name(
struct bt_private_component *private_component,
const char *name);
extern struct bt_private_port *
-bt_private_component_source_get_output_private_port_at_index(
- struct bt_private_component *private_component, int index);
+bt_private_component_source_get_output_private_port_by_index(
+ struct bt_private_component *private_component,
+ uint64_t index);
extern struct bt_private_port *
bt_private_component_source_get_default_output_private_port(
extern int64_t bt_plugin_get_component_class_count(struct bt_plugin *plugin);
-extern struct bt_component_class *bt_plugin_get_component_class(
- struct bt_plugin *plugin, size_t index);
+extern struct bt_component_class *bt_plugin_get_component_class_by_index(
+ struct bt_plugin *plugin, uint64_t index);
extern
struct bt_component_class *bt_plugin_get_component_class_by_name_and_type(
extern
struct bt_plugin *bt_plugin_set_get_plugin(struct bt_plugin_set *plugin_set,
- unsigned int index);
+ uint64_t index);
#ifdef __cplusplus
}
{
int ret = 0;
- if (!clock_class || clock_class->frozen) {
+ if (!clock_class || clock_class->frozen || freq == -1ULL) {
ret = -1;
goto end;
}
{
int ret = 0;
- if (!clock_class || clock_class->frozen) {
+ if (!clock_class || clock_class->frozen || precision == -1ULL) {
ret = -1;
goto end;
}
}
/* Initialize nanosecond timestamp to clock's offset in seconds. */
- ns = value->clock_class->offset_s * 1000000000;
+ ns = value->clock_class->offset_s * (int64_t) 1000000000;
/* Add offset in cycles, converted to nanoseconds. */
ns += ns_from_value(value->clock_class->frequency,
int64_t ret = 0;
if (!event_class) {
- ret = -1;
+ ret = (int64_t) -1;
goto end;
}
if (event_class->id >= 0) {
- ret = event_class->id;
+ ret = (int64_t) event_class->id;
goto end;
}
}
if (bt_value_integer_get(obj, &ret)) {
- ret = -1;
+ ret = (int64_t) -1;
}
if (ret < 0) {
/* means ID is not set */
- ret = -1;
+ ret = (int64_t) -1;
goto end;
}
}
int bt_ctf_event_class_set_id(struct bt_ctf_event_class *event_class,
- uint32_t id)
+ uint64_t id_param)
{
int ret = 0;
struct bt_value *obj = NULL;
struct bt_ctf_stream_class *stream_class = NULL;
+ int64_t id = (int64_t) id_param;
-
- if (!event_class) {
+ if (!event_class || id < 0) {
ret = -1;
goto end;
}
int64_t bt_ctf_event_class_get_attribute_count(
struct bt_ctf_event_class *event_class)
{
- int64_t ret = 0;
+ int64_t ret;
if (!event_class) {
- ret = -1;
+ ret = (int64_t) -1;
goto end;
}
}
const char *
-bt_ctf_event_class_get_attribute_name(
- struct bt_ctf_event_class *event_class, int index)
+bt_ctf_event_class_get_attribute_name_by_index(
+ struct bt_ctf_event_class *event_class, uint64_t index)
{
const char *ret;
}
struct bt_value *
-bt_ctf_event_class_get_attribute_value(struct bt_ctf_event_class *event_class,
- int index)
+bt_ctf_event_class_get_attribute_value_by_index(
+ struct bt_ctf_event_class *event_class, uint64_t index)
{
struct bt_value *ret;
return ret;
}
-int64_t bt_ctf_event_class_get_field_count(
+int64_t bt_ctf_event_class_get_payload_type_field_count(
struct bt_ctf_event_class *event_class)
{
int64_t ret;
if (!event_class) {
- ret = -1;
+ ret = (int64_t) -1;
goto end;
}
if (bt_ctf_field_type_get_type_id(event_class->fields) !=
BT_CTF_FIELD_TYPE_ID_STRUCT) {
- ret = -1;
+ ret = (int64_t) -1;
goto end;
}
return ret;
}
-int bt_ctf_event_class_get_field(struct bt_ctf_event_class *event_class,
+int bt_ctf_event_class_get_payload_type_field_by_index(
+ struct bt_ctf_event_class *event_class,
const char **field_name, struct bt_ctf_field_type **field_type,
- int index)
+ uint64_t index)
{
int ret;
- if (!event_class || index < 0) {
+ if (!event_class) {
ret = -1;
goto end;
}
return ret;
}
-struct bt_ctf_field_type *bt_ctf_event_class_get_field_by_name(
+struct bt_ctf_field_type *
+bt_ctf_event_class_get_payload_type_field_type_by_name(
struct bt_ctf_event_class *event_class, const char *name)
{
GQuark name_quark;
BT_HIDDEN
int bt_ctf_event_class_set_stream_id(struct bt_ctf_event_class *event_class,
- uint32_t stream_id)
+ uint64_t stream_id_param)
{
int ret = 0;
- struct bt_value *obj;
+ struct bt_value *obj = NULL;
+ int64_t stream_id = (int64_t) stream_id_param;
+
+ assert(event_class);
+
+ if (stream_id < 0) {
+ ret = -1;
+ goto end;
+ }
obj = bt_value_integer_create_init(stream_id);
for (i = 0; i < count; ++i) {
const char *attr_name = NULL;
- attr_name = bt_ctf_event_class_get_attribute_name(
+ attr_name = bt_ctf_event_class_get_attribute_name_by_index(
event_class, i);
- attr_value = bt_ctf_event_class_get_attribute_value(
+ attr_value = bt_ctf_event_class_get_attribute_value_by_index(
event_class, i);
if (!attr_name || !attr_value) {
return ret;
}
-struct bt_ctf_field *bt_ctf_event_get_payload_field(struct bt_ctf_event *event)
+struct bt_ctf_field *bt_ctf_event_get_event_payload(struct bt_ctf_event *event)
{
struct bt_ctf_field *payload = NULL;
return payload;
}
-int bt_ctf_event_set_payload_field(struct bt_ctf_event *event,
+int bt_ctf_event_set_event_payload(struct bt_ctf_event *event,
struct bt_ctf_field *payload)
{
int ret = 0;
}
struct bt_ctf_field *bt_ctf_event_get_payload_by_index(
- struct bt_ctf_event *event, int index)
+ struct bt_ctf_event *event, uint64_t index)
{
struct bt_ctf_field *field = NULL;
- if (!event || index < 0) {
+ if (!event) {
goto end;
}
int64_t bt_ctf_field_path_get_index_count(
const struct bt_ctf_field_path *field_path)
{
- int64_t ret = -1;
-
- if (!field_path) {
- goto end;
- }
-
- ret = field_path->indexes->len;
-
-end:
- return ret;
+ return field_path ? (int64_t) field_path->indexes->len : (int64_t) -1;
}
int bt_ctf_field_path_get_index(const struct bt_ctf_field_path *field_path,
- int index)
+ uint64_t index)
{
int ret = INT_MIN;
- if (!field_path || index < 0) {
+ if (!field_path) {
goto end;
}
}
for (i = 0; i < field_count; ++i) {
- ret = bt_ctf_field_type_structure_get_field(type,
+ ret = bt_ctf_field_type_structure_get_field_by_index(type,
NULL, &child_type, i);
if (ret) {
goto end;
}
for (i = 0; i < field_count; ++i) {
- ret = bt_ctf_field_type_variant_get_field(type,
+ ret = bt_ctf_field_type_variant_get_field_by_index(type,
NULL, &child_type, i);
if (ret) {
goto end;
int bt_ctf_field_type_enumeration_get_mapping_signed(
struct bt_ctf_field_type *enum_field_type,
- int index,
- const char **mapping_name, int64_t *range_begin,
+ uint64_t index, const char **mapping_name, int64_t *range_begin,
int64_t *range_end)
{
int ret = 0;
struct enumeration_mapping *mapping;
- if (!enum_field_type || index < 0) {
+ if (!enum_field_type) {
ret = -1;
goto end;
}
int bt_ctf_field_type_enumeration_get_mapping_unsigned(
struct bt_ctf_field_type *enum_field_type,
- int index,
+ uint64_t index,
const char **mapping_name, uint64_t *range_begin,
uint64_t *range_end)
{
int ret = 0;
struct enumeration_mapping *mapping;
- if (!enum_field_type || index < 0) {
+ if (!enum_field_type) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_enumeration *enumeration;
if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_ENUM)) {
- ret = -1;
+ ret = (int64_t) -1;
goto end;
}
struct bt_ctf_field_type_structure *structure;
if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_STRUCT)) {
- ret = -1;
+ ret = (int64_t) -1;
goto end;
}
return ret;
}
-int bt_ctf_field_type_structure_get_field(struct bt_ctf_field_type *type,
+int bt_ctf_field_type_structure_get_field_by_index(
+ struct bt_ctf_field_type *type,
const char **field_name, struct bt_ctf_field_type **field_type,
- int index)
+ uint64_t index)
{
struct bt_ctf_field_type_structure *structure;
struct structure_field *field;
int ret = 0;
- if (!type || index < 0 ||
- (type->id != BT_CTF_FIELD_TYPE_ID_STRUCT)) {
+ if (!type || type->id != BT_CTF_FIELD_TYPE_ID_STRUCT) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_variant *variant;
if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_VARIANT)) {
- ret = -1;
+ ret = (int64_t) -1;
goto end;
}
}
-int bt_ctf_field_type_variant_get_field(struct bt_ctf_field_type *type,
+int bt_ctf_field_type_variant_get_field_by_index(struct bt_ctf_field_type *type,
const char **field_name, struct bt_ctf_field_type **field_type,
- int index)
+ uint64_t index)
{
struct bt_ctf_field_type_variant *variant;
struct structure_field *field;
int ret = 0;
- if (!type || index < 0 ||
- (type->id != BT_CTF_FIELD_TYPE_ID_VARIANT)) {
+ if (!type || type->id != BT_CTF_FIELD_TYPE_ID_VARIANT) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_array *array;
if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_ARRAY)) {
- ret = -1;
+ ret = (int64_t) -1;
goto end;
}
struct bt_ctf_field_type *field;
int field_alignment;
- ret = bt_ctf_field_type_structure_get_field(type, NULL,
- &field, i);
+ ret = bt_ctf_field_type_structure_get_field_by_index(
+ type, NULL, &field, i);
if (ret) {
goto end;
}
switch (type_id) {
case CTF_TYPE_STRUCT:
- bt_ctf_field_type_structure_get_field(field_type, NULL, &field,
- index);
+ bt_ctf_field_type_structure_get_field_by_index(field_type,
+ NULL, &field, index);
break;
case CTF_TYPE_VARIANT:
{
- int ret = bt_ctf_field_type_variant_get_field(field_type, NULL,
- &field, index);
+ int ret = bt_ctf_field_type_variant_get_field_by_index(
+ field_type, NULL, &field, index);
if (ret) {
field = NULL;
goto end;
return ret;
}
-struct bt_ctf_field *bt_ctf_field_structure_get_field(
+struct bt_ctf_field *bt_ctf_field_structure_get_field_by_name(
struct bt_ctf_field *field, const char *name)
{
struct bt_ctf_field *new_field = NULL;
}
struct bt_ctf_field *bt_ctf_field_structure_get_field_by_index(
- struct bt_ctf_field *field, int index)
+ struct bt_ctf_field *field, uint64_t index)
{
int ret;
const char *field_name;
}
sequence = container_of(field, struct bt_ctf_field_sequence, parent);
- if (!sequence->elements || sequence->elements->len <= index) {
+ if (!sequence->elements || index >= sequence->elements->len) {
goto end;
}
int64_t ret;
if (!stream_class || !stream_class->id_set) {
- ret = -1;
+ ret = (int64_t) -1;
goto end;
}
- ret = (int64_t) stream_class->id;
+ ret = stream_class->id;
end:
return ret;
}
BT_HIDDEN
int _bt_ctf_stream_class_set_id(
- struct bt_ctf_stream_class *stream_class, uint32_t id)
+ struct bt_ctf_stream_class *stream_class, int64_t id)
{
stream_class->id = id;
stream_class->id_set = 1;
return 0;
}
-struct event_class_set_stream_id_data {
- uint32_t stream_id;
+struct event_class_set_stream_class_id_data {
+ int64_t stream_class_id;
int ret;
};
static
void event_class_set_stream_id(gpointer event_class, gpointer data)
{
- struct event_class_set_stream_id_data *typed_data = data;
+ struct event_class_set_stream_class_id_data *typed_data = data;
typed_data->ret |= bt_ctf_event_class_set_stream_id(event_class,
- typed_data->stream_id);
+ typed_data->stream_class_id);
}
BT_HIDDEN
int bt_ctf_stream_class_set_id_no_check(
- struct bt_ctf_stream_class *stream_class, uint32_t id)
+ struct bt_ctf_stream_class *stream_class, int64_t id)
{
int ret = 0;
- struct event_class_set_stream_id_data data =
- { .stream_id = id, .ret = 0 };
+ struct event_class_set_stream_class_id_data data =
+ { .stream_class_id = id, .ret = 0 };
/*
* Make sure all event classes have their "stream_id" attribute
}
int bt_ctf_stream_class_set_id(struct bt_ctf_stream_class *stream_class,
- uint32_t id)
+ uint64_t id_param)
{
int ret = 0;
+ int64_t id = (int64_t) id_param;
- if (!stream_class || stream_class->frozen) {
+ if (!stream_class || stream_class->frozen || id < 0) {
ret = -1;
goto end;
}
int64_t ret;
if (!stream_class) {
- ret = -1;
+ ret = (int64_t) -1;
goto end;
}
- ret = (int) stream_class->event_classes->len;
+ ret = (int64_t) stream_class->event_classes->len;
end:
return ret;
}
-struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class(
- struct bt_ctf_stream_class *stream_class, int index)
+struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_index(
+ struct bt_ctf_stream_class *stream_class, uint64_t index)
{
struct bt_ctf_event_class *event_class = NULL;
- if (!stream_class || index < 0 ||
- index >= stream_class->event_classes->len) {
+ if (!stream_class || index >= stream_class->event_classes->len) {
goto end;
}
}
struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_id(
- struct bt_ctf_stream_class *stream_class, uint32_t id)
+ struct bt_ctf_stream_class *stream_class, uint64_t id)
{
- int64_t id_key = id;
+ int64_t id_key = (int64_t) id;
struct bt_ctf_event_class *event_class = NULL;
- if (!stream_class) {
+ if (!stream_class || id_key < 0) {
goto end;
}
static
void *get_event_class(void *element, int i)
{
- return bt_ctf_stream_class_get_event_class(
+ return bt_ctf_stream_class_get_event_class_by_index(
(struct bt_ctf_stream_class *) element, i);
}
int bt_ctf_stream_class_serialize(struct bt_ctf_stream_class *stream_class,
struct metadata_context *context)
{
- int64_t ret = 0;
+ int ret = 0;
size_t i;
g_string_assign(context->field_name, "");
}
g_string_append_printf(context->string,
- "stream {\n\tid = %" PRIu32 ";\n\tevent.header := ",
+ "stream {\n\tid = %" PRId64 ";\n\tevent.header := ",
stream_class->id);
ret = bt_ctf_field_type_serialize(stream_class->event_header_type,
context);
uuid_element, (int64_t) trace->uuid[i]);
} else {
ret = bt_ctf_field_unsigned_integer_set_value(
- uuid_element,
- (uint64_t) trace->uuid[i]);
+ uuid_element, (uint64_t) trace->uuid[i]);
}
bt_put(uuid_element);
if (ret) {
}
new_count = previous_count + event_count;
+ assert(new_count >= previous_count);
if (field_signed) {
ret = bt_ctf_field_signed_integer_set_value(
events_discarded_field, (int64_t) new_count);
int64_t ret = 0;
if (!trace) {
- ret = -1;
+ ret = (int64_t) -1;
goto end;
}
}
const char *
-bt_ctf_trace_get_environment_field_name(struct bt_ctf_trace *trace,
- int index)
+bt_ctf_trace_get_environment_field_name_by_index(struct bt_ctf_trace *trace,
+ uint64_t index)
{
const char *ret = NULL;
return ret;
}
-struct bt_value *bt_ctf_trace_get_environment_field_value(
- struct bt_ctf_trace *trace, int index)
+struct bt_value *bt_ctf_trace_get_environment_field_value_by_index(
+ struct bt_ctf_trace *trace, uint64_t index)
{
struct bt_value *ret = NULL;
int64_t bt_ctf_trace_get_clock_class_count(struct bt_ctf_trace *trace)
{
- int64_t ret = -1;
+ int64_t ret = (int64_t) -1;
if (!trace) {
goto end;
return ret;
}
-struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class(
- struct bt_ctf_trace *trace, int index)
+struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class_by_index(
+ struct bt_ctf_trace *trace, uint64_t index)
{
struct bt_ctf_clock_class *clock_class = NULL;
- if (!trace || index < 0 || index >= trace->clocks->len) {
+ if (!trace || index >= trace->clocks->len) {
goto end;
}
/* Validate each event class individually */
for (i = 0; i < event_class_count; i++) {
struct bt_ctf_event_class *event_class =
- bt_ctf_stream_class_get_event_class(stream_class, i);
+ bt_ctf_stream_class_get_event_class_by_index(
+ stream_class, i);
struct bt_ctf_field_type *event_context_type = NULL;
struct bt_ctf_field_type *event_payload_type = NULL;
stream_id = bt_ctf_stream_class_get_id(stream_class);
if (stream_id < 0) {
stream_id = trace->next_stream_id++;
+ if (stream_id < 0) {
+ ret = -1;
+ goto end;
+ }
/* Try to assign a new stream id */
for (i = 0; i < trace->stream_classes->len; i++) {
for (i = 0; i < event_class_count; i++) {
struct bt_ctf_event_class *event_class =
- bt_ctf_stream_class_get_event_class(stream_class, i);
+ bt_ctf_stream_class_get_event_class_by_index(
+ stream_class, i);
bt_ctf_validation_replace_types(NULL, NULL, event_class,
&ec_validation_outputs[i], ec_validation_flags);
int64_t ret;
if (!trace) {
- ret = -1;
+ ret = (int64_t) -1;
goto end;
}
- ret = trace->streams->len;
+ ret = (int64_t) trace->streams->len;
end:
return ret;
}
-struct bt_ctf_stream *bt_ctf_trace_get_stream(struct bt_ctf_trace *trace,
- int index)
+struct bt_ctf_stream *bt_ctf_trace_get_stream_by_index(
+ struct bt_ctf_trace *trace,
+ uint64_t index)
{
struct bt_ctf_stream *stream = NULL;
int64_t ret;
if (!trace) {
- ret = -1;
+ ret = (int64_t) -1;
goto end;
}
- ret = trace->stream_classes->len;
+ ret = (int64_t) trace->stream_classes->len;
end:
return ret;
}
-struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class(
- struct bt_ctf_trace *trace, int index)
+struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_index(
+ struct bt_ctf_trace *trace, uint64_t index)
{
struct bt_ctf_stream_class *stream_class = NULL;
- if (!trace || index < 0 || index >= trace->stream_classes->len) {
+ if (!trace || index >= trace->stream_classes->len) {
goto end;
}
}
struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_id(
- struct bt_ctf_trace *trace, uint32_t id)
+ struct bt_ctf_trace *trace, uint64_t id_param)
{
int i;
struct bt_ctf_stream_class *stream_class = NULL;
+ int64_t id = (int64_t) id_param;
- if (!trace) {
+ if (!trace || id < 0) {
goto end;
}
static
void *get_stream_class(void *element, int i)
{
- return bt_ctf_trace_get_stream_class(
+ return bt_ctf_trace_get_stream_class_by_index(
(struct bt_ctf_trace *) element, i);
}
for (i = 0; i < stream_class_count; i++) {
struct bt_ctf_stream_class *existing_stream_class =
- bt_ctf_trace_get_stream_class(writer->trace, i);
+ bt_ctf_trace_get_stream_class_by_index(
+ writer->trace, i);
if (existing_stream_class == stream_class) {
stream_class_found = true;
}
int bt_ctf_writer_add_environment_field_int64(struct bt_ctf_writer *writer,
- const char *name,
- int64_t value)
+ const char *name, int64_t value)
{
int ret = -1;
#include <babeltrace/babeltrace-internal.h>
#include <babeltrace/compiler-internal.h>
#include <babeltrace/ref.h>
+#include <stdint.h>
#include <glib.h>
static
int64_t bt_clock_class_priority_map_get_clock_class_count(
struct bt_clock_class_priority_map *cc_prio_map)
{
- int64_t ret = -1;
+ int64_t ret = (int64_t) -1;
if (!cc_prio_map) {
goto end;
return ret;
}
-struct bt_ctf_clock_class *bt_clock_class_priority_map_get_clock_class(
+struct bt_ctf_clock_class *bt_clock_class_priority_map_get_clock_class_by_index(
struct bt_clock_class_priority_map *cc_prio_map,
- unsigned int index)
+ uint64_t index)
{
struct bt_ctf_clock_class *clock_class = NULL;
#include <babeltrace/babeltrace-internal.h>
#include <babeltrace/compiler-internal.h>
#include <babeltrace/ref.h>
+#include <stdint.h>
static
struct bt_component * (* const component_create_funcs[])(
int64_t bt_component_get_input_port_count(struct bt_component *comp)
{
assert(comp);
- return comp->input_ports->len;
+ return (int64_t) comp->input_ports->len;
}
BT_HIDDEN
int64_t bt_component_get_output_port_count(struct bt_component *comp)
{
assert(comp);
- return comp->output_ports->len;
+ return (int64_t) comp->output_ports->len;
}
struct bt_component *bt_component_create_with_init_method_data(
}
static
-struct bt_port *bt_component_get_port(GPtrArray *ports, const char *name)
+struct bt_port *bt_component_get_port_by_name(GPtrArray *ports,
+ const char *name)
{
size_t i;
struct bt_port *ret_port = NULL;
}
BT_HIDDEN
-struct bt_port *bt_component_get_input_port(struct bt_component *comp,
+struct bt_port *bt_component_get_input_port_by_name(struct bt_component *comp,
const char *name)
{
assert(comp);
- return bt_component_get_port(comp->input_ports, name);
+ return bt_component_get_port_by_name(comp->input_ports, name);
}
BT_HIDDEN
-struct bt_port *bt_component_get_output_port(struct bt_component *comp,
+struct bt_port *bt_component_get_output_port_by_name(struct bt_component *comp,
const char *name)
{
assert(comp);
- return bt_component_get_port(comp->output_ports, name);
+ return bt_component_get_port_by_name(comp->output_ports, name);
}
static
-struct bt_port *bt_component_get_port_at_index(GPtrArray *ports, int index)
+struct bt_port *bt_component_get_port_by_index(GPtrArray *ports, uint64_t index)
{
struct bt_port *port = NULL;
- if (index < 0 || index >= ports->len) {
+ if (index >= ports->len) {
goto end;
}
}
BT_HIDDEN
-struct bt_port *bt_component_get_input_port_at_index(struct bt_component *comp,
- int index)
+struct bt_port *bt_component_get_input_port_by_index(struct bt_component *comp,
+ uint64_t index)
{
assert(comp);
- return bt_component_get_port_at_index(comp->input_ports, index);
+ return bt_component_get_port_by_index(comp->input_ports, index);
}
BT_HIDDEN
-struct bt_port *bt_component_get_output_port_at_index(struct bt_component *comp,
- int index)
+struct bt_port *bt_component_get_output_port_by_index(struct bt_component *comp,
+ uint64_t index)
{
assert(comp);
- return bt_component_get_port_at_index(comp->output_ports, index);
+ return bt_component_get_port_by_index(comp->output_ports, index);
}
BT_HIDDEN
}
static
-void bt_component_remove_port_at_index(struct bt_component *component,
+void bt_component_remove_port_by_index(struct bt_component *component,
GPtrArray *ports, size_t index)
{
struct bt_port *port;
struct bt_port *cur_port = g_ptr_array_index(ports, i);
if (cur_port == port) {
- bt_component_remove_port_at_index(component,
+ bt_component_remove_port_by_index(component,
ports, i);
goto end;
}
}
int64_t bt_component_filter_get_input_port_count(
- struct bt_component *component, uint64_t *count)
+ struct bt_component *component)
{
int64_t ret;
if (!component ||
component->class->type != BT_COMPONENT_CLASS_TYPE_FILTER) {
- ret = -1;
+ ret = (int64_t) -1;
goto end;
}
- ret = bt_component_get_input_port_count(component);
+ ret = (int64_t) bt_component_get_input_port_count(component);
end:
return ret;
}
-struct bt_port *bt_component_filter_get_input_port(
+struct bt_port *bt_component_filter_get_input_port_by_name(
struct bt_component *component, const char *name)
{
struct bt_port *port = NULL;
goto end;
}
- port = bt_component_get_input_port(component, name);
+ port = bt_component_get_input_port_by_name(component, name);
end:
return port;
}
-struct bt_port *bt_component_filter_get_input_port_at_index(
- struct bt_component *component, int index)
+struct bt_port *bt_component_filter_get_input_port_by_index(
+ struct bt_component *component, uint64_t index)
{
struct bt_port *port = NULL;
goto end;
}
- port = bt_component_get_input_port_at_index(component, index);
+ port = bt_component_get_input_port_by_index(component, index);
end:
return port;
}
struct bt_port *bt_component_filter_get_default_input_port(
struct bt_component *component)
{
- return bt_component_filter_get_input_port(component,
+ return bt_component_filter_get_input_port_by_name(component,
DEFAULT_INPUT_PORT_NAME);
}
int64_t bt_component_filter_get_output_port_count(
- struct bt_component *component, uint64_t *count)
+ struct bt_component *component)
{
int64_t ret;
- if (!component || !count ||
+ if (!component ||
component->class->type != BT_COMPONENT_CLASS_TYPE_FILTER) {
- ret = -1;
+ ret = (int64_t) -1;
goto end;
}
return ret;
}
-struct bt_port *bt_component_filter_get_output_port(
+struct bt_port *bt_component_filter_get_output_port_by_name(
struct bt_component *component, const char *name)
{
struct bt_port *port = NULL;
goto end;
}
- port = bt_component_get_output_port(component, name);
+ port = bt_component_get_output_port_by_name(component, name);
end:
return port;
}
-struct bt_port *bt_component_filter_get_output_port_at_index(
- struct bt_component *component, int index)
+struct bt_port *bt_component_filter_get_output_port_by_index(
+ struct bt_component *component, uint64_t index)
{
struct bt_port *port = NULL;
goto end;
}
- port = bt_component_get_output_port_at_index(component, index);
+ port = bt_component_get_output_port_by_index(component, index);
end:
return port;
}
struct bt_port *bt_component_filter_get_default_output_port(
struct bt_component *component)
{
- return bt_component_filter_get_output_port(component,
+ return bt_component_filter_get_output_port_by_name(component,
DEFAULT_OUTPUT_PORT_NAME);
}
struct bt_private_port *
-bt_private_component_filter_get_input_private_port_at_index(
- struct bt_private_component *private_component, int index)
+bt_private_component_filter_get_input_private_port_by_index(
+ struct bt_private_component *private_component, uint64_t index)
{
return bt_private_port_from_port(
- bt_component_filter_get_input_port_at_index(
+ bt_component_filter_get_input_port_by_index(
bt_component_from_private(private_component), index));
}
}
struct bt_private_port *
-bt_private_component_filter_get_output_private_port_at_index(
- struct bt_private_component *private_component, int index)
+bt_private_component_filter_get_output_private_port_by_index(
+ struct bt_private_component *private_component, uint64_t index)
{
return bt_private_port_from_port(
- bt_component_filter_get_output_port_at_index(
+ bt_component_filter_get_output_port_by_index(
bt_component_from_private(private_component), index));
}
struct bt_port *downstream_port = NULL;
struct bt_connection *origin_connection = NULL;
struct bt_connection *new_connection = NULL;
- int port_index;
+ int64_t port_index;
if (!graph || !origin || !new_component) {
status = BT_GRAPH_STATUS_INVALID;
/* Replicate input connections. */
for (port_index = 0; port_index< origin_input_port_count; port_index++) {
- origin_port = bt_component_get_input_port_at_index(origin,
+ origin_port = bt_component_get_input_port_by_index(origin,
port_index);
if (!origin_port) {
status = BT_GRAPH_STATUS_ERROR;
goto error_disconnect;
}
- new_port = bt_component_get_input_port_at_index(new_component,
+ new_port = bt_component_get_input_port_by_index(new_component,
port_index);
if (!new_port) {
status = BT_GRAPH_STATUS_ERROR;
/* Replicate output connections. */
for (port_index = 0; port_index < origin_output_port_count; port_index++) {
- origin_port = bt_component_get_output_port_at_index(origin,
+ origin_port = bt_component_get_output_port_by_index(origin,
port_index);
if (!origin_port) {
status = BT_GRAPH_STATUS_ERROR;
goto error_disconnect;
}
- new_port = bt_component_get_output_port_at_index(new_component,
+ new_port = bt_component_get_output_port_by_index(new_component,
port_index);
if (!new_port) {
status = BT_GRAPH_STATUS_ERROR;
for (cc_prio_map_cc_i = 0; cc_prio_map_cc_i < cc_prio_map_cc_count;
cc_prio_map_cc_i++) {
struct bt_ctf_clock_class *clock_class =
- bt_clock_class_priority_map_get_clock_class(
+ bt_clock_class_priority_map_get_clock_class_by_index(
notif->cc_prio_map, cc_prio_map_cc_i);
struct bt_ctf_clock_value *clock_value;
bool found_in_trace = false;
for (trace_cc_i = 0; trace_cc_i < trace_cc_count;
trace_cc_i++) {
struct bt_ctf_clock_class *trace_clock_class =
- bt_ctf_trace_get_clock_class(trace, trace_cc_i);
+ bt_ctf_trace_get_clock_class_by_index(trace,
+ trace_cc_i);
assert(trace_clock_class);
if (!component ||
component->class->type != BT_COMPONENT_CLASS_TYPE_SINK) {
- ret = -1;
+ ret = (int64_t) -1;
goto end;
}
return ret;
}
-struct bt_port *bt_component_sink_get_input_port(
+struct bt_port *bt_component_sink_get_input_port_by_name(
struct bt_component *component, const char *name)
{
struct bt_port *port = NULL;
goto end;
}
- port = bt_component_get_input_port(component, name);
+ port = bt_component_get_input_port_by_name(component, name);
end:
return port;
}
-struct bt_port *bt_component_sink_get_input_port_at_index(
- struct bt_component *component, int index)
+struct bt_port *bt_component_sink_get_input_port_by_index(
+ struct bt_component *component, uint64_t index)
{
struct bt_port *port = NULL;
goto end;
}
- port = bt_component_get_input_port_at_index(component, index);
+ port = bt_component_get_input_port_by_index(component, index);
end:
return port;
}
struct bt_port *bt_component_sink_get_default_input_port(
struct bt_component *component)
{
- return bt_component_sink_get_input_port(component,
+ return bt_component_sink_get_input_port_by_name(component,
DEFAULT_INPUT_PORT_NAME);
}
struct bt_private_port *
-bt_private_component_sink_get_input_private_port_at_index(
- struct bt_private_component *private_component, int index)
+bt_private_component_sink_get_input_private_port_by_index(
+ struct bt_private_component *private_component, uint64_t index)
{
return bt_private_port_from_port(
- bt_component_sink_get_input_port_at_index(
+ bt_component_sink_get_input_port_by_index(
bt_component_from_private(private_component), index));
}
if (!component || !count ||
component->class->type != BT_COMPONENT_CLASS_TYPE_SOURCE) {
- ret = -1;
+ ret = (int64_t) -1;
goto end;
}
return ret;
}
-struct bt_port *bt_component_source_get_output_port(
+struct bt_port *bt_component_source_get_output_port_by_name(
struct bt_component *component, const char *name)
{
struct bt_port *port = NULL;
goto end;
}
- port = bt_component_get_output_port(component, name);
+ port = bt_component_get_output_port_by_name(component, name);
end:
return port;
}
-struct bt_port *bt_component_source_get_output_port_at_index(
- struct bt_component *component, int index)
+struct bt_port *bt_component_source_get_output_port_by_index(
+ struct bt_component *component, uint64_t index)
{
struct bt_port *port = NULL;
goto end;
}
- port = bt_component_get_output_port_at_index(component, index);
+ port = bt_component_get_output_port_by_index(component, index);
end:
return port;
}
struct bt_port *bt_component_source_get_default_output_port(
struct bt_component *component)
{
- return bt_component_source_get_output_port(component,
+ return bt_component_source_get_output_port_by_name(component,
DEFAULT_OUTPUT_PORT_NAME);
}
-struct bt_private_port *bt_private_component_source_get_output_private_port(
+struct bt_private_port *
+bt_private_component_source_get_output_private_port_by_name(
struct bt_private_component *private_component,
const char *name)
{
- return bt_private_port_from_port(bt_component_source_get_output_port(
- bt_component_from_private(private_component), name));
+ return bt_private_port_from_port(
+ bt_component_source_get_output_port_by_name(
+ bt_component_from_private(private_component), name));
}
struct bt_private_port *
-bt_private_component_source_get_output_private_port_at_index(
- struct bt_private_component *private_component, int index)
+bt_private_component_source_get_output_private_port_by_index(
+ struct bt_private_component *private_component, uint64_t index)
{
return bt_private_port_from_port(
- bt_component_source_get_output_port_at_index(
+ bt_component_source_get_output_port_by_index(
bt_component_from_private(private_component), index));
}
#include <glib.h>
#include <unistd.h>
#include <stdlib.h>
+#include <stdint.h>
#include <sys/stat.h>
#include <dirent.h>
goto end;
}
- count = plugin_set->plugins->len;
+ count = (int64_t) plugin_set->plugins->len;
end:
return count;
extern
struct bt_plugin *bt_plugin_set_get_plugin(struct bt_plugin_set *plugin_set,
- unsigned int index)
+ uint64_t index)
{
struct bt_plugin *plugin = NULL;
int64_t bt_plugin_get_component_class_count(struct bt_plugin *plugin)
{
- return plugin ? plugin->comp_classes->len : -1;
+ return plugin ? plugin->comp_classes->len : (int64_t) -1;
}
-struct bt_component_class *bt_plugin_get_component_class(
- struct bt_plugin *plugin, size_t index)
+struct bt_component_class *bt_plugin_get_component_class_by_index(
+ struct bt_plugin *plugin, uint64_t index)
{
struct bt_component_class *comp_class = NULL;
BT_VALUE_TO_ARRAY(array_obj);
if (!array_obj || !bt_value_is_array(array_obj)) {
- ret = BT_VALUE_STATUS_INVAL;
+ ret = (int64_t) BT_VALUE_STATUS_INVAL;
goto end;
}
struct bt_value_map *typed_map_obj = BT_VALUE_TO_MAP(map_obj);
if (!map_obj || !bt_value_is_map(map_obj)) {
- ret = BT_VALUE_STATUS_INVAL;
+ ret = (int64_t) BT_VALUE_STATUS_INVAL;
goto end;
}
} else {
assert(bt_ctf_trace_get_stream_class_count(
ctx->trace) == 1);
- stream_class = bt_ctf_trace_get_stream_class(
- ctx->trace, 0);
+ stream_class =
+ bt_ctf_trace_get_stream_class_by_index(
+ ctx->trace, 0);
assert(stream_class);
stream_id = bt_ctf_stream_class_get_id(
stream_class);
goto error;
}
- ret = bt_ctf_event_set_payload_field(event,
+ ret = bt_ctf_event_set_event_payload(event,
notit->dscopes.event_payload);
if (ret) {
goto error;
for (i = 0; i < clock_class_count; i++) {
struct bt_ctf_clock_class *clock_class;
- clock_class = bt_ctf_trace_get_clock_class(trace, i);
+ clock_class = bt_ctf_trace_get_clock_class_by_index(trace, i);
if (!clock_class) {
ret = -1;
goto end;
for (i = 0; i < count; i++) {
struct bt_ctf_clock_class *clock_class =
- bt_ctf_trace_get_clock_class(ctf_fs->metadata->trace,
- i);
+ bt_ctf_trace_get_clock_class_by_index(
+ ctf_fs->metadata->trace, i);
assert(clock_class);
ret = bt_clock_class_priority_map_add_clock_class(
for (i = 0; i < clock_class_count; i++) {
struct bt_ctf_clock_class *clock_class =
- bt_ctf_trace_get_clock_class(trace, i);
+ bt_ctf_trace_get_clock_class_by_index(trace, i);
if (!clock_class) {
fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
}
/* FIXME multi-clock? */
- clock_class = bt_ctf_trace_get_clock_class(trace, 0);
+ clock_class = bt_ctf_trace_get_clock_class_by_index(trace, 0);
bt_put(trace);
}
BT_PUT(field);
- field = bt_ctf_event_get_payload_field(event);
+ field = bt_ctf_event_get_event_payload(event);
if (!field) {
fprintf(err, "[error] %s in %s:%d\n", __func__,
__FILE__, __LINE__);
}
copy_field = bt_ctf_field_copy(field);
if (copy_field) {
- ret = bt_ctf_event_set_payload_field(writer_event, copy_field);
+ ret = bt_ctf_event_set_event_payload(writer_event, copy_field);
if (ret < 0) {
fprintf(err, "[error] %s in %s:%d\n", __func__,
__FILE__, __LINE__);
int ret;
/* FIXME multi-clock? */
- writer_clock_class = bt_ctf_trace_get_clock_class(writer_trace, 0);
+ writer_clock_class = bt_ctf_trace_get_clock_class_by_index(writer_trace, 0);
if (!writer_clock_class) {
fprintf(err, "[error] %s in %s:%d\n",
__func__, __FILE__, __LINE__);
__LINE__);
goto error;
}
-
+
ret = 0;
goto end;
}
/* FIXME multi-clock? */
- clock_class = bt_ctf_trace_get_clock_class(trace, 0);
+ clock_class = bt_ctf_trace_get_clock_class_by_index(trace, 0);
bt_put(trace);
end:
#include "ctfcopytrace.h"
#include "clock-fields.h"
+BT_HIDDEN
struct bt_ctf_clock_class *ctf_copy_clock_class(FILE *err,
struct bt_ctf_clock_class *clock_class)
{
return writer_clock_class;
}
+BT_HIDDEN
enum bt_component_status ctf_copy_clock_classes(FILE *err,
struct bt_ctf_trace *writer_trace,
struct bt_ctf_stream_class *writer_stream_class,
for (i = 0; i < clock_class_count; i++) {
struct bt_ctf_clock_class *writer_clock_class;
struct bt_ctf_clock_class *clock_class =
- bt_ctf_trace_get_clock_class(trace, i);
+ bt_ctf_trace_get_clock_class_by_index(trace, i);
if (!clock_class) {
fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
return ret;
}
+BT_HIDDEN
struct bt_ctf_event_class *ctf_copy_event_class(FILE *err,
struct bt_ctf_event_class *event_class)
{
struct bt_value *attr_value;
int ret;
- attr_name = bt_ctf_event_class_get_attribute_name(event_class, i);
+ attr_name = bt_ctf_event_class_get_attribute_name_by_index(
+ event_class, i);
if (!attr_name) {
fprintf(err, "[error] %s in %s:%d\n", __func__,
__FILE__, __LINE__);
goto error;
}
- attr_value = bt_ctf_event_class_get_attribute_value(event_class, i);
+ attr_value = bt_ctf_event_class_get_attribute_value_by_index(
+ event_class, i);
if (!attr_value) {
fprintf(err, "[error] %s in %s:%d\n", __func__,
__FILE__, __LINE__);
}
}
- count = bt_ctf_event_class_get_field_count(event_class);
+ count = bt_ctf_event_class_get_payload_type_field_count(event_class);
for (i = 0; i < count; i++) {
const char *field_name;
struct bt_ctf_field_type *field_type;
int ret;
- ret = bt_ctf_event_class_get_field(event_class, &field_name,
- &field_type, i);
+ ret = bt_ctf_event_class_get_payload_type_field_by_index(
+ event_class, &field_name, &field_type, i);
if (ret < 0) {
fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__);
goto error;
return writer_event_class;
}
+BT_HIDDEN
enum bt_component_status ctf_copy_event_classes(FILE *err,
struct bt_ctf_stream_class *stream_class,
struct bt_ctf_stream_class *writer_stream_class)
struct bt_ctf_field_type *context;
int int_ret;
- event_class = bt_ctf_stream_class_get_event_class(
+ event_class = bt_ctf_stream_class_get_event_class_by_index(
stream_class, i);
if (!event_class) {
fprintf(err, "[error] %s in %s:%d\n", __func__,
return ret;
}
+BT_HIDDEN
struct bt_ctf_stream_class *ctf_copy_stream_class(FILE *err,
struct bt_ctf_stream_class *stream_class,
struct bt_ctf_trace *writer_trace,
return writer_stream_class;
}
+BT_HIDDEN
enum bt_component_status ctf_copy_packet_context_field(FILE *err,
struct bt_ctf_field *field, const char *field_name,
struct bt_ctf_field *writer_packet_context,
}
BT_PUT(field_type);
- writer_field = bt_ctf_field_structure_get_field(writer_packet_context,
- field_name);
+ writer_field = bt_ctf_field_structure_get_field_by_name(
+ writer_packet_context, field_name);
if (!writer_field) {
ret = BT_COMPONENT_STATUS_ERROR;
fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
return ret;
}
+BT_HIDDEN
struct bt_ctf_field *ctf_copy_packet_context(FILE *err,
struct bt_ctf_packet *packet,
struct bt_ctf_stream *writer_stream)
__FILE__, __LINE__);
goto error;
}
- if (bt_ctf_field_type_structure_get_field(struct_type,
+ if (bt_ctf_field_type_structure_get_field_by_index(struct_type,
&field_name, &field_type, i) < 0) {
fprintf(err, "[error] %s in %s:%d\n", __func__,
__FILE__, __LINE__);
return writer_packet_context;
}
+BT_HIDDEN
int ctf_copy_event_header(FILE *err, struct bt_ctf_event *event,
struct bt_ctf_event_class *writer_event_class,
struct bt_ctf_event *writer_event,
return ret;
}
+BT_HIDDEN
struct bt_ctf_event *ctf_copy_event(FILE *err, struct bt_ctf_event *event,
struct bt_ctf_event_class *writer_event_class,
bool override_ts64)
BT_PUT(field);
BT_PUT(copy_field);
- field = bt_ctf_event_get_payload_field(event);
+ field = bt_ctf_event_get_event_payload(event);
if (!field) {
fprintf(err, "[error] %s in %s:%d\n", __func__,
__FILE__, __LINE__);
}
copy_field = bt_ctf_field_copy(field);
if (copy_field) {
- ret = bt_ctf_event_set_payload_field(writer_event, copy_field);
+ ret = bt_ctf_event_set_event_payload(writer_event, copy_field);
if (ret < 0) {
fprintf(err, "[error] %s in %s:%d\n", __func__,
__FILE__, __LINE__);
return writer_event;
}
+BT_HIDDEN
enum bt_component_status ctf_copy_trace(FILE *err, struct bt_ctf_trace *trace,
struct bt_ctf_trace *writer_trace)
{
const char *name;
struct bt_value *value = NULL;
- name = bt_ctf_trace_get_environment_field_name(trace, i);
+ name = bt_ctf_trace_get_environment_field_name_by_index(
+ trace, i);
if (!name) {
fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
__LINE__);
ret = BT_COMPONENT_STATUS_ERROR;
goto end;
}
- value = bt_ctf_trace_get_environment_field_value(trace, i);
+ value = bt_ctf_trace_get_environment_field_value_by_index(
+ trace, i);
if (!value) {
fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
__LINE__);
* Returns BT_COMPONENT_STATUS_OK on success, and BT_COMPONENT_STATUS_ERROR on
* error.
*/
+BT_HIDDEN
enum bt_component_status ctf_copy_clock_classes(FILE *err,
struct bt_ctf_trace *writer_trace,
struct bt_ctf_stream_class *writer_stream_class,
*
* Returns NULL on error.
*/
+BT_HIDDEN
struct bt_ctf_event_class *ctf_copy_event_class(FILE *err,
struct bt_ctf_event_class *event_class);
* Returns BT_COMPONENT_STATUS_OK on success, and BT_COMPONENT_STATUS_ERROR on
* error.
*/
+BT_HIDDEN
enum bt_component_status ctf_copy_event_classes(FILE *err,
struct bt_ctf_stream_class *stream_class,
struct bt_ctf_stream_class *writer_stream_class);
*
* Returns NULL or error.
*/
+BT_HIDDEN
struct bt_ctf_stream_class *ctf_copy_stream_class(FILE *err,
struct bt_ctf_stream_class *stream_class,
struct bt_ctf_trace *writer_trace,
* Returns BT_COMPONENT_STATUS_OK on success, and BT_COMPONENT_STATUS_ERROR on
* error.
*/
+BT_HIDDEN
enum bt_component_status ctf_copy_packet_context_field(FILE *err,
struct bt_ctf_field *field, const char *field_name,
struct bt_ctf_field *writer_packet_context,
* Returns BT_COMPONENT_STATUS_OK on success, and BT_COMPONENT_STATUS_ERROR on
* error.
*/
+BT_HIDDEN
struct bt_ctf_field *ctf_copy_packet_context(FILE *err,
struct bt_ctf_packet *packet,
struct bt_ctf_stream *writer_stream);
*
* Returns NULL on error.
*/
+BT_HIDDEN
struct bt_ctf_event *ctf_copy_event(FILE *err, struct bt_ctf_event *event,
struct bt_ctf_event_class *writer_event_class,
bool override_ts64);
*
* Returns 0 on success, -1 on error.
*/
+BT_HIDDEN
int ctf_copy_event_header(FILE *err, struct bt_ctf_event *event,
struct bt_ctf_event_class *writer_event_class,
struct bt_ctf_event *writer_event,
* Returns BT_COMPONENT_STATUS_OK on success, and BT_COMPONENT_STATUS_ERROR on
* error.
*/
+BT_HIDDEN
enum bt_component_status ctf_copy_trace(FILE *err, struct bt_ctf_trace *trace,
struct bt_ctf_trace *writer_trace);
enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
struct bt_ctf_field *main_field = NULL;
- main_field = bt_ctf_event_get_payload_field(event);
+ main_field = bt_ctf_event_get_event_payload(event);
if (!main_field) {
goto end;
}
for (i = 0; i < count; i++) {
struct bt_private_port *priv_port =
- bt_private_component_filter_get_input_private_port_at_index(
+ bt_private_component_filter_get_input_private_port_by_index(
muxer_comp->priv_comp, i);
struct bt_port *port;
assert(trace);
/* FIXME multi-clock? */
- clock_class = bt_ctf_trace_get_clock_class(trace, 0);
+ clock_class = bt_ctf_trace_get_clock_class_by_index(trace, 0);
if (!clock_class) {
goto end;
}
assert(writer_trace);
/* FIXME multi-clock? */
- writer_clock_class = bt_ctf_trace_get_clock_class(writer_trace, 0);
+ writer_clock_class = bt_ctf_trace_get_clock_class_by_index(
+ writer_trace, 0);
assert(writer_clock_class);
ret = bt_ctf_clock_class_get_offset_s(writer_clock_class, &sec_offset);
struct bt_ctf_field_type *ft_target = NULL;
struct bt_ctf_field_type *ft_tag = NULL;
- sc = bt_ctf_trace_get_stream_class(trace, 0);
+ sc = bt_ctf_trace_get_stream_class_by_index(trace, 0);
assert(sc);
- ec = bt_ctf_stream_class_get_event_class(sc, 0);
+ ec = bt_ctf_stream_class_get_event_class_by_index(sc, 0);
assert(ec);
ph = bt_ctf_trace_get_packet_header_type(trace);
struct bt_ctf_event_class **ec3)
{
*tc1 = tc;
- *sc1 = bt_ctf_trace_get_stream_class(tc, 0);
- *sc2 = bt_ctf_trace_get_stream_class(tc, 1);
- *ec1 = bt_ctf_stream_class_get_event_class(*sc1, 0);
- *ec2 = bt_ctf_stream_class_get_event_class(*sc1, 1);
- *ec3 = bt_ctf_stream_class_get_event_class(*sc2, 0);
+ *sc1 = bt_ctf_trace_get_stream_class_by_index(tc, 0);
+ *sc2 = bt_ctf_trace_get_stream_class_by_index(tc, 1);
+ *ec1 = bt_ctf_stream_class_get_event_class_by_index(*sc1, 0);
+ *ec2 = bt_ctf_stream_class_get_event_class_by_index(*sc1, 1);
+ *ec3 = bt_ctf_stream_class_get_event_class_by_index(*sc2, 0);
bt_put(*sc1);
bt_put(*sc2);
bt_put(*ec1);
"TC1 reference count is 1");
/* User A acquires a reference to SC2 from TC1. */
- user_a.sc = bt_ctf_trace_get_stream_class(user_a.tc, 1);
+ user_a.sc = bt_ctf_trace_get_stream_class_by_index(user_a.tc, 1);
ok(user_a.sc, "User A acquires SC2 from TC1");
ok(bt_object_get_ref_count(weak_tc1) == 2,
"TC1 reference count is 2");
"SC2 reference count is 1");
/* User A acquires a reference to EC3 from SC2. */
- user_a.ec = bt_ctf_stream_class_get_event_class(user_a.sc, 0);
+ user_a.ec = bt_ctf_stream_class_get_event_class_by_index(user_a.sc, 0);
ok(user_a.ec, "User A acquires EC3 from SC2");
ok(bt_object_get_ref_count(weak_tc1) == 2,
"TC1 reference count is 2");
/* User C acquires a reference to EC1. */
diag("User C acquires a reference to EC1");
- user_c.ec = bt_ctf_stream_class_get_event_class(user_b.sc, 0);
+ user_c.ec = bt_ctf_stream_class_get_event_class_by_index(user_b.sc, 0);
ok(bt_object_get_ref_count(weak_ec1) == 1,
"EC1 reference count is 1");
ok(bt_object_get_ref_count(weak_sc1) == 2,
"bt_ctf_stream_class_get_event_class_count handles NULL correctly");
ok(bt_ctf_stream_class_get_event_class_count(stream_class) == 1,
"bt_ctf_stream_class_get_event_class_count returns a correct number of event classes");
- ok(bt_ctf_stream_class_get_event_class(NULL, 0) == NULL,
+ ok(bt_ctf_stream_class_get_event_class_by_index(NULL, 0) == NULL,
"bt_ctf_stream_class_get_event_class handles NULL correctly");
- ok(bt_ctf_stream_class_get_event_class(stream_class, 8724) == NULL,
+ ok(bt_ctf_stream_class_get_event_class_by_index(stream_class, 8724) == NULL,
"bt_ctf_stream_class_get_event_class handles invalid indexes correctly");
- ret_event_class = bt_ctf_stream_class_get_event_class(stream_class, 0);
+ ret_event_class = bt_ctf_stream_class_get_event_class_by_index(stream_class, 0);
ok(ret_event_class == simple_event_class,
"bt_ctf_stream_class_get_event_class returns the correct event class");
bt_put(ret_event_class);
"bt_ctf_event_class_get_attribute_count handles a NULL event class");
ok(bt_ctf_event_class_get_attribute_count(event_class) == 4,
"bt_ctf_event_class_get_attribute_count returns the correct count");
- ok(!bt_ctf_event_class_get_attribute_name(NULL, 0),
+ ok(!bt_ctf_event_class_get_attribute_name_by_index(NULL, 0),
"bt_ctf_event_class_get_attribute_name handles a NULL event class correctly");
- ok(!bt_ctf_event_class_get_attribute_name(event_class, 4),
+ ok(!bt_ctf_event_class_get_attribute_name_by_index(event_class, 4),
"bt_ctf_event_class_get_attribute_name handles a too large index correctly");
- ok(!bt_ctf_event_class_get_attribute_value(NULL, 0),
+ ok(!bt_ctf_event_class_get_attribute_value_by_index(NULL, 0),
"bt_ctf_event_class_get_attribute_value handles a NULL event class correctly");
- ok(!bt_ctf_event_class_get_attribute_value(event_class, 4),
+ ok(!bt_ctf_event_class_get_attribute_value_by_index(event_class, 4),
"bt_ctf_event_class_get_attribute_value handles a too large index correctly");
memset(&attrs_count, 0, sizeof(attrs_count));
for (i = 0; i < 4; ++i) {
- ret_string = bt_ctf_event_class_get_attribute_name(event_class,
- i);
- obj = bt_ctf_event_class_get_attribute_value(event_class, i);
+ ret_string = bt_ctf_event_class_get_attribute_name_by_index(
+ event_class, i);
+ obj = bt_ctf_event_class_get_attribute_value_by_index(
+ event_class, i);
assert(ret_string && obj);
if (!strcmp(ret_string, "id")) {
"bt_ctf_event_class_get_stream_class returns the correct stream class");
bt_put(ret_stream_class);
- ok(bt_ctf_event_class_get_field_count(NULL) < 0,
+ ok(bt_ctf_event_class_get_payload_type_field_count(NULL) < 0,
"bt_ctf_event_class_get_field_count handles NULL correctly");
- ok(bt_ctf_event_class_get_field_count(event_class) == 3,
+ ok(bt_ctf_event_class_get_payload_type_field_count(event_class) == 3,
"bt_ctf_event_class_get_field_count returns a correct value");
- ok(bt_ctf_event_class_get_field(NULL, &ret_string,
+ ok(bt_ctf_event_class_get_payload_type_field_by_index(NULL, &ret_string,
&ret_field_type, 0) < 0,
"bt_ctf_event_class_get_field handles a NULL event class correctly");
- ok(bt_ctf_event_class_get_field(event_class, NULL,
+ ok(bt_ctf_event_class_get_payload_type_field_by_index(event_class, NULL,
&ret_field_type, 0) == 0,
"bt_ctf_event_class_get_field handles a NULL field name correctly");
bt_put(ret_field_type);
- ok(bt_ctf_event_class_get_field(event_class, &ret_string,
+ ok(bt_ctf_event_class_get_payload_type_field_by_index(event_class, &ret_string,
NULL, 0) == 0,
"bt_ctf_event_class_get_field handles a NULL field type correctly");
- ok(bt_ctf_event_class_get_field(event_class, &ret_string,
+ ok(bt_ctf_event_class_get_payload_type_field_by_index(event_class, &ret_string,
&ret_field_type, 42) < 0,
"bt_ctf_event_class_get_field handles an invalid index correctly");
- ok(bt_ctf_event_class_get_field(event_class, &ret_string,
+ ok(bt_ctf_event_class_get_payload_type_field_by_index(event_class, &ret_string,
&ret_field_type, 0) == 0,
"bt_ctf_event_class_get_field returns a field");
ok(bt_ctf_field_type_compare(ret_field_type, uint_35_type) == 0,
"bt_ctf_trace_get_environment_field_count returns a correct number of environment fields");
/* Test bt_ctf_trace_get_environment_field_name */
- ok(bt_ctf_trace_get_environment_field_name(NULL, 0) == NULL,
+ ok(bt_ctf_trace_get_environment_field_name_by_index(NULL, 0) == NULL,
"bt_ctf_trace_get_environment_field_name handles a NULL trace correctly");
- ok(bt_ctf_trace_get_environment_field_name(trace, -1) == NULL,
+ ok(bt_ctf_trace_get_environment_field_name_by_index(trace, -1) == NULL,
"bt_ctf_trace_get_environment_field_name handles an invalid index correctly (negative)");
- ok(bt_ctf_trace_get_environment_field_name(trace, 5) == NULL,
+ ok(bt_ctf_trace_get_environment_field_name_by_index(trace, 5) == NULL,
"bt_ctf_trace_get_environment_field_name handles an invalid index correctly (too large)");
- ret_string = bt_ctf_trace_get_environment_field_name(trace, 0);
+ ret_string = bt_ctf_trace_get_environment_field_name_by_index(trace, 0);
ok(ret_string && !strcmp(ret_string, "host"),
"bt_ctf_trace_get_environment_field_name returns a correct field name");
- ret_string = bt_ctf_trace_get_environment_field_name(trace, 1);
+ ret_string = bt_ctf_trace_get_environment_field_name_by_index(trace, 1);
ok(ret_string && !strcmp(ret_string, "test_env_int_obj"),
"bt_ctf_trace_get_environment_field_name returns a correct field name");
- ret_string = bt_ctf_trace_get_environment_field_name(trace, 2);
+ ret_string = bt_ctf_trace_get_environment_field_name_by_index(trace, 2);
ok(ret_string && !strcmp(ret_string, "test_env_str_obj"),
"bt_ctf_trace_get_environment_field_name returns a correct field name");
- ret_string = bt_ctf_trace_get_environment_field_name(trace, 3);
+ ret_string = bt_ctf_trace_get_environment_field_name_by_index(trace, 3);
ok(ret_string && !strcmp(ret_string, "test_env_int"),
"bt_ctf_trace_get_environment_field_name returns a correct field name");
- ret_string = bt_ctf_trace_get_environment_field_name(trace, 4);
+ ret_string = bt_ctf_trace_get_environment_field_name_by_index(trace, 4);
ok(ret_string && !strcmp(ret_string, "test_env_str"),
"bt_ctf_trace_get_environment_field_name returns a correct field name");
/* Test bt_ctf_trace_get_environment_field_value */
- ok(bt_ctf_trace_get_environment_field_value(NULL, 0) == NULL,
+ ok(bt_ctf_trace_get_environment_field_value_by_index(NULL, 0) == NULL,
"bt_ctf_trace_get_environment_field_value handles a NULL trace correctly");
- ok(bt_ctf_trace_get_environment_field_value(trace, -1) == NULL,
+ ok(bt_ctf_trace_get_environment_field_value_by_index(trace, -1) == NULL,
"bt_ctf_trace_get_environment_field_value handles an invalid index correctly (negative)");
- ok(bt_ctf_trace_get_environment_field_value(trace, 5) == NULL,
+ ok(bt_ctf_trace_get_environment_field_value_by_index(trace, 5) == NULL,
"bt_ctf_trace_get_environment_field_value handles an invalid index correctly (too large)");
- obj = bt_ctf_trace_get_environment_field_value(trace, 1);
+ obj = bt_ctf_trace_get_environment_field_value_by_index(trace, 1);
ret = bt_value_integer_get(obj, &ret_int64_t);
ok(!ret && ret_int64_t == 23,
"bt_ctf_trace_get_environment_field_value succeeds in getting an integer value");
BT_PUT(obj);
- obj = bt_ctf_trace_get_environment_field_value(trace, 2);
+ obj = bt_ctf_trace_get_environment_field_value_by_index(trace, 2);
ret = bt_value_string_get(obj, &ret_string);
ok(!ret && ret_string && !strcmp(ret_string, "the value"),
"bt_ctf_trace_get_environment_field_value succeeds in getting a string value");
"bt_ctf_trace_set_environment_field_integer succeeds with an existing name");
ok(bt_ctf_trace_get_environment_field_count(trace) == 5,
"bt_ctf_trace_set_environment_field_integer with an existing key does not increase the environment size");
- obj = bt_ctf_trace_get_environment_field_value(trace, 3);
+ obj = bt_ctf_trace_get_environment_field_value_by_index(trace, 3);
ret = bt_value_integer_get(obj, &ret_int64_t);
ok(!ret && ret_int64_t == 654321,
"bt_ctf_trace_get_environment_field_value successfully replaces an existing field");
ok(stream1, "Instanciate a stream class from writer");
ok(bt_ctf_trace_get_stream_count(trace) == 1,
"bt_ctf_trace_get_stream_count() succeeds and returns the correct value (1)");
- stream = bt_ctf_trace_get_stream(trace, 0);
+ stream = bt_ctf_trace_get_stream_by_index(trace, 0);
ok(stream == stream1,
- "bt_ctf_trace_get_stream() succeeds and returns the correct value");
+ "bt_ctf_trace_get_stream_by_index() succeeds and returns the correct value");
BT_PUT(stream);
/*
"bt_ctf_trace_get_clock_class_count correctly handles NULL");
ok(bt_ctf_trace_get_clock_class_count(trace) == 1,
"bt_ctf_trace_get_clock_class_count returns the correct number of clocks");
- ok(!bt_ctf_trace_get_clock_class(NULL, 0),
+ ok(!bt_ctf_trace_get_clock_class_by_index(NULL, 0),
"bt_ctf_trace_get_clock_class correctly handles NULL");
- ok(!bt_ctf_trace_get_clock_class(trace, -1),
+ ok(!bt_ctf_trace_get_clock_class_by_index(trace, -1),
"bt_ctf_trace_get_clock_class correctly handles negative indexes");
- ok(!bt_ctf_trace_get_clock_class(trace, 1),
+ ok(!bt_ctf_trace_get_clock_class_by_index(trace, 1),
"bt_ctf_trace_get_clock_class correctly handles out of bound accesses");
- ret_clock_class = bt_ctf_trace_get_clock_class(trace, 0);
+ ret_clock_class = bt_ctf_trace_get_clock_class_by_index(trace, 0);
ok(strcmp(bt_ctf_clock_class_get_name(ret_clock_class),
bt_ctf_clock_get_name(clock)) == 0,
"bt_ctf_trace_get_clock_class returns the right clock instance");
assert(sink_def_port);
conn = bt_graph_connect_ports(graph, src_def_port, sink_def_port);
assert(conn);
- src_hello_port = bt_component_source_get_output_port(src, "hello");
+ src_hello_port = bt_component_source_get_output_port_by_name(src,
+ "hello");
assert(src_hello_port);
/* We're supposed to have 6 events */
"bt_plugin_get_path() handles NULL correctly");
ok(bt_plugin_get_component_class_count(NULL) < 0,
"bt_plugin_get_component_class_count() handles NULL correctly");
- ok(!bt_plugin_get_component_class(NULL, 0),
- "bt_plugin_get_component_class() handles NULL correctly");
+ ok(!bt_plugin_get_component_class_by_index(NULL, 0),
+ "bt_plugin_get_component_class_by_index() handles NULL correctly");
ok(!bt_plugin_get_component_class_by_name_and_type(NULL, NULL, 0),
"bt_plugin_get_component_class_by_name_and_type() handles NULL correctly");
}
assert(count >= 0);
for (i = 0; i < count; i++) {
- upstream_port = bt_component_source_get_output_port_at_index(
+ upstream_port = bt_component_source_get_output_port_by_index(
src_comp, i);
assert(upstream_port);
- downstream_port = bt_component_filter_get_input_port_at_index(
+ downstream_port = bt_component_filter_get_input_port_by_index(
muxer_comp, i);
assert(downstream_port);
conn = bt_graph_connect_ports(graph,
}
/* Connect muxer output port to sink input port */
- upstream_port = bt_component_filter_get_output_port(muxer_comp,
+ upstream_port = bt_component_filter_get_output_port_by_name(muxer_comp,
"out");
assert(upstream_port);
downstream_port = bt_component_sink_get_default_input_port(sink_comp);
for (i = 0; i < count; i++) {
struct bt_port *muxer_port =
- bt_component_filter_get_input_port_at_index(
+ bt_component_filter_get_input_port_by_index(
muxer_comp, i);
assert(muxer_port);
assert(ret == 0);
for (i = 0; i < count; i++) {
- upstream_port = bt_component_source_get_output_port_at_index(
+ upstream_port = bt_component_source_get_output_port_by_index(
src_comp, i);
assert(upstream_port);
connect_port_to_first_avail_muxer_port(graph,
}
/* Connect muxer output port to sink input port */
- upstream_port = bt_component_filter_get_output_port(muxer_comp,
+ upstream_port = bt_component_filter_get_output_port_by_name(muxer_comp,
"out");
assert(upstream_port);
downstream_port = bt_component_sink_get_default_input_port(sink_comp);
assert(ret == 0);
for (i = 0; i < count; i++) {
- upstream_port = bt_component_source_get_output_port_at_index(
+ upstream_port = bt_component_source_get_output_port_by_index(
src_comp, i);
assert(upstream_port);
connect_port_to_first_avail_muxer_port(graph,
}
/* Connect muxer output port to sink input port */
- upstream_port = bt_component_filter_get_output_port(muxer_comp,
+ upstream_port = bt_component_filter_get_output_port_by_name(muxer_comp,
"out");
assert(upstream_port);
downstream_port = bt_component_sink_get_default_input_port(sink_comp);