/* * SliceRaw.File.PersistentEuChannel.cs * * Copyright © 2009 * Diversified Technical Systems, Inc. * All Rights Reserved */ using System; using DTS.Common.DAS.Concepts; using DTS.Common.Utilities; using DTS.Common.Utilities.DotNetProgrammingConstructs; namespace DTS.Serialization.SliceRaw { public partial class File { public class PersistentEuChannel : ExceptionalList { /// /// Initialize an instance of the DTS.Serialization.SliceRaw.File.PersistentEuChannel class. /// /// /// /// The to be wrapped by this /// "to EU" conversion class. /// /// /// /// The object that defines the conversion from /// ADC to EU for the wrapped data. /// /// public PersistentEuChannel(PersistentChannel persistentChannel, DataScaler scaler) { try { BasePersistentChannel = persistentChannel; EuDataScaler = scaler; } catch (System.Exception ex) { throw new Exception("encountered problem constructing " + GetType().FullName, ex); } } /// /// Get/set the base persistent channel of this EU-ifying wrapper. /// public PersistentChannel BasePersistentChannel { get => _BasePersistentChannel.Value; set => _BasePersistentChannel.Value = value; } private readonly Property _BasePersistentChannel = new Property( typeof(PersistentEuChannel).Namespace + ".PersistentEuChannel.BasePersistentChannel", null, false ); /// /// Get/set the data scaler for converting the ADC data wrapped by this class to EU. /// public DataScaler EuDataScaler { get => _EuDataScaler.Value; set => _EuDataScaler.Value = value; } private readonly Property _EuDataScaler = new Property( typeof(PersistentEuChannel).Namespace + ".PersistentEuChannel.EuDataScaler", null, false ); public double this[ulong i] { get { try { return EuDataScaler.GetEU(BasePersistentChannel[i]); } catch (System.Exception ex) { throw new Exception("encountered problem getting value at index " + i.ToString(), ex); } } set { try { throw new NotSupportedException("SliceRaw::File::PersistentEuChannel::[] values are read-only"); } catch (System.Exception ex) { throw new Exception("encountered problem setting value at index " + i.ToString(), ex); } } } /// /// Get the length of this persistent channel's data. /// public long Length => BasePersistentChannel.Length; /// /// Dispose of this object's Disposables. /// public void Dispose() { try { BasePersistentChannel.Dispose(); } catch (System.Exception ex) { throw new PersistentChannel.Exception("encountered problem disposing of " + GetType().FullName, ex); } } } } }