Esempio n. 1
0
        private ConcurrentQueue <Cell> CellsQueue; // kolejka Cell

        /* Tworzy węzeł kliencki o danejkonfiguracji */
        public Client(Configuration.NetworkElement networkElement)
        {
            this.AAL      = new AAL();
            this.id       = networkElement.Info.ID;
            this.name     = networkElement.Info.Name;
            this.Log      = new Log();
            this.messages = new ConcurrentQueue <string>();

            Log.Queue.Enqueue(this.id.ToString());

            CellsQueue = new ConcurrentQueue <Cell>();

            List <Configuration.PortInput> inputPorts = networkElement.PortsIn;
            List <int> inputPortsIds = new List <int>();

            foreach (Configuration.PortInput port in inputPorts)
            {
                inputPortsIds.Add(port.Id);
            }
            portsIn = new PortsIn(Receive, this.Log, id, inputPortsIds);

            List <Configuration.PortOutput> outputPorts = networkElement.PortsOut;
            List <int> outputPortsIds = new List <int>();

            foreach (Configuration.PortOutput port in outputPorts)
            {
                outputPortsIds.Add(port.Id);
            }
            portsOut = new PortsOut(this.Log, id, outputPortsIds);
        }
Esempio n. 2
0
        public Switch(Configuration.NetworkElement networkElement)
        {
            id   = networkElement.Info.ID;
            name = networkElement.Info.Name;
            Log  = new Log();

            matrix = new Matrix(this, networkElement);

            List <Configuration.PortInput> inputPorts = networkElement.PortsIn;
            List <int> inputPortsIds = new List <int>();

            foreach (Configuration.PortInput port in inputPorts)
            {
                inputPortsIds.Add(port.Id);
            }
            portsIn = new PortsIn(Commutation, Log, id, inputPortsIds);

            List <Configuration.PortOutput> outputPorts = networkElement.PortsOut;
            List <int> outputPortsIds = new List <int>();

            foreach (Configuration.PortOutput port in outputPorts)
            {
                outputPortsIds.Add(port.Id);
            }
            portsOut = new PortsOut(Log, id, outputPortsIds);
        }