protected void Send(string port, InformationPacket ip) { ValidateOutputPortName(port); if (!OutPorts[port].TrySend(ip)) { pendingPackets.Enqueue(new PendingPacket(port, ip)); } }
public bool TrySend(InformationPacket ip, bool ignoreClosed) { if (!ignoreClosed && Closed) { throw new InvalidOperationException(string.Format("Cannot send data on closed port '{0}.{1}'", Process.Name, Name)); } if (!Connected) { throw new InvalidOperationException(string.Format("Cannot send data on unconnected port '{0}.{1}'", Process.Name, Name)); } return(!connectedPort.Closed && connectedPort.TrySend(ip)); }
public bool TrySend(InformationPacket ip) { if (Closed) { throw new InvalidOperationException(string.Format("Cannot send data to a closed port '{0}.{1}'", Process.Name, Name)); } lock (lockObject) { if (queue.Count < ConnectionCapacity) { // check packet contents for type if a type restriction exists if (ValidatePacketContentType(ip)) { queue.Enqueue(ip); return(true); } throw new ArgumentException(string.Format("IP content of type {0} is not valid due to the Input port's type restriction, valid types are {1}", ip.Content.GetType(), ValidTypeDescription)); } return(false); } }
public IpOffer(InformationPacket ip) { this.ip = ip; }
public bool TrySend(InformationPacket ip) { return(TrySend(ip, false)); }
protected bool TrySend(string port, InformationPacket ip) { ValidateOutputPortName(port); return(OutPorts[port].TrySend(ip)); }
public PendingPacket(string port, InformationPacket ip) { Port = port; Ip = ip; }
public void SetInitialData(string portName, InformationPacket ip) { ValidateInputPortName(portName); InPorts[portName].SetInitialData(ip); }
public void SetInitialData(InformationPacket ip) { initialIp = ip; }
protected virtual bool ValidatePacketContentType(InformationPacket ip) { return(true); }