bt2: Adapt test_trace.py and make it pass
[babeltrace.git] / bindings / python / bt2 / bt2 / stream.py
index 32fb9a5fb0de8c44e9daa5e1d8e05593d72f48a8..c37e087833c71bee965f879da2a5011af0efc5b5 100644 (file)
@@ -28,30 +28,30 @@ import bt2
 
 
 def _create_from_ptr(stream_ptr):
-    if native_bt.ctf_stream_is_writer(stream_ptr):
-        import ctf_writer
+    import bt2.ctf_writer
 
-        cls = ctf_writer._CtfWriterStream
+    if native_bt.stream_is_writer(stream_ptr):
+        cls = bt2.ctf_writer._CtfWriterStream
     else:
         cls = _Stream
 
     return cls._create_from_ptr(stream_ptr)
 
 
-class _StreamBase(object._Object):
+class _StreamBase(object._SharedObject):
     @property
     def stream_class(self):
-        stream_class_ptr = native_bt.ctf_stream_get_class(self._ptr)
+        stream_class_ptr = native_bt.stream_get_class(self._ptr)
         assert(stream_class_ptr)
         return bt2.StreamClass._create_from_ptr(stream_class_ptr)
 
     @property
     def name(self):
-        return native_bt.ctf_stream_get_name(self._ptr)
+        return native_bt.stream_get_name(self._ptr)
 
     @property
     def id(self):
-        id = native_bt.ctf_stream_get_id(self._ptr)
+        id = native_bt.stream_get_id(self._ptr)
         return id if id >= 0 else None
 
     def __eq__(self, other):
@@ -62,8 +62,11 @@ class _StreamBase(object._Object):
 
 
 class _Stream(_StreamBase):
+    _get_ref = staticmethod(native_bt.stream_get_ref)
+    _put_ref = staticmethod(native_bt.stream_put_ref)
+
     def create_packet(self):
-        packet_ptr = native_bt.ctf_packet_create(self._ptr)
+        packet_ptr = native_bt.packet_create(self._ptr)
 
         if packet_ptr is None:
             raise bt2.CreationError('cannot create packet object')
This page took 0.031777 seconds and 4 git commands to generate.