Table of Contents

Class SettingBase<T>

Namespace
Csra.Setting
Assembly
Csra.dll

Base class for all Services.Setup settings.

[Serializable]
public abstract class SettingBase<T> : ISetting

Type Parameters

T

The setting's type.

Inheritance
SettingBase<T>
Implements
Derived
Inherited Members

Fields

_pins

protected List<string> _pins

Field Value

List<string>

_unit

protected string _unit

Field Value

string

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

a T

The first value for the comparison.

b T

The 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

path string

The file system path where the setups will be exported.

Indent(int)

public string Indent(int level)

Parameters

level int

Returns

string

Init(SetupResetTrigger)

Performs the specified initialization to the setting.

public void Init(SetupResetTrigger setupResetTrigger)

Parameters

setupResetTrigger SetupResetTrigger

The trigger event that causes this setting to reset.

ParseEnum<TEnum>(string)

protected static TEnum ParseEnum<TEnum>(string value) where TEnum : struct

Parameters

value string

Returns

TEnum

Type Parameters

TEnum

ReadFunc(string)

protected abstract T[] ReadFunc(string pin)

Parameters

pin string

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

value T

The value to serialize.

Returns

string

The string representation of value.

SetAction(string, T)

protected abstract void SetAction(string pinList, T value)

Parameters

pinList string
value T

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

value T

The value to call setAction.

key string

A 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

value T

The target value of this setting.

pinList string
hasPins bool

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

initValue T

The value this setting is being initialized to by the system.

unit string

The unit string for the setting's value.

setupResetTrigger SetupResetTrigger

The event that initialization of this setting in the system.

doubleReadCompare bool

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

value T

The new value (typically what the hardware has manually be set to).

pinList string
cache Dictionary<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

readFuncDefined bool
staticCache Dictionary<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()