/// <summary> /// Implementation of ICloneable::Clone - Creates a duplicate of a SensorSession object. /// </summary> /// <returns>SensorSession object</returns> public virtual object Clone() { DatalogSensorSession sensorSession = (DatalogSensorSession)this.MemberwiseClone(); sensorSession.Gas = Gas; sensorSession.ResponseFactor = (ResponseFactor)ResponseFactor.Clone(); // Can't clone Type. Read only value. Just use assignment from memberwiseclone. //sensorSession.Type = (ComponentType)this.Type.Clone(); // Loop through the contained objects calling clone for each one to fill the new lists. sensorSession.ReadingPeriods = new List <DatalogPeriod>(this.ReadingPeriods.Count); foreach (DatalogPeriod period in ReadingPeriods) { sensorSession.ReadingPeriods.Add((DatalogPeriod)period.Clone()); } return(sensorSession); }
/// <summary> /// This method initializes local variables and is called by the constructors of the class. /// </summary> private void Initialize() { this.Alarm = new SensorAlarm(); this.Span = SpanCoef = SpanCoefMin = SpanCoefMax = DomainModelConstant.NullDouble; this.ZeroMax = ZeroMin = ZeroOffset = DomainModelConstant.NullDouble; this.Resolution = DomainModelConstant.NullDouble; this.TemperatureCompHigh = TemperatureCompLow = DomainModelConstant.NullDouble; this.MinTemperature = MaxTemperature = DomainModelConstant.NullInt; this.CalibrationGasConcentration = DomainModelConstant.NullDouble; this.Filter = DomainModelConstant.NullInt; this.Polarity = DomainModelConstant.NullInt; this.OverRange = DomainModelConstant.NullInt; this.DeadBand = DomainModelConstant.NullInt; this.CalibrationTimeout = DomainModelConstant.NullInt; this.GasDetected = string.Empty; this._responseFactor = new ResponseFactor(); this.Type = new SensorType(); this.CalibrationStatus = Status.Unknown; }