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
@@ -1,46 +1,36 @@
using TBF.BenchControl.Generic;
using System;
using System.Collections.Generic;
using TBF.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl
{
public class ComponentBase : IComponent
{
Generic.IComponentCfg cfg;
readonly Generic.IComponentCfg cfg;
public Generic.IComponentCfg Cfg { get { return cfg; } }
public string Name { get { return cfg.Name; } }
public string ClassName { get { return cfg.Factory.ClassName; } }
public string ParentName { get { return cfg.ParentName; } }
public Generic.IComponentFactory Factory { get { return cfg.Factory; } }
public int ItemNr { get { return cfg.ItemNr; } }
public Entities.DebugMode DebugLevel { get { return cfg.DebugLevel; } }
public Entities.LogLevel LogLevel { get { return cfg.LogLevel; } }
public IList<MeasurementCorrection> Corrections { get { return cfg.Corrections; } }
/// Constructor
public ComponentBase(Generic.IComponentCfg cfg)
public ComponentBase(IComponentCfg cfg)
{
this.cfg = cfg;
if (cfg == null) throw new ArgumentNullException("cfg");
this.cfg = cfg;
}
public string Name { get { return Cfg.Name; } }
/// <summary>
/// Reference to an object with procedure parameters
/// </summary>
public IParamsProvider ProcedureParams;
///
public void GetProcedureParams(TBF.Entities.Procedure procedure)
{
if (Cfg.Factory.HasProcedureParams)
{
ProcedureParams = TbfComponents.GetProcedureParams(this, procedure);
}
}
/// <summary>
/// Reference to an object with test parameters
/// </summary>
public IParamsProvider TestParams;
///
public void GetTestParams(TBF.Entities.Test test)
{
if (Cfg.Factory.HasTestParams)
{
TestParams = TbfComponents.GetTestParams(this, test);
}
}
/// <summary>
/// Empty implementation, might be overriden in derived classes
/// </summary>
public static void ResetStaticProperties()
{
}
}
}