def _create_packet_end_message(self, packet, default_clock_snapshot=None): utils._check_type(packet, bt2_packet._Packet) if packet.stream.cls.packets_have_end_default_clock_snapshot: if default_clock_snapshot is None: raise ValueError( "packet end messages in this stream must have a default clock snapshot" ) utils._check_uint64(default_clock_snapshot) ptr = native_bt.message_packet_end_create_with_default_clock_snapshot( self._bt_ptr, packet._ptr, default_clock_snapshot) else: if default_clock_snapshot is not None: raise ValueError( "packet end messages in this stream must not have a default clock snapshot" ) ptr = native_bt.message_packet_end_create(self._bt_ptr, packet._ptr) if ptr is None: raise bt2._MemoryError('cannot create packet end message object') return bt2_message._PacketEndMessage(ptr)
def __init__(self, packet): utils._check_type(packet, bt2.packet._Packet) ptr = native_bt.message_packet_end_create(packet._ptr) if ptr is None: raise bt2.CreationError('cannot create packet end message object') super().__init__(ptr)