/// <summary>
        /// This function creates EngineController
        /// </summary>
        /// <param name="libraryServices"> LibraryServices manages builtin libraries and imported libraries.</param>
        /// <param name="geometryFactoryFileName">Path to LibG</param>
        /// <param name="verboseLogging">Bool value, if set to true, enables verbose logging</param>
        public EngineController(LibraryServices libraryServices, string geometryFactoryFileName, bool verboseLogging)
        {
            this.libraryServices           = libraryServices;
            libraryServices.LibraryLoaded += LibraryLoaded;
            CompilationServices            = new CompilationServices(libraryServices.LibraryManagementCore);

            liveRunnerServices = new LiveRunnerServices(this, geometryFactoryFileName);

            liveRunnerServices.ReloadAllLibraries(libraryServices.ImportedLibraries);
            libraryServices.SetLiveCore(LiveRunnerCore);

            codeCompletionServices = new CodeCompletionServices(LiveRunnerCore);

            astBuilder      = new AstBuilder(this);
            syncDataManager = new SyncDataManager();

            VerboseLogging = verboseLogging;
        }
        /// <summary>
        ///     Return a clone of current SyncDataManager.
        /// </summary>
        /// <returns></returns>
        public SyncDataManager Clone()
        {
            SyncDataManager clone = new SyncDataManager();
            foreach (var key in states.Keys)
            {
                clone.states.Add(key, states[key]);
            }

            foreach (var key in nodes.GetKeys())
            {
                var asts = nodes.GetItems(key);
                foreach (var ast in asts)
                {
                    clone.nodes.AddItem(key, ast);
                }
            }
            
            return clone;
        }
Exemple #3
0
        /// <summary>
        ///     Return a clone of current SyncDataManager.
        /// </summary>
        /// <returns></returns>
        public SyncDataManager Clone()
        {
            SyncDataManager clone = new SyncDataManager();

            foreach (var key in states.Keys)
            {
                clone.states.Add(key, states[key]);
            }

            foreach (var key in nodes.GetKeys())
            {
                var asts = nodes.GetItems(key);
                foreach (var ast in asts)
                {
                    clone.nodes.AddItem(key, ast);
                }
            }

            return(clone);
        }
Exemple #4
0
        /// <summary>
        ///  This is called on the main thread from PreviewGraphSyncData
        ///  to generate the list of node id's that will be executed on the next run
        /// </summary>
        /// <param name="updatedNodes">The updated nodes.</param>
        /// <param name="verboseLogging"></param>
        /// <returns>This method returns the list of all reachable node id's from the given
        /// updated nodes</returns>
        internal List<Guid> PreviewGraphSyncData(IEnumerable<NodeModel> updatedNodes, bool verboseLogging)
        {
            if (updatedNodes == null)
                return null;

            var tempSyncDataManager = syncDataManager.Clone();
            var activeNodes = updatedNodes.Where(n => n.State != ElementState.Error);
            if (activeNodes.Any())
            {
                astBuilder.CompileToAstNodes(activeNodes, CompilationContext.PreviewGraph, verboseLogging);
            }

            GraphSyncData graphSyncdata = syncDataManager.GetSyncData();
            List<Guid> previewGraphData = this.liveRunnerServices.PreviewGraph(graphSyncdata, verboseLogging);
            syncDataManager = tempSyncDataManager;

            lock (previewGraphQueue)
            {
                previewGraphQueue.Enqueue(previewGraphData);
            }

            return previewGraphQueue.Dequeue();
        }
Exemple #5
0
        /// <summary>
        /// This function creates EngineController
        /// </summary>
        /// <param name="libraryServices"> LibraryServices manages builtin libraries and imported libraries.</param>
        /// <param name="geometryFactoryFileName">Path to LibG</param>
        /// <param name="verboseLogging">Bool value, if set to true, enables verbose logging</param>
        public EngineController(LibraryServices libraryServices, string geometryFactoryFileName, bool verboseLogging)
        {
            this.libraryServices = libraryServices;
            libraryServices.LibraryLoaded += LibraryLoaded;
            CompilationServices = new CompilationServices(libraryServices.LibraryManagementCore);

            liveRunnerServices = new LiveRunnerServices(this, geometryFactoryFileName);

            liveRunnerServices.ReloadAllLibraries(libraryServices.ImportedLibraries);
            libraryServices.SetLiveCore(LiveRunnerCore);

            codeCompletionServices = new CodeCompletionServices(LiveRunnerCore);

            astBuilder = new AstBuilder(this);
            syncDataManager = new SyncDataManager();

            VerboseLogging = verboseLogging;
        }