Changeset 3607
- Timestamp:
- 05/02/07 15:57:52 (6 years ago)
- Location:
- WaveDev/trunk/WaveDev/wavedev/generate/templates/py_comp
- Files:
-
- 2 modified
-
_sampleComp.py (modified) (1 diff)
-
genStructure.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
WaveDev/trunk/WaveDev/wavedev/generate/templates/py_comp/_sampleComp.py
r3529 r3607 34 34 35 35 def getPort(self, id): 36 if str(id) == "data_in_cs": 37 return self.inPort0_var 38 elif str(id) == "data_out_cs": 39 return self.outPort0_var 40 elif str(id) == "send_timing_report": 41 return self.outPort1_var 42 43 return None 36 __GET_PORT__ 37 38 return None #port not found in available ports list 44 39 45 40 def initialize(self): -
WaveDev/trunk/WaveDev/wavedev/generate/templates/py_comp/genStructure.py
r3605 r3607 120 120 self.writePortDecl(output,comp) 121 121 continue 122 if l_out.find("__GET_PORT__") != -1: 123 self.writeGetPort(output,comp) 124 continue 122 125 123 126 … … 152 155 153 156 154 157 #----------------------------------------------------------------------------------- 155 158 def writePortDecl(output,comp): 156 159 """ This function writes the corba declarations of the ports to the init method""" 157 160 161 #TODO: test this method 162 inCount = 0 163 for p in comp.ports: 164 if p.type == "Provides": 165 ts = " "*8 + "self.inPort" + inCount + '_servant = dataIn_complexShort_i(self, "' + p.name + '")\n' 166 ts = ts + " "*8 + 'self.inPort' + inCount + '_var = self.inPort' + inCount + '_servant._this()\n\n' 167 output.write(ts) 168 inCount += 1 169 170 outCount = 0 171 for p in comp.ports: 172 if p.type == "Uses": 173 ts = " "*8 + 'self.outPort' + outCount + '_servant = dataOut_' + p.interface + '_i(self, "' + p.name + '")\n' 174 ts = ts + " "*8 + 'self.outPort' + outCount + '_var = self.outPort' + outCount + '_servant._this()\n' 175 ts = ts + " "*8 + 'self.outPort' + outCount + '_active = False\n\n' 176 output.write(ts) 177 outCount += 1 178 #---------------------------------------------------------------------------------------- 179 180 #---------------------------------------------------------------------------------------- 181 def writeGetPort(output,comp): 182 #TODO: comment this method 158 183 #TODO: test this method 159 184 inCount = 0 160 185 for p in c.ports: 161 186 if p.type == "Provides": 162 ts = " "*8 + "self.inPort" + inCount + '_servant = dataIn_complexShort_i(self, "' + p.name + '")\n'163 ts = ts + " "* 8 + 'self.inPort' + inCount + '_var = self.inPort' + inCount + '_servant._this()\n\n'187 ts = " "*8 + 'if str(id) == "' + p.name + '":\n' 188 ts = ts + " "*12 + 'return ' + 'self.inPort' + inCount + '_var\n' 164 189 output.write(ts) 165 190 inCount += 1 … … 168 193 for p in c.ports: 169 194 if p.type == "Uses": 170 ts = " "*8 + 'self.outPort' + outCount + '_servant = dataOut_' + p.interface + '_i(self, "' + p.name + '")\n' 171 ts = ts + " "*8 + 'self.outPort' + outCount + '_var = self.outPort' + outCount + '_servant._this()\n' 172 ts = ts + " "*8 + 'self.outPort' + outCount + '_active = False\n\n' 173 output.write(ts) 174 outCount += 1 175 176 177 195 ts = " "*8 + 'if str(id) == "' + p.name + '":\n' 196 ts = ts + " "*12 + 'return ' + 'self.outPort' + outCount + '_var\n' 197 output.write(ts) 198 inCount += 1 199 #---------------------------------------------------------------------------------------- 178 200 179 201 '''