source: geniuswebcore/geniusweb/connection/Connectable.py@ 60

Last change on this file since 60 was 59, checked in by Wouter Pasman, 3 years ago

#44 manual commit of first public release, because this will cause the dist directory to move

File size: 904 bytes
RevLine 
[59]1from abc import ABC, abstractmethod
2from typing import TypeVar, Generic, List
3
4from geniusweb.connection.ConnectionEnd import ConnectionEnd
5
6INTYPE = TypeVar('INTYPE')
7OUTTYPE = TypeVar('OUTTYPE')
8
9class Connectable(ABC, Generic[INTYPE,OUTTYPE]):
10 '''
11 A Connectable is an object that can connect on request with a provided
12 {@link ConnectionEnd} and then respond to incoming and outgong signals.
13 @param <INTYPE> the type of incoming messages
14 @param <OUTTYPE> the type of outgoing messages
15 '''
16
17 @abstractmethod
18 def connect(self,connection:ConnectionEnd[INTYPE, OUTTYPE] ):
19 '''
20 creates the connection. Only called if not yet connected.
21 @param connection the new connection
22 '''
23
24 @abstractmethod
25 def disconnect(self):
26 '''
27 Removes the connection from a connectable; the previously given
28 connection can not be used anymore after this call. Only called if
29 previously connected.
30
31 '''
Note: See TracBrowser for help on using the repository browser.