projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bt2: add `_Trace.cls` property
[babeltrace.git]
/
bindings
/
python
/
bt2
/
bt2
/
trace.py
diff --git
a/bindings/python/bt2/bt2/trace.py
b/bindings/python/bt2/bt2/trace.py
index aa2757c0c170bc3fca77a07b616efaaf9088262c..5830ec3f8bc0b694dc3a1d081aae9fd5a9e1bad6 100644
(file)
--- a/
bindings/python/bt2/bt2/trace.py
+++ b/
bindings/python/bt2/bt2/trace.py
@@
-25,16
+25,17
@@
import bt2.field_class
import collections.abc
import bt2.value
import bt2.stream
import collections.abc
import bt2.value
import bt2.stream
+import bt2.trace_class
import bt2
import functools
def _trace_destruction_listener_from_native(user_listener, trace_ptr):
import bt2
import functools
def _trace_destruction_listener_from_native(user_listener, trace_ptr):
- trace = bt2.trace.Trace._create_from_ptr_and_get_ref(trace_ptr)
+ trace = bt2.trace.
_
Trace._create_from_ptr_and_get_ref(trace_ptr)
user_listener(trace)
user_listener(trace)
-class Trace(object._SharedObject, collections.abc.Mapping):
+class
_
Trace(object._SharedObject, collections.abc.Mapping):
_get_ref = staticmethod(native_bt.trace_get_ref)
_put_ref = staticmethod(native_bt.trace_put_ref)
_get_ref = staticmethod(native_bt.trace_get_ref)
_put_ref = staticmethod(native_bt.trace_put_ref)
@@
-63,6
+64,12
@@
class Trace(object._SharedObject, collections.abc.Mapping):
yield id
yield id
+ @property
+ def cls(self):
+ trace_class_ptr = native_bt.trace_borrow_class(self._ptr)
+ assert trace_class_ptr is not None
+ return bt2.trace_class._TraceClass._create_from_ptr_and_get_ref(trace_class_ptr)
+
@property
def name(self):
return native_bt.trace_get_name(self._ptr)
@property
def name(self):
return native_bt.trace_get_name(self._ptr)
@@
-75,16
+82,16
@@
class Trace(object._SharedObject, collections.abc.Mapping):
_name = property(fset=_name)
def create_stream(self, stream_class, id=None, name=None):
_name = property(fset=_name)
def create_stream(self, stream_class, id=None, name=None):
- utils._check_type(stream_class, bt2.stream_class.StreamClass)
+ utils._check_type(stream_class, bt2.stream_class.
_
StreamClass)
if stream_class.assigns_automatic_stream_id:
if id is not None:
if stream_class.assigns_automatic_stream_id:
if id is not None:
- raise
bt2.Creation
Error("id provided, but stream class assigns automatic stream ids")
+ raise
Value
Error("id provided, but stream class assigns automatic stream ids")
stream_ptr = native_bt.stream_create(stream_class._ptr, self._ptr)
else:
if id is None:
stream_ptr = native_bt.stream_create(stream_class._ptr, self._ptr)
else:
if id is None:
- raise
bt2.Creation
Error("id not provided, but stream class does not assign automatic stream ids")
+ raise
Value
Error("id not provided, but stream class does not assign automatic stream ids")
utils._check_uint64(id)
stream_ptr = native_bt.stream_create_with_id(stream_class._ptr, self._ptr, id)
utils._check_uint64(id)
stream_ptr = native_bt.stream_create_with_id(stream_class._ptr, self._ptr, id)
This page took
0.027967 seconds
and
4
git commands to generate.