/// /// Copyright (c) 2013-2015 Sensus Metering Systems /// using System; using System.Collections.Generic; using TBF.Entities; using TBF.BenchControl.Generic; namespace TBF.BenchControl { public class ComponentBase : IComponent { 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 Corrections { get { return cfg.Corrections; } } /// Constructor, components created in this way is used by /// IComponentFactory.DummyComponent() function. Such dummy component should be used /// only for runtime class type identification (e.g. object is iValve) public ComponentBase() { cfg = null; } /// Constructor with configuration as an argument public ComponentBase(IComponentCfg cfg) { if (cfg == null) throw new ArgumentNullException("cfg"); this.cfg = cfg; } /// Empty implementation, might be overriden in derived classes public static void ResetStaticProperties() { } /// Empty implementation, might be overriden in derived classes public virtual void StartChangeHandler() { } /// Empty implementation, might be overriden in derived classes public virtual void StopChangeHandler() { } } }