Ejemplo n.º 1
0
        public SimulationObjectProxy GetObjectProxy(string objectID)
        {
            SimulationObjectProxy proxy = null;
            string key = null;
            DataValueProxy dvProx = null;

            lock (blackboard.blackboardLock)
            {
                BBObjectInfo ob = blackboard.objects[objectID];
                proxy = new SimulationObjectProxy(ob.simObject.objectType);
                foreach (string attname in ob.simObject.attributes.Keys)
                {
                    //key = ob.simObject.objectType + "." + attname;
                    key = String.Format("{0}.{1}", ob.simObject.objectType, attname);
                    if (blackboard.subscriptions[id].ContainsKey(key))
                    {
                        dvProx = new DataValueProxy(ref blackboard, ob.id, attname, blackboard.subscriptions[id][key].publish);
                        proxy[attname] = dvProx;
                    }
                }
                if (proxy.Count() == 0)
                {
                    proxy = null;
                }
            }

            return proxy;
        }
Ejemplo n.º 2
0
        public void AddObject(SimulationObject ob)
        {
            lock (blackboardLock)
            {
                BBObjectInfo bbob = new BBObjectInfo(ob);
                if (objects.ContainsKey(bbob.id))
                {
                    throw new Exception("Blackboard:  Error, trying to add object that already exists!");
                }
                else
                {
                    objects[bbob.id] = bbob;
                }
            }

        }