public override void Execute() { Packet np = _nameport.Receive(); if (np == null) { return; } _nameport.Close(); string pname = np.Content as string; Drop(np); _outport = (_mother._outputPorts)[pname] as OutputPort; _mother.Trace(Name + ": Accessing output port: " + _outport.Name); _outport.SetSender(this); Packet p; p = Create(Packet.Types.Open, ""); _outport.Send(p); while ((p = _inport.Receive()) != null) { _outport.Send(p); } p = Create(Packet.Types.Close, ""); _outport.Send(p); // outport.close(); _mother.Trace(Name + ": Releasing output port: " + _outport.Name); _outport = null; }
public override void Execute() { Packet np = _nameport.Receive(); if (np == null) { return; } _nameport.Close(); string pname = np.Content as string; Drop(np); _inport = (_mother._inputPorts)[pname] as IInputPort; _mother.Trace(Name + ": Accessing input port: " + _inport.Name); Packet p; // I think this works! Component oldReceiver = _inport.Receiver; if (_inport is InitializationConnection) { InitializationConnection iico = (InitializationConnection)_inport; InitializationConnection iic = new InitializationConnection( iico.Content, this); iic.Name = iico.Name; // iic.network = iico.network; p = iic.Receive(); p.Owner = this; _outport.Send(p); iic.Close(); } else { Connection cnxt = _inport as Connection; cnxt.SetReceiver(this); while ((p = cnxt.Receive()) != null) { p.Owner = this; _outport.Send(p); } // cnxt.setReceiver(oldReceiver); // moved down, as per JavaFBP } // inport.close(); _mother.Trace(Name + ": Releasing input port: " + _inport.Name); _inport.SetReceiver(oldReceiver); // inport = null; }
public override void Execute() { Packet np = _nameport.Receive(); if (np == null) { return; } _nameport.Close(); string pname = np.Content as string; Drop(np); _inport = (_mother._inputPorts)[pname] as IInputPort; _mother.Trace(Name + ": Accessing input port: " + _inport.Name); Packet p; int level = 0; // I think this works! Component oldReceiver = _inport.Receiver; if (_inport is InitializationConnection) { FlowError.Complain("SubinSS cannot support IIP - use Subin"); } Connection cnxt = _inport as Connection; cnxt.SetReceiver(this); while ((p = cnxt.Receive()) != null) { p.Owner = this; if (p.Type == Packet.Types.Open) { if (level == 0) { Drop(p); _network.Trace("{0}: Open bracket detected", Name); } else { _outport.Send(p); } level++; } else if (p.Type == Packet.Types.Close) { level--; if (level == 0) { Drop(p); _network.Trace("{0}: Close bracket detected", Name); } else { _outport.Send(p); } break; } else { _outport.Send(p); } } // inport.close(); _mother.Trace(Name + ": Releasing input port: " + _inport.Name); cnxt.SetReceiver(oldReceiver); // inport = null; }
public override void Execute() { OutputPort subEndPort = null; if (_status != States.Error) { //_network.Trace(this.Name + ": started"); _components.Clear(); //_tracing = _mother._tracing; //_traceFileList = _mother._traceFileList; subEndPort = _outputPorts["*SUBEND"]; try { CallDefine(); bool res = true; foreach (Component comp in _components.Values) { res &= comp.CheckPorts(); } if (!res) { FlowError.Complain("One or more mandatory connections have been left unconnected: " + Name); } _cdl = new CountDownLatch(_components.Count); Initiate(); // activateAll(); // don't do deadlock testing in subnets - you need to consider the whole net! _deadlockTest = false; WaitForAll(); foreach (IInputPort ip in _inputPorts.Values) { if (ip is InitializationConnection) { InitializationConnection ic = (InitializationConnection)ip; ic.Close(); } } /* * Iterator allout = (outputPorts.values()).iterator(); * * while (allout.hasNext()) { * * * OutputPort op = (OutputPort) allout.next(); op.close(); * * } */ // status = Component.StatusValues.TERMINATED; //will not be set if // never activated // mother.indicateTerminated(this); _network.Trace(this.Name + ": closed down"); if (subEndPort != null) { subEndPort.Send(Create(null)); } } catch (FlowError e) { string s = "Flow Error :" + e; Console.Out.WriteLine("Network: " + s); throw e; } } }