/// <summary> /// Loads and analyzes an assembly without the help of any package manager or server. /// </summary> public void LoadAssemblyManual(Assembly assembly) { Type entityImplementationType = typeof(EntityImplementationAttribute); foreach (Type t in assembly.GetTypes()) { object instance = null; object[] eias = t.GetCustomAttributes(entityImplementationType, false); if (eias.Length > 0) { if (instance == null) { instance = Activator.CreateInstance(t); } IArchitectureFactory builder = instance as IArchitectureFactory; if (builder != null) { foreach (EntityImplementationAttribute attr in eias) { Entity e; if (entityTable.TryGetValue(attr.EntityId, out e)) { archTable.AddArchitectureBuilder(e, builder); } } } } } }
public bool TryLookupArchitecture(Port port, out IArchitectureFactory architecture) { architecture = null; EntityArchitecturesRelation relation; return(_architectures.TryGetValue(port.Entity.EntityId, out relation) && relation.TryLookupArchitectureFor(port, out architecture)); }
public void AddArchitecture(IArchitectureFactory factory) { if (factory == null) { throw new ArgumentNullException("factory"); } _architectures.Add(factory); }
public Entity PublishToLibrary(string domain, string architectureLabel, string entityLabel, string entitySymbol) { Entity entity = BuildEntity(new MathIdentifier(entityLabel, domain), entitySymbol); IArchitectureFactory factory = BuildArchitectureFactory(new MathIdentifier(architectureLabel, domain), entity.EntityId); _context.Library.Entities.Add(entity); _context.Library.Architectures.AddArchitectureBuilder(factory); return(entity); }
public static Entity PublishToLibrary(string xml, Library library, string domain, string architectureLabel, string entityLabel, string entitySymbol) { Entity entity = ReadXmlEntity(xml, new MathIdentifier(entityLabel, domain), entitySymbol); IArchitectureFactory factory = BuildArchitectureFactory(xml, new MathIdentifier(architectureLabel, domain), entity.EntityId, entity.InputSignals.Length, entity.OutputSignals.Length, entity.Buses.Length); library.Entities.Add(entity); library.Architectures.AddArchitectureBuilder(factory); return(entity); }
public IEntity PublishToLibrary(string domain, string architectureLabel, string entityLabel, string entitySymbol) { IEntity entity = BuildEntity(new MathIdentifier(entityLabel, domain), entitySymbol); IArchitectureFactory factory = BuildArchitectureFactory(new MathIdentifier(architectureLabel, domain), entity.EntityId); ILibrary lib = Service <ILibrary> .Instance; lib.AddEntity(entity); lib.AddArchitecture(factory); return(entity); }
public static void PublishToLibrary(string xml, ILibrary library, MathIdentifier architectureId, MathIdentifier entityId) { if (library == null) { throw new ArgumentNullException("library"); } IArchitectureFactory factory = BuildArchitectureFactory(xml, architectureId, entityId); library.AddArchitecture(factory); }
public IArchitectureFactory LookupArchitecture(Port port) { ReadOnlyCollection <IArchitectureFactory> entry = archTable.LookupEntity(port.Entity); for (int i = 0; i < entry.Count; i++) { IArchitectureFactory factory = entry[i]; if (factory.SupportsPort(port)) { return(factory); } } throw new MathNet.Symbolics.Backend.Exceptions.ArchitectureNotAvailableException(port); }
public static IEntity PublishToLibrary(string xml, ILibrary library, string domain, string architectureLabel, string entityLabel, string entitySymbol) { if (library == null) { throw new ArgumentNullException("library"); } IEntity entity = ReadXmlEntity(xml, new MathIdentifier(entityLabel, domain), entitySymbol); IArchitectureFactory factory = BuildArchitectureFactory(xml, new MathIdentifier(architectureLabel, domain), entity.EntityId, entity.InputSignals.Length, entity.OutputSignals.Length, entity.Buses.Length); library.AddEntity(entity); library.AddArchitecture(factory); return(entity); }
public void Add(IArchitectureFactory architecture) { EntityArchitecturesRelation relation; if (!TryGetValue(architecture.EntityId, out relation)) { relation = new EntityArchitecturesRelation(architecture.EntityId); Add(relation); } if (!relation.Architectures.Contains(architecture)) { relation.Architectures.Add(architecture); } }
public bool ContainsArchitecture(Port port) { if (!archTable.ContainsEntity(port.Entity)) { return(false); } ReadOnlyCollection <IArchitectureFactory> entry = archTable.LookupEntity(port.Entity); for (int i = 0; i < entry.Count; i++) { IArchitectureFactory factory = entry[i]; if (factory.SupportsPort(port)) { return(true); } } return(false); }
public void Remove(IArchitectureFactory architecture) { EntityArchitecturesRelation relation; if (!TryGetValue(architecture.EntityId, out relation)) { return; } int idx = relation.Architectures.IndexOf(architecture); // Remove Factory-entry in the table of this entity if (idx >= 0) { relation.Architectures.RemoveAt(idx); } // Remove Entity if no more Architecture-entry if (relation.Architectures.Count == 0) { Remove(relation.EntityId); } }
public void AddArchitectureBuilder(Entity entity, IArchitectureFactory factory) { AddArchitectureBuilder(entity.EntityId, factory); }
public bool TryLookupArchitectureFor(Port port, out IArchitectureFactory architecture) { architecture = _architectures.Find(delegate(IArchitectureFactory factory) { return(factory.SupportsPort(port)); }); return(architecture != null); }
public static void PublishToLibrary(string xml, Library library, MathIdentifier architectureId, MathIdentifier entityId) { IArchitectureFactory factory = BuildArchitectureFactory(xml, architectureId, entityId); library.Architectures.AddArchitectureBuilder(factory); }
public void AddArchitectureBuilder(MathIdentifier entityId, IArchitectureFactory factory) { AddEntity(entityId).Add(factory); }
public void PublishToLibrary(MathIdentifier architectureId, MathIdentifier entityId) { IArchitectureFactory factory = BuildArchitectureFactory(architectureId, entityId); _context.Library.Architectures.AddArchitectureBuilder(factory); }
public void AddArchitectureBuilder(IArchitectureFactory factory) { AddEntity(factory.EntityId).Add(factory); }
public void PublishToLibrary(MathIdentifier architectureId, MathIdentifier entityId) { IArchitectureFactory factory = BuildArchitectureFactory(architectureId, entityId); Service <ILibrary> .Instance.AddArchitecture(factory); }
public bool TryLookupArchitectureFor(Port port, out IArchitectureFactory architecture) { architecture = _architectures.Find(delegate(IArchitectureFactory factory) { return factory.SupportsPort(port); }); return architecture != null; }