bt2: update object model
[babeltrace.git] / bindings / python / bt2 / bt2 / connection.py
index fdeb84d97669502df52d41e2d9f296af40f4484b..a15c67927bc75e136ba76e1d64071b6577a5a719 100644 (file)
@@ -21,7 +21,7 @@
 # THE SOFTWARE.
 
 from bt2 import native_bt, object, utils
-import bt2.notification_iterator
+import bt2.message_iterator
 import collections.abc
 import bt2.port
 import copy
@@ -39,12 +39,12 @@ def _handle_status(status, gen_error_msg):
 
 def _create_private_from_ptr(ptr):
     obj = _PrivateConnection._create_from_ptr(ptr)
-    obj._pub_ptr = native_bt.connection_from_private_connection(ptr)
+    obj._pub_ptr = native_bt.connection_from_private(ptr)
     assert(obj._pub_ptr)
     return obj
 
 
-class _Connection(object._Object):
+class _Connection(object._SharedObject):
     @staticmethod
     def _downstream_port(ptr):
         port_ptr = native_bt.connection_get_downstream_port(ptr)
@@ -78,33 +78,3 @@ class _Connection(object._Object):
             return False
 
         return self.addr == other.addr
-
-
-class _PrivateConnection(object._PrivateObject, _Connection):
-    def create_notification_iterator(self, notification_types=None):
-        if notification_types is None:
-            notif_types = None
-        else:
-            for notif_cls in notification_types:
-                if notif_cls not in bt2.notification._NOTIF_TYPE_TO_CLS.values():
-                    raise ValueError("'{}' is not a notification class".format(notif_cls))
-
-            notif_types = [notif_cls._TYPE for notif_cls in notification_types]
-
-        status, notif_iter_ptr = native_bt.py3_create_notif_iter(int(self._ptr),
-                                                                notif_types)
-        _handle_status(status, 'cannot create notification iterator object')
-        assert(notif_iter_ptr)
-        return bt2.notification_iterator._PrivateConnectionNotificationIterator._create_from_ptr(notif_iter_ptr)
-
-    @property
-    def is_ended(self):
-        return self._is_ended(self._pub_ptr)
-
-    @property
-    def downstream_port(self):
-        return self._downstream_port(self._pub_ptr)
-
-    @property
-    def upstream_port(self):
-        return self._upstream_port(self._pub_ptr)
This page took 0.025757 seconds and 4 git commands to generate.