public void setServices(gov.cca.Services services)
        {
            this.services = services;

            Console.WriteLine("---- BEFORE REGISTERING USES PORT {0} {1} {2}", this.ThisFacet, this.Id_unit, this.CID);

            foreach (string portName in PortNames)
            {
                services.registerUsesPort(portName, "", new TypeMapImpl());
            }

            services.addProvidesPort(this, Constants.DEFAULT_PROVIDES_PORT_IMPLEMENTS, this.ClassName, new TypeMapImpl());

            InitializePort initialize_port_wrapper = new InitializePortWrapper(((InitializePort)this).on_initialize, ((InitializePort)this).after_initialize);

            services.addProvidesPort(initialize_port_wrapper, Constants.INITIALIZE_PORT_NAME, Constants.INITIALIZE_PORT_TYPE, new TypeMapImpl());

            ReconfigurationAdvicePort reconfiguration_port_wrapper = new ReconfigurationAdvicePortWrapper(((ReconfigurationAdvicePort)this).changePort);

            services.addProvidesPort(reconfiguration_port_wrapper, Constants.RECONFIGURE_PORT_NAME, Constants.RECONFIGURE_PORT_TYPE, new TypeMapImpl());

            if (Kind == Constants.KIND_COMPUTATION || Kind == Constants.KIND_SYNCHRONIZER || Kind == Constants.KIND_APPLICATION)
            {
                gov.cca.ports.GoPort app_port_wrapper = new GoPortWrapper(((gov.cca.ports.GoPort) this).go, this.GetType());
                services.addProvidesPort(app_port_wrapper, Constants.GO_PORT_NAME, Constants.GO_PORT_TYPE, new TypeMapImpl());
            }
        }
Example #2
0
        void Services.registerUsesPort(string portName, string type, gov.cca.TypeMap properties)
        {
            ComponentID cid_inner = frw.getComponentID(mkPortName(portName));

            if (!(cid_inner is ManagerIgnoredComponentID))
            {
                gov.cca.Services ws = WorkerServices;
                ws.registerUsesPort(portName, type, properties);
            }
            frw.registerUsesPort(mkPortName(portName), type, properties);
        }
        void Services.registerUsesPort(string portName, string type, gov.cca.TypeMap properties)
        {
            ComponentID cid_inner = frw.getComponentID(mkPortName(portName));

            if (!(cid_inner is ManagerIgnoredComponentID))
            {
                int[] nodes = cid.WorkerNodes;
                //for (int i=0; i<nodes.Length; i++)
                foreach (int i in WorkerServices.Keys)
                {
                    gov.cca.Services ws = WorkerServices[i];
                    ws.registerUsesPort(portName, type, properties);
                }
            }
            frw.registerUsesPort(mkPortName(portName), type, properties);
        }