lib: remove clock class priority map, use default clock value
[babeltrace.git] / include / babeltrace / ctf-ir / packet.h
index 996f6e7c79e97a6300097612d9e7ed1b01866746..e8ebf87953f6e6a1e5864aa18c974f2ba67e6527 100644 (file)
 
 #include <stdint.h>
 
+/* For bt_get() */
+#include <babeltrace/ref.h>
+
+/* For bt_bool */
+#include <babeltrace/types.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -94,7 +100,11 @@ except for \link refs reference counting\endlink.
 @sa ctfirpacket
 */
 struct bt_packet;
+struct bt_packet_header_field;
+struct bt_packet_context_field;
 struct bt_stream;
+struct bt_clock_value;
+struct bt_clock_class;
 
 /**
 @name Creation and parent access functions
@@ -115,8 +125,9 @@ bt_packet_set_header() and bt_packet_set_context().
 @prenotnull{stream}
 @postsuccessrefcountret1
 */
-extern struct bt_packet *bt_packet_create(
-               struct bt_stream *stream);
+extern struct bt_packet *bt_packet_create(struct bt_stream *stream);
+
+extern struct bt_stream *bt_packet_borrow_stream(struct bt_packet *packet);
 
 /**
 @brief Returns the parent CTF IR stream of the CTF IR packet \p packet.
@@ -131,8 +142,12 @@ the packet object in the first place with bt_packet_create().
 @postrefcountsame{packet}
 @postsuccessrefcountretinc
 */
-extern struct bt_stream *bt_packet_get_stream(
-               struct bt_packet *packet);
+static inline
+struct bt_stream *bt_packet_get_stream(
+               struct bt_packet *packet)
+{
+       return bt_get(bt_packet_borrow_stream(packet));
+}
 
 /** @} */
 
@@ -141,104 +156,35 @@ extern struct bt_stream *bt_packet_get_stream(
 @{
 */
 
-/**
-@brief Returns the trace packet header field of the CTF IR packet
-       \p packet.
-
-@param[in] packet      Packet of which to get the trace packet header
-                       field.
-@returns               Trace packet header field of \p packet,
-                       or \c NULL if the trace packet header
-                       field is not set or on error.
-
-@prenotnull{packet}
-@postrefcountsame{packet}
-@postsuccessrefcountretinc
-
-@sa bt_packet_set_header(): Sets the trace packet header
-       field of a given packet.
-*/
-extern struct bt_field *bt_packet_get_header(
-               struct bt_packet *packet);
-
-/**
-@brief Sets the trace packet header field of the CTF IR packet \p packet to
-       \p header, or unsets the current trace packet header field from
-       \p packet.
+extern
+struct bt_field *bt_packet_borrow_header(struct bt_packet *packet);
 
-If \p header is not \c NULL, the field type of \p header, as returned by
-bt_field_get_type(), \em must be equivalent to the field type returned by
-bt_trace_get_packet_header_type() for the parent trace class of
-\p packet.
+extern
+int bt_packet_move_header(struct bt_packet *packet,
+               struct bt_packet_header_field *header);
 
-@param[in] packet      Packet of which to set the trace packet header field.
-@param[in] header      Trace packet header field.
-@returns               0 on success, or a negative value on error.
+extern
+struct bt_field *bt_packet_borrow_context(struct bt_packet *packet);
 
-@prenotnull{packet}
-@prehot{packet}
-@pre <strong>\p header, if not \c NULL</strong>, has a field type equivalent to
-       the field type returned by bt_trace_get_packet_header_type() for the
-       parent trace class of \p packet.
-@postrefcountsame{event}
-@post <strong>On success, if \p header is not \c NULL</strong>, the reference
-       count of \p header is incremented.
-
-@sa bt_packet_get_header(): Returns the trace packet header field of a given
-       packet.
-*/
-extern int bt_packet_set_header(
-               struct bt_packet *packet, struct bt_field *header);
+extern
+int bt_packet_move_context(struct bt_packet *packet,
+               struct bt_packet_context_field *context);
 
-/**
-@brief Returns the stream packet context field of the CTF IR packet
-       \p packet.
+/** @} */
 
-@param[in] packet      Packet of which to get the stream packet context
-                       field.
-@returns               Stream packet context field of \p packet,
-                       or \c NULL if the stream packet context
-                       field is not set or on error.
+extern int bt_packet_set_beginning_clock_value(struct bt_packet *packet,
+               struct bt_clock_class *clock_class, uint64_t raw_value,
+               bt_bool is_default);
 
-@prenotnull{packet}
-@postrefcountsame{packet}
-@postsuccessrefcountretinc
-
-@sa bt_packet_set_context(): Sets the stream packet context
-       field of a given packet.
-*/
-extern struct bt_field *bt_packet_get_context(
+extern struct bt_clock_value *bt_packet_borrow_default_beginning_clock_value(
                struct bt_packet *packet);
 
-/**
-@brief Sets the stream packet context field of the CTF IR packet \p packet to
-       \p context, or unsets the current packet context field from \p packet.
-
-If \p context is not \c NULL, the field type of \p context, as returned by
-bt_field_get_type(), \em must be equivalent to the field type returned by
-bt_stream_class_get_packet_context_type() for the parent stream class of
-\p packet.
+extern int bt_packet_set_end_clock_value(struct bt_packet *packet,
+               struct bt_clock_class *clock_class, uint64_t raw_value,
+               bt_bool is_default);
 
-@param[in] packet      Packet of which to set the stream packet context field.
-@param[in] context     Stream packet context field.
-@returns               0 on success, or a negative value on error.
-
-@prenotnull{packet}
-@prehot{packet}
-@pre <strong>\p context, if not \c NULL</strong>, has a field type equivalent to
-       the field type returned by bt_stream_class_get_packet_context_type()
-       for the parent stream class of \p packet.
-@postrefcountsame{packet}
-@post <strong>On success, if \p context is not \c NULL</strong>, the reference
-       count of \p context is incremented.
-
-@sa bt_packet_get_context(): Returns the stream packet context field of a
-       given packet.
-*/
-extern int bt_packet_set_context(
-               struct bt_packet *packet, struct bt_field *context);
-
-/** @} */
+extern struct bt_clock_value *bt_packet_borrow_default_end_clock_value(
+               struct bt_packet *packet);
 
 /** @} */
 
This page took 0.028342 seconds and 4 git commands to generate.