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; } } }
static public SimulationObject BuildObject(ref SimulationModelInfo model, string objectType) { SimulationObject o = new SimulationObject(); if (!model.objectModel.objects.ContainsKey(objectType)) { throw new Exception("Object type doesn't exist"); } foreach (AttributeInfo aInfo in model.objectModel.objects[objectType].attributes.Values) { o[aInfo.name] = DataValueFactory.BuildValue(aInfo.dataType); } o.objectType = objectType; return o; }
static public SimulationObject BuildObject(ref SimulationModelInfo model, string objectType) { SimulationObject o = new SimulationObject(); if (!model.objectModel.objects.ContainsKey(objectType)) { throw new Exception("Object type doesn't exist"); } foreach (AttributeInfo aInfo in model.objectModel.objects[objectType].attributes.Values) { o[aInfo.name] = DataValueFactory.BuildValue(aInfo.dataType); } o.objectType = objectType; return(o); }
public BBObjectInfo(SimulationObject ob) { simObject = ob; id = ((StringValue)ob["ID"]).value; }