Exemplo n.º 1
0
        public void RegisterMembrane(IMembrane membrane)
        {
            Type m = membrane.GetType();

            if (!membranes.ContainsKey(m))
            {
                membranes[m] = membrane;
                membraneReceptorTypes[membrane]     = new List <Type>();
                membraneReceptorInstances[membrane] = new List <IReceptor>();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Register a stateful receptor contained within the specified membrane.
        /// </summary>
        public void Register(IMembrane membrane, IReceptor receptor)
        {
            statefulReceptors.Add(receptor);
            Type ttarget = receptor.GetType();

            MethodInfo[] methods = ttarget.GetMethods();

            foreach (MethodInfo method in methods)
            {
                // TODO: Use attribute, not specific function name.
                if (method.Name == "Process")
                {
                    ParameterInfo[] parameters = method.GetParameters();
                    InstanceNotify(receptor, parameters[2].ParameterType);
                }
            }

            membranes[membrane.GetType()] = membrane;
            membraneReceptorInstances[membrane].Add(receptor);
        }