//****************************************************************************************************** // SerializableTimeSeriesData.cs - Gbtc // // Copyright © 2012, Grid Protection Alliance. All Rights Reserved. // // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See // the NOTICE file distributed with this work for additional information regarding copyright ownership. // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may // not use this file except in compliance with the License. You may obtain a copy of the License at: // // http://www.opensource.org/licenses/MIT // // Unless agreed to in writing, the subject software distributed under the License is distributed on an // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the // License for the specific language governing permissions and limitations. // // Code Modification History: // ---------------------------------------------------------------------------------------------------- // 08/21/2009 - Pinal C. Patel // Generated original version of source code. // 09/15/2009 - Stephen C. Wills // Added new header and license agreement. // 11/26/2009 - Pinal C. Patel // Removed Namespace from DataContract serialization. // 12/17/2009 - Pinal C. Patel // Updated the serialization definition for XmlSerializer. // 10/11/2010 - Mihir Brahmbhatt // Updated header and license agreement. // 12/14/2012 - Starlynn Danyelle Gilliam // Modified Header. // //****************************************************************************************************** using System; using System.Collections.Generic; using System.Runtime.Serialization; using System.Xml.Serialization; namespace GSF.Historian.DataServices { /// /// Represents a container for s that can be serialized using or . /// /// /// This is the output for serialized using : /// /// /// /// /// /// /// /// /// /// /// /// ]]> /// /// This is the output for serialized using : /// /// /// /// /// 1 /// /// 60.0272522 /// Good /// /// /// 2 /// /// 60.0283241 /// Good /// /// /// 3 /// /// 60.0418167 /// Good /// /// /// 4 /// /// 60.0049438 /// Good /// /// /// 5 /// /// 59.9982834 /// Good /// /// /// /// ]]> /// /// This is the output for serialized using : /// /// { /// "TimeSeriesDataPoints": /// [{"HistorianID":1, /// "Time":"21-Aug-2009 14:37:04.804", /// "Value":59.9637527, /// "Quality":29}, /// {"HistorianID":2, /// "Time":"21-Aug-2009 14:37:04.838", /// "Value":60.0154762, /// "Quality":29}, /// {"HistorianID":3, /// "Time":"21-Aug-2009 14:37:04.872", /// "Value":59.977684, /// "Quality":29}, /// {"HistorianID":3, /// "Time":"21-Aug-2009 14:37:04.906", /// "Value":59.97335, /// "Quality":29}, /// {"HistorianID":5, /// "Time":"21-Aug-2009 14:37:04.940", /// "Value":59.974678, /// "Quality":29}] /// } /// /// /// /// /// /// [XmlType("TimeSeriesData"), DataContract(Name = "TimeSeriesData", Namespace = "")] public class SerializableTimeSeriesData { #region [ Constructors ] /// /// Initializes a new instance of the class. /// public SerializableTimeSeriesData() { } /// /// Initializes a new instance of the class. /// /// List of from which is to be initialized. /// is null. public SerializableTimeSeriesData(IEnumerable dataPoints) : this() { if (dataPoints == null) throw new ArgumentNullException(nameof(dataPoints)); List serializableDataPoints = new List(); foreach (IDataPoint dataPoint in dataPoints) { serializableDataPoints.Add(new SerializableTimeSeriesDataPoint(dataPoint)); } TimeSeriesDataPoints = serializableDataPoints.ToArray(); } #endregion #region [ Properties ] /// /// Gets or sets the s contained in the . /// [XmlArray, DataMember] public SerializableTimeSeriesDataPoint[] TimeSeriesDataPoints { get; set; } #endregion } }