GetTemporaryObjectName() protected static method

Gets the temporary object name for a given object (context and configuration pair) in GME.
protected static GetTemporaryObjectName ( IMgaObject originalObject, IMgaObject configuration ) : string
originalObject IMgaObject Object to get the temporary object name.
configuration IMgaObject Configuration generated from design space.
return string
Esempio n. 1
0
        public override void Expand(CyPhy.ComponentAssembly configuration)
        {
            this.Configuration = configuration;

            if (this.OriginalSystemUnderTest.Referred.DesignEntity.ID == configuration.ID)
            {
                this.expandedTestBenchType = this.testBenchType;
            }
            else
            {
                // create temp folder for test bench
                CyPhy.Testing testing = CyPhyClasses.Testing.Cast(this.testBenchType.ParentContainer.Impl);

                var tempFolderName = AnalysisModelProcessor.GetTemporaryFolderName(this.testBenchType.Impl);

                CyPhy.Testing tempFolder = testing.Children.TestingCollection.FirstOrDefault(x => x.Name == tempFolderName);
                if (tempFolder == null)
                {
                    tempFolder      = CyPhyClasses.Testing.Create(testing);
                    tempFolder.Name = tempFolderName;

                    this.AddToTraceabilityAndTemporary(tempFolder.Impl, testing.Impl, recursive: false);
                }

                // copy test bench
                var tempCopy = (tempFolder.Impl as MgaFolder).CopyFCODisp(this.testBenchType.Impl as MgaFCO);
                // fix name
                tempCopy.Name = AnalysisModelProcessor.GetTemporaryObjectName(this.testBenchType.Impl, configuration.Impl);

                this.AddToTraceabilityAndTemporary(tempCopy, this.testBenchType.Impl);

                // set expanded property to the expanded element
                this.expandedTestBenchType = CyPhyClasses.TestBenchType.Cast(tempCopy);

                var tlsut = this.expandedTestBenchType.Children.TopLevelSystemUnderTestCollection.FirstOrDefault();

                // switch references
                try
                {
                    // redirect SUT
                    var switcher = new ReferenceSwitcher.ReferenceSwitcherInterpreter();
                    switcher.SwitchReference(configuration.Impl as MgaFCO, tlsut.Impl as IMgaReference);
                }
                catch (Exception ex)
                {
                    // handle failures for this (use case we can lose ports/connections/
                    // what if something is an instance/subtype/readonly etc...
                    throw new AnalysisModelExpandFailedException("ReferenceSwitcher failed.", ex);
                }

                // redirect TIPs
                this.SwitchAllTipReferences();
            }
        }
        public override void Expand(CyPhy.ComponentAssembly configuration)
        {
            this.Configuration = configuration;

            if (this.OriginalSystemUnderTest == null)
            {
                // don't need to do anything
            }
            else if (this.OriginalSystemUnderTest.Referred.DesignEntity.ID == configuration.ID)
            {
                this.expandedTestBenchSuite = this.testBenchSuite;
            }
            else
            {
                // create temp folder for test bench suite
                CyPhy.TestBenchSuiteFolder testing = CyPhyClasses.TestBenchSuiteFolder.Cast(this.testBenchSuite.ParentContainer.Impl);

                var tempFolderName = AnalysisModelProcessor.GetTemporaryFolderName(this.testBenchSuite.Impl);

                CyPhy.TestBenchSuiteFolder tempFolder = testing.Children.TestBenchSuiteFolderCollection.FirstOrDefault(x => x.Name == tempFolderName);
                if (tempFolder == null)
                {
                    tempFolder      = CyPhyClasses.TestBenchSuiteFolder.Create(testing);
                    tempFolder.Name = tempFolderName;

                    this.AddToTraceabilityAndTemporary(tempFolder.Impl, testing.Impl, recursive: false);
                }

                // copy test bench suite
                var tempCopy = (tempFolder.Impl as MgaFolder).CopyFCODisp(this.testBenchSuite.Impl as MgaFCO);
                // fix name
                tempCopy.Name = AnalysisModelProcessor.GetTemporaryObjectName(this.testBenchSuite.Impl, configuration.Impl);

                this.AddToTraceabilityAndTemporary(tempCopy, this.testBenchSuite.Impl);

                // set expanded property to the expanded element
                this.expandedTestBenchSuite = CyPhyClasses.TestBenchSuite.Cast(tempCopy);
            }

            // expand all test benches
            foreach (var testBenchRef in this.expandedTestBenchSuite.Children.TestBenchRefCollection)
            {
                var testBenchTypeExpander = new TestBenchTypeProcessor(testBenchRef.Referred.TestBenchType);
                testBenchTypeExpander.Expand(configuration);

                // switch references
                var switcher = new ReferenceSwitcher.ReferenceSwitcherInterpreter();
                // TODO: handle failures for this
                switcher.SwitchReference(testBenchTypeExpander.expandedTestBenchType.Impl as MgaFCO, testBenchRef.Impl as IMgaReference);

                this.InnerExpanders.Push(testBenchTypeExpander);
            }
        }
Esempio n. 3
0
        public override void Expand(CyPhy.ComponentAssembly configuration)
        {
            this.Configuration = configuration;

            // FIXME: this test should be repaired. It does not work correctly if TBs have different SUTs. Be safe and make a copy always
            // if (this.OriginalSystemUnderTest.Referred.DesignEntity.ID == configuration.ID)
            if (false)
            {
                this.expandedParametricExploration = this.parametricExploration;
            }
            else
            {
                // create temp folder for parametric exploration
                CyPhy.ParametricExplorationFolder testing = CyPhyClasses.ParametricExplorationFolder.Cast(this.parametricExploration.ParentContainer.Impl);

                var tempFolderName = AnalysisModelProcessor.GetTemporaryFolderName(this.parametricExploration.Impl);

                CyPhy.ParametricExplorationFolder tempFolder = testing.Children.ParametricExplorationFolderCollection.FirstOrDefault(x => x.Name == tempFolderName);
                if (tempFolder == null)
                {
                    tempFolder      = CyPhyClasses.ParametricExplorationFolder.Create(testing);
                    tempFolder.Name = tempFolderName;

                    this.AddToTraceabilityAndTemporary(tempFolder.Impl, testing.Impl, recursive: false);
                }

                // copy parametric exploration
                var tempCopy = (tempFolder.Impl as MgaFolder).CopyFCODisp(this.parametricExploration.Impl as MgaFCO);
                // fix name
                tempCopy.Name = AnalysisModelProcessor.GetTemporaryObjectName(this.parametricExploration.Impl, configuration.Impl);

                this.AddToTraceabilityAndTemporary(tempCopy, this.parametricExploration.Impl);

                // set expanded property to the expanded element
                this.expandedParametricExploration = CyPhyClasses.ParametricExploration.Cast(tempCopy);
            }

            // expand all test benches
            foreach (var testBenchRef in this.expandedParametricExploration.Children.TestBenchRefCollection)
            {
                var testBenchTypeExpander = new TestBenchTypeProcessor(testBenchRef.Referred.TestBenchType);
                testBenchTypeExpander.Expand(configuration);

                // switch references
                var switcher = new ReferenceSwitcher.ReferenceSwitcherInterpreter();
                // TODO: handle failures for this
                switcher.SwitchReference(testBenchTypeExpander.expandedTestBenchType.Impl as MgaFCO, testBenchRef.Impl as IMgaReference);

                this.InnerExpanders.Push(testBenchTypeExpander);
            }
        }