##// END OF EJS Templates
VoltageProcessor: Crea el objeto de salida en el constructor
Miguel Valdez -
r188:c0af656b96e7
parent child
Show More
@@ -66,9 +66,6 class ProcessingUnit:
66 66 **kwargs : Diccionario de argumentos de la funcion a ejecutar
67 67 """
68 68
69 if self.dataIn.isEmpty():
70 return None
71
72 69 raise ValueError, "ImplementedError"
73 70
74 71 def callMethod(self, name, **kwargs):
@@ -83,9 +80,6 class ProcessingUnit:
83 80
84 81 """
85 82
86 if self.dataIn.isEmpty():
87 return None
88
89 83 methodToCall = getattr(self, name)
90 84
91 85 methodToCall(**kwargs)
@@ -106,17 +100,14 class ProcessingUnit:
106 100 None
107 101 """
108 102
109 if self.dataIn.isEmpty():
110 return None
111
112 103 object = self.objectList[objId]
113 104
114 105 object.run(self.dataOut, **kwargs)
115 106
116 def call(self, operation, **kwargs):
107 def call(self, operationConf, **kwargs):
117 108
118 109 """
119 Ejecuta la operacion "operation" con los argumentos "**kwargs". La operacion puede
110 Ejecuta la operacion "operationConf.name" con los argumentos "**kwargs". La operacion puede
120 111 ser de dos tipos:
121 112
122 113 1. Un metodo propio de esta clase:
@@ -131,16 +122,21 class ProcessingUnit:
131 122
132 123
133 124 con el id de la operacion.
125
126 Input:
127
128 Operation : Objeto del tipo operacion con los atributos: name, type y id.
129
134 130 """
135 131 if self.dataIn.isEmpty():
136 132 return None
137 133
138 if operation.type == 'self':
139 self.callMethod(operation.name, **kwargs)
134 if operationConf.type == 'self':
135 self.callMethod(operationConf.name, **kwargs)
140 136 return
141 137
142 if operation.type == 'other':
143 self.callObject(operation.id, **kwargs)
138 if operationConf.type == 'other':
139 self.callObject(operationConf.id, **kwargs)
144 140 return
145 141
146 142 class Operation():
@@ -185,8 +181,10 class VoltageProc(ProcessingUnit):
185 181
186 182
187 183 def __init__(self):
184
188 185 self.objectDict = {}
189 pass
186 self.dataOut = Voltage()
187
190 188
191 189 def setup(self, dataIn=None, dataOut=None):
192 190
@@ -201,9 +199,6 class VoltageProc(ProcessingUnit):
201 199
202 200 def init(self):
203 201
204 if self.dataIn.isEmpty():
205 return 0
206
207 202 self.dataOut.copy(self.dataIn)
208 203 # No necesita copiar en cada init() los atributos de dataIn
209 204 # la copia deberia hacerse por cada nuevo bloque de datos
General Comments 0
You need to be logged in to leave comments. Login now