bt2/native_bt.i \
bt2/native_bt_clock_class.i \
bt2/native_bt_clock_snapshot.i \
- bt2/native_bt_component_class.i \
bt2/native_bt_component.i \
+ bt2/native_bt_component_class.i \
bt2/native_bt_connection.i \
bt2/native_bt_error.i \
- bt2/native_bt_event_class.i \
bt2/native_bt_event.i \
+ bt2/native_bt_event_class.i \
+ bt2/native_bt_field.i \
bt2/native_bt_field_class.i \
bt2/native_bt_field_path.i \
- bt2/native_bt_field.i \
bt2/native_bt_graph.i \
bt2/native_bt_integer_range_set.i \
- bt2/native_bt.i \
+ bt2/native_bt_interrupter.i \
bt2/native_bt_logging.i \
bt2/native_bt_message.i \
bt2/native_bt_message_iterator.i \
bt2/native_bt_plugin.i \
bt2/native_bt_port.i \
bt2/native_bt_query_exec.i \
- bt2/native_bt_stream_class.i \
bt2/native_bt_stream.i \
- bt2/native_bt_trace_class.i \
+ bt2/native_bt_stream_class.i \
bt2/native_bt_trace.i \
+ bt2/native_bt_trace_class.i \
bt2/native_bt_value.i \
bt2/native_bt_version.i
bt2/component.py \
bt2/connection.py \
bt2/error.py \
- bt2/event_class.py \
bt2/event.py \
+ bt2/event_class.py \
bt2/field.py \
bt2/field_class.py \
bt2/field_path.py \
bt2/graph.py \
bt2/integer_range_set.py \
+ bt2/interrupter.py \
bt2/logging.py \
- bt2/message_iterator.py \
bt2/message.py \
+ bt2/message_iterator.py \
bt2/object.py \
bt2/packet.py \
bt2/plugin.py \
bt2/port.py \
bt2/py_plugin.py \
bt2/query_executor.py \
- bt2/stream_class.py \
bt2/stream.py \
+ bt2/stream_class.py \
bt2/trace.py \
bt2/trace_class.py \
bt2/trace_collection_message_iterator.py \
__version__ = '@PACKAGE_VERSION@'
+from bt2.interrupter import *
from bt2.clock_class import *
from bt2.clock_snapshot import *
from bt2.component import *
--- /dev/null
+# The MIT License (MIT)
+#
+# Copyright (c) 2019 Philippe Proulx <pproulx@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# 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 SOFTWARE.
+
+from bt2 import native_bt, object
+
+
+class Interrupter(object._SharedObject):
+ _get_ref = staticmethod(native_bt.interrupter_get_ref)
+ _put_ref = staticmethod(native_bt.interrupter_put_ref)
+
+ def __init__(self):
+ ptr = native_bt.interrupter_create()
+
+ if ptr is None:
+ raise bt2.CreationError('cannot create interrupter object')
+
+ super().__init__(ptr)
+
+ @property
+ def is_set(self):
+ return bool(native_bt.interrupter_is_set(self._ptr))
+
+ def __bool__(self):
+ return self.is_set
+
+ def set(self):
+ native_bt.interrupter_set(self._ptr)
+
+ def reset(self):
+ native_bt.interrupter_reset(self._ptr)
%include "native_bt_field_class.i"
%include "native_bt_field_path.i"
%include "native_bt_graph.i"
+%include "native_bt_integer_range_set.i"
+%include "native_bt_interrupter.i"
%include "native_bt_logging.i"
%include "native_bt_message.i"
%include "native_bt_message_iterator.i"
%include "native_bt_plugin.i"
%include "native_bt_port.i"
%include "native_bt_query_exec.i"
-%include "native_bt_integer_range_set.i"
%include "native_bt_stream.i"
%include "native_bt_stream_class.i"
%include "native_bt_trace.i"
--- /dev/null
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * 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 SOFTWARE.
+ */
+
+%include <babeltrace2/graph/interrupter.h>
+%include <babeltrace2/graph/interrupter-const.h>
bindings/python/bt2/test_field.py \
bindings/python/bt2/test_graph.py \
bindings/python/bt2/test_integer_range_set.py \
+ bindings/python/bt2/test_interrupter.py \
bindings/python/bt2/test_message_iterator.py \
bindings/python/bt2/test_message.py \
bindings/python/bt2/test_packet.py \
--- /dev/null
+#
+# Copyright (C) 2019 EfficiOS Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+import bt2
+import unittest
+
+
+class InterrupterTestCase(unittest.TestCase):
+ def setUp(self):
+ self._interrupter = bt2.Interrupter()
+
+ def test_create(self):
+ self.assertFalse(self._interrupter.is_set)
+
+ def test_is_set(self):
+ self.assertFalse(self._interrupter.is_set)
+
+ def test_bool(self):
+ self.assertFalse(self._interrupter)
+ self._interrupter.set()
+ self.assertTrue(self._interrupter)
+
+ def test_set(self):
+ self.assertFalse(self._interrupter)
+ self._interrupter.set()
+ self.assertTrue(self._interrupter)
+
+ def test_reset(self):
+ self._interrupter.set()
+ self.assertTrue(self._interrupter)
+ self._interrupter.reset()
+ self.assertFalse(self._interrupter)