示例#1
0
 protected void Send(string port, InformationPacket ip)
 {
     ValidateOutputPortName(port);
     if (!OutPorts[port].TrySend(ip))
     {
         pendingPackets.Enqueue(new PendingPacket(port, ip));
     }
 }
示例#2
0
        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));
        }
示例#3
0
        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);
            }
        }
示例#4
0
 public IpOffer(InformationPacket ip)
 {
     this.ip = ip;
 }
示例#5
0
 public bool TrySend(InformationPacket ip)
 {
     return(TrySend(ip, false));
 }
示例#6
0
 protected bool TrySend(string port, InformationPacket ip)
 {
     ValidateOutputPortName(port);
     return(OutPorts[port].TrySend(ip));
 }
示例#7
0
 public PendingPacket(string port, InformationPacket ip)
 {
     Port = port;
     Ip   = ip;
 }
示例#8
0
 public void SetInitialData(string portName, InformationPacket ip)
 {
     ValidateInputPortName(portName);
     InPorts[portName].SetInitialData(ip);
 }
示例#9
0
 public void SetInitialData(InformationPacket ip)
 {
     initialIp = ip;
 }
示例#10
0
 protected virtual bool ValidatePacketContentType(InformationPacket ip)
 {
     return(true);
 }