def connect(self, other): if isinstance(other, VectorPortRef): # reference to plain VectorPort is implicit append other = other._get_next() if self.peer and not proxy.isproxy(self.peer): print "warning: overwriting port", self, "value", self.peer, "with", other self.peer.peer = None self.peer = other if proxy.isproxy(other): other.set_param_desc(PortParamDesc()) elif isinstance(other, PortRef): if other.peer is not self: other.connect(self) else: raise TypeError, "assigning non-port reference '%s' to port '%s'" % (other, self)
def connect(self, other): if isinstance(other, VectorPortRef): # reference to plain VectorPort is implicit append other = other._get_next() if self.peer and not proxy.isproxy(self.peer): print "warning: overwriting port", self, \ "value", self.peer, "with", other self.peer.peer = None self.peer = other if proxy.isproxy(other): other.set_param_desc(PortParamDesc()) elif isinstance(other, PortRef): if other.peer is not self: other.connect(self) else: raise TypeError, \ "assigning non-port reference '%s' to port '%s'" \ % (other, self)
def unproxy(self, simobj): assert simobj is self.simobj if proxy.isproxy(self.peer): try: realPeer = self.peer.unproxy(self.simobj) except: print "Error in unproxying port '%s' of %s" % (self.name, self.simobj.path()) raise self.connect(realPeer)
def unproxy(self, simobj): assert (simobj is self.simobj) if proxy.isproxy(self.peer): try: realPeer = self.peer.unproxy(self.simobj) except: print "Error in unproxying port '%s' of %s" % \ (self.name, self.simobj.path()) raise self.connect(realPeer)
def clone(self, simobj, memo): if memo.has_key(self): return memo[self] newRef = copy.copy(self) memo[self] = newRef newRef.simobj = simobj assert (isSimObject(newRef.simobj)) if self.peer and not proxy.isproxy(self.peer): peerObj = self.peer.simobj(_memo=memo) newRef.peer = self.peer.clone(peerObj, memo) assert (not isinstance(newRef.peer, VectorPortRef)) return newRef
def clone(self, simobj, memo): if memo.has_key(self): return memo[self] newRef = copy.copy(self) memo[self] = newRef newRef.simobj = simobj assert(isSimObject(newRef.simobj)) if self.peer and not proxy.isproxy(self.peer): peerObj = self.peer.simobj(_memo=memo) newRef.peer = self.peer.clone(peerObj, memo) assert(not isinstance(newRef.peer, VectorPortRef)) return newRef