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