1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
class IChannel:
def __init__(self): raise NotImplementedError()
def add(self,timestamp,data,controller): pass
def get(self,query): pass
class PrinterChannel(IChannel):
def __init__(self,name):
self.name = name
def add(self,timestamp,data,controller):
print "{0}: {1},{2}".format(self.name, timestamp, data)
class SimpleMemoryChannel(IChannel):
def __init__(self):
self.data = ""
def add(self,timestamp,data,controller):
self.data = data
def get(self,query):
return str(self.data)
class IntervalStoreChannel(IChannel):
SECONDS=1000
MINUTES=60*1000
HOURS=60*60*1000
DAYS=24*60*60*1000
def __init__(self): pass
|