Everything works OK after serious changes:

- all components, componentCfg-s and parameter providers use base classes
 - less boilerplate code, simpler access to test/procedure parameters from code
 - CreateTestParams(test), CreateProcedureParams(procedure) methods added
 - TestBenchSim class is made static, it is not inheritted by any device anymore
This commit is contained in:
Milan Hanajik
2015-01-02 12:51:27 +01:00
parent 752719bd62
commit 94de991bf6
126 changed files with 1117 additions and 1629 deletions
@@ -93,9 +93,11 @@ namespace TBF.BenchControl
if (cmpntFactory == null) continue;
IComponent cmpnt = cmpntFactory
.ComponentFromCmpntCfg(BenchControl.TbfComponents.CmpntCfgFromCmpntEntity(entity), components);
.ComponentFromCmpntCfg(cmpntFactory.CmpntCfgFromCmpntEntity(entity), components);
///
/// Inherit DebugMode from the parent (if any)
///
if ((cmpnt.Cfg.DebugLevel == Entities.DebugMode.Inherit) &&
(cmpnt.Cfg is IChildComponentCfg) &&
!string.IsNullOrEmpty(cmpnt.Cfg.ParentName))
@@ -140,42 +142,5 @@ namespace TBF.BenchControl
{
return FindComponent(name, StateMachine.Components);
}
public static IParamsProvider GetTestParams(IComponent cmpnt, Entities.Test test)
{
if (cmpnt == null || cmpnt.Cfg == null || !cmpnt.Cfg.Factory.HasTestParams) return null;
/// Search for an existing matching entity
foreach (var tstPrms in test.MoreParams)
{
if (tstPrms.CmpntName.Equals(cmpnt.Cfg.Name)) return cmpnt.Cfg.Factory.GetTestParams(tstPrms);
}
/// Create a new entity and add it to the list test.MoreParams
Entities.ComponentTest testParams = new Entities.ComponentTest { CmpntName = cmpnt.Cfg.Name, Test = test };
test.MoreParams.Add(testParams);
return cmpnt.Cfg.Factory.GetTestParams(testParams);
}
public static IParamsProvider GetProcedureParams(IComponent cmpnt, Entities.Procedure procedure)
{
if (cmpnt == null || cmpnt.Cfg == null || !cmpnt.Cfg.Factory.HasProcedureParams) return null;
/// Search for an existing matching entity
foreach (var procPrms in procedure.MoreParams)
{
if (procPrms.CmpntName.Equals(cmpnt.Cfg.Name))
{
return cmpnt.Cfg.Factory.GetProcedureParams(procPrms);
}
}
/// Create a new entity and add it to the list procedure.MoreParams
Entities.ComponentProcedure procParams = new Entities.ComponentProcedure { CmpntName = cmpnt.Cfg.Name, Procedure = procedure };
procedure.MoreParams.Add(procParams);
return cmpnt.Cfg.Factory.GetProcedureParams(procParams);
}
}
}