Class SettingBase<T>
Base class for all Services.Setup settings.
[Serializable]
public abstract class SettingBase<T> : ISetting
Type Parameters
TThe setting's type.
- Inheritance
-
SettingBase<T>
- Implements
- Derived
- Inherited Members
Fields
_pins
protected List<string> _pins
Field Value
_unit
protected string _unit
Field Value
Methods
Apply()
Applies the setting to the hardware, in case and only for those pins that need it.
public void Apply()
CompareValue(T, T)
Compares two values of the setting's type. Override if special treatment is needed.
protected virtual bool CompareValue(T a, T b)
Parameters
aTThe first value for the comparison.
bTThe second value for the comparision.
Returns
- bool
Returns 'true' if equal; otherwise false.
Diff()
Reads the hardware state and compares it to the setting/cached value. Target and actual status are output.
public void Diff()
Dump()
Dumps the setting to the log output target.
public void Dump()
Export(string)
Exports the setting to a file at the specified path. The file format is implementation specific, but should be human readable.
public void Export(string path)
Parameters
pathstringThe file system path where the setups will be exported.
Indent(int)
public string Indent(int level)
Parameters
levelint
Returns
Init(SetupResetTrigger)
Performs the specified initialization to the setting.
public void Init(SetupResetTrigger setupResetTrigger)
Parameters
setupResetTriggerSetupResetTriggerThe trigger event that causes this setting to reset.
ParseEnum<TEnum>(string)
protected static TEnum ParseEnum<TEnum>(string value) where TEnum : struct
Parameters
valuestring
Returns
- TEnum
Type Parameters
TEnum
ReadFunc(string)
protected abstract T[] ReadFunc(string pin)
Parameters
pinstring
Returns
- T[]
SerializeValue(T)
Serializes the setting's value to a string. Override if special treatment is needed.
protected virtual string SerializeValue(T value)
Parameters
valueTThe value to serialize.
Returns
- string
The string representation of value.
SetAction(string, T)
protected abstract void SetAction(string pinList, T value)
Parameters
pinListstringvalueT
SetArguments(T, string)
Hands the setting's argument parameters to the base class. Typically used for custom settings.
protected void SetArguments(T value, string key)
Parameters
valueTThe value to call setAction.
keystringA key to feed the cache.
SetArguments(T, string, bool)
Hands the setting's argument parameters to the base class. Typically used for instrument-related settings with or without pin relation.
protected void SetArguments(T value, string pinList, bool hasPins)
Parameters
SetBehavior(T, string, SetupResetTrigger, bool)
Hands the setting's behavior parameters to the base class.
protected void SetBehavior(T initValue, string unit, SetupResetTrigger setupResetTrigger, bool doubleReadCompare)
Parameters
initValueTThe value this setting is being initialized to by the system.
unitstringThe unit string for the setting's value.
setupResetTriggerSetupResetTriggerThe event that initialization of this setting in the system.
doubleReadComparebool
SetCacheInternal(T, string, Dictionary<string, T>)
Updates the value for specified pins in the cache. Used to make SetupService aware of manual hardware changes.
protected static void SetCacheInternal(T value, string pinList, Dictionary<string, T> cache)
Parameters
valueTThe new value (typically what the hardware has manually be set to).
pinListstringcacheDictionary<string, T>A reference to that static cache object per setting.
SetContext(bool, Dictionary<string, T>)
Hands the setting's context parameters to the base class.
protected void SetContext(bool readFuncDefined, Dictionary<string, T> staticCache)
Parameters
readFuncDefinedboolstaticCacheDictionary<string, T>The handle to the static cache object for the setting's type.
ToString()
Gets a string representation of the setting in a human-readable form.
public override string ToString()
Returns
- string
The string representation.
Validate()
Validates the setting's value. Override needed per setting.
public virtual void Validate()