Tests: Multi-trace stream intersection test
[babeltrace.git] / bindings / python / python-complements.c
index 872512d6848a44d4fa5e24bab8bb8f08f7e6de6e..0e3bbdf1a3e237859eb4c98998a1148a1f0ed2ee 100644 (file)
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  */
 
 #include "python-complements.h"
-#include <babeltrace/ctf-ir/event-types-internal.h>
-#include <babeltrace/ctf-ir/event-fields-internal.h>
-#include <babeltrace/ctf-ir/event-types.h>
+#include <babeltrace/ctf-ir/field-types-internal.h>
+#include <babeltrace/ctf-ir/fields-internal.h>
+#include <babeltrace/ctf-ir/field-types.h>
 #include <babeltrace/ctf-ir/event.h>
+#include <babeltrace/ctf-ir/event-class.h>
 #include <babeltrace/ctf-ir/clock-internal.h>
+#include <babeltrace/iterator.h>
+#include <babeltrace/ctf/iterator.h>
+#include <babeltrace/ctf/events-internal.h>
+#include <glib.h>
 
 /* List-related functions
    ----------------------------------------------------
@@ -80,7 +92,7 @@ struct bt_ctf_event_decl *_bt_python_decl_one_from_list(
 /* decl_fields */
 struct bt_ctf_field_decl **_by_python_field_decl_listcaller(
                struct bt_ctf_event_decl *event_decl,
-               enum bt_ctf_scope scope,
+               enum ctf_scope scope,
                unsigned int *len)
 {
        struct bt_ctf_field_decl **list;
@@ -379,3 +391,33 @@ int _bt_python_ctf_clock_set_uuid_index(struct bt_ctf_clock *clock,
 end:
        return ret;
 }
+
+/*
+ * Python 3.5 changes the StopIteration exception clearing behaviour which
+ * erroneously marks swig clean-up function as having failed. This explicit
+ * allocation function is intended as a work-around so SWIG doesn't manage
+ * the lifetime of a "temporary" object by itself.
+ */
+struct bt_iter_pos *_bt_python_create_iter_pos(void)
+{
+       return g_new0(struct bt_iter_pos, 1);
+}
+
+struct bt_ctf_iter *_bt_python_ctf_iter_create_intersect(
+               struct bt_context *ctx,
+               struct bt_iter_pos *inter_begin_pos,
+               struct bt_iter_pos *inter_end_pos)
+{
+       return bt_ctf_iter_create_intersect(ctx, &inter_begin_pos,
+                       &inter_end_pos);
+}
+
+int _bt_python_trace_collection_has_intersection(struct bt_context *ctx)
+{
+       int ret;
+       int64_t begin, end;
+
+       ret = ctf_find_tc_stream_packet_intersection_union(ctx, &begin, &end);
+
+       return ret == 0 ? 1 : 0;
+}
This page took 0.024406 seconds and 4 git commands to generate.