public DataPointCircularQueueDto Read() { DataPointCircularQueueDto dto = this.dto = new DataPointCircularQueueDto(); this.dto.Dao = this; ReadDataPoints(); this.dto = null; return(dto); }
private void CreateEmptyDataPoints(DataPointCircularQueueDto dto) { Debug.Assert(dto.MaxDataPoints >= dto.DataPoints.Length); // Write out the balance of empty data points for (int i = 0; i < dto.MaxDataPoints; i++) { DataPointDto emptyDataPointDto = new DataPointDto(); emptyDataPointDto.Empty = true; emptyDataPointDto.Timestamp = DateTime.Now; emptyDataPointDto.Value = Double.NaN; BinaryFileDataPointDao dataPointDao = new BinaryFileDataPointDao(this.archiveDao); dataPointDao.Write(emptyDataPointDto); this.dataPoints.Add(dataPointDao); } }
private void CreateDataPoints(DataPointCircularQueueDto dto) { // Write the actual data points & any empty data points not yet used this.maxSize = dto.MaxDataPoints; WriteState(); if (dataPointPosition != BinaryFileDao.UnknownOffset) { Writer.Seek((int)this.dataPointPosition, SeekOrigin.Begin); } else { this.dataPointPosition = Writer.BaseStream.Position; } CreateEmptyDataPoints(dto); // The data points that do exist, overwrite the empty data points foreach (DataPointDto dataPointDto in dto.DataPoints) { Push(dataPointDto); } }
public virtual void Create(DataPointCircularQueueDto dataPoints) { SeekEnd(); CreateDataPoints(dataPoints); }