public static ICarrier CreateCarrier(ReceptorsContainer rsys, string protocol, Action<dynamic> initializeSignal) { ISemanticTypeStruct outprotocol = rsys.SemanticTypeSystem.GetSemanticTypeStruct(protocol); dynamic outsignal = rsys.SemanticTypeSystem.Create(protocol); initializeSignal(outsignal); ICarrier carrier = new Carrier(outprotocol, "", outsignal, null); return carrier; }
public Membrane(ISemanticTypeSystem sts) { receptorSystem = new ReceptorsContainer(sts); SemanticTypeSystem = sts; receptorSystem.NewReceptor += OnNewReceptor; receptorSystem.NewCarrier += OnNewCarrier; receptorSystem.ReceptorRemoved += OnReceptorRemoved; Membranes = new List <IMembrane>(); ProtocolPermeability = new Dictionary <PermeabilityKey, PermeabilityConfiguration>(); }
public Membrane(ISemanticTypeSystem sts, IApplicationController appController) { receptorSystem = new ReceptorsContainer(sts, this); SemanticTypeSystem = sts; ApplicationController = appController; receptorSystem.NewReceptor += OnNewReceptor; receptorSystem.NewCarrier += OnNewCarrier; receptorSystem.ReceptorRemoved += OnReceptorRemoved; Membranes = new List<IMembrane>(); ProtocolPermeability = new Dictionary<PermeabilityKey, PermeabilityConfiguration>(); }
public void MoveReceptorTo(IReceptor receptor, ReceptorsContainer target) { InternalRemove(receptor); target.InternalAdd(receptor); }
protected void InitializeSDRTests(Action initStructs) { // Initialize the Semantic Type System. ssys = new STS(); // Initialize the Receptor System rsys = new ReceptorsContainer(ssys); // Initialize declaration and structure lists. decls = new List<SemanticTypeDecl>(); structs = new List<SemanticTypeStruct>(); // We must have a noun definition for now. Helpers.InitializeNoun(ssys, decls, structs); // We need this ST for query tests. SemanticTypeStruct sts = Helpers.CreateSemanticType("Query", false, decls, structs); Helpers.CreateNativeType(sts, "QueryText", "string", false); Helpers.CreateNativeType(sts, "Param0", "Object", false); // Initialize the Semantic Database Receptor sdr = new SemanticDatabase(rsys); sdr.DatabaseName = "test_semantic_database"; sdr.Connect(); // Create our semantic structure. initStructs(); // Instantiate the runtime code-behind. ssys.Parse(decls, structs); string code = ssys.GenerateCode(); System.Reflection.Assembly assy = Compiler.Compile(code); ssys.CompiledAssembly = assy; }