PageRenderTime 39ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/Main/Source/Libraries/openHistorian.Core/Snap/Old/Tree/HistorianFixedSizeCombinedEncoding`2.cs

#
C# | 229 lines | 0 code | 14 blank | 215 comment | 0 complexity | 466d2a2ea4f5ecd3da56d58e06443c38 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, EPL-1.0
  1. ////******************************************************************************************************
  2. //// HistorianFixedSizeCombinedEncoding.cs - Gbtc
  3. ////
  4. //// Copyright © 2014, Grid Protection Alliance. All Rights Reserved.
  5. ////
  6. //// Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
  7. //// the NOTICE file distributed with this work for additional information regarding copyright ownership.
  8. //// The GPA licenses this file to you under the Eclipse Public License -v 1.0 (the "License"); you may
  9. //// not use this file except in compliance with the License. You may obtain a copy of the License at:
  10. ////
  11. //// http://www.opensource.org/licenses/eclipse-1.0.php
  12. ////
  13. //// Unless agreed to in writing, the subject software distributed under the License is distributed on an
  14. //// "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
  15. //// License for the specific language governing permissions and limitations.
  16. ////
  17. //// Code Modification History:
  18. //// ----------------------------------------------------------------------------------------------------
  19. //// 02/21/2014 - Steven E. Chisholm
  20. //// Generated original version of source code.
  21. ////
  22. ////******************************************************************************************************
  23. //using System;
  24. //using GSF.IO;
  25. //using GSF.Snap;
  26. //using GSF.Snap.Encoding;
  27. //namespace openHistorian.Snap.Encoding
  28. //{
  29. // /// <summary>
  30. // /// An encoding method that is fixed in size and calls the native read/write functions of the specified type.
  31. // /// </summary>
  32. // /// <remarks>
  33. // /// This class overrides the default fixed size encoding method for speed improvements.
  34. // /// </remarks>
  35. // public class HistorianFixedSizeCombinedEncoding
  36. // : CombinedEncodingBase<HistorianKey, HistorianValue>
  37. // {
  38. // int m_keySize;
  39. // int m_valueSize;
  40. // /// <summary>
  41. // /// Creates a new class
  42. // /// </summary>
  43. // public HistorianFixedSizeCombinedEncoding()
  44. // {
  45. // m_keySize = 24;
  46. // m_valueSize = 24;
  47. // }
  48. // /// <summary>
  49. // /// Gets the encoding method that this class implements.
  50. // /// </summary>
  51. // public override EncodingDefinition EncodingMethod
  52. // {
  53. // get
  54. // {
  55. // return CombinedEncodingDefinitionFixedSize.TypeGuid;
  56. // }
  57. // }
  58. // /// <summary>
  59. // /// Gets if the previous key will need to be presented to the encoding algorithms to
  60. // /// property encode the next sample. Returning false will cause nulls to be passed
  61. // /// in a parameters to the encoding.
  62. // /// </summary>
  63. // public override bool UsesPreviousKey
  64. // {
  65. // get
  66. // {
  67. // return false;
  68. // }
  69. // }
  70. // /// <summary>
  71. // /// Gets if the previous value will need to be presented to the encoding algorithms to
  72. // /// property encode the next sample. Returning false will cause nulls to be passed
  73. // /// in a parameters to the encoding.
  74. // /// </summary>
  75. // public override bool UsesPreviousValue
  76. // {
  77. // get
  78. // {
  79. // return false;
  80. // }
  81. // }
  82. // /// <summary>
  83. // /// Gets the maximum amount of space that is required for the compression algorithm. This
  84. // /// prevents lower levels from having overflows on the underlying streams. It is critical
  85. // /// that this value be correct. Error on the side of too large of a value as a value
  86. // /// too small will corrupt data and be next to impossible to track down the point of corruption
  87. // /// </summary>
  88. // public override int MaxCompressionSize
  89. // {
  90. // get
  91. // {
  92. // return m_keySize + m_valueSize;
  93. // }
  94. // }
  95. // /// <summary>
  96. // /// Gets if the stream supports a symbol that
  97. // /// represents that the end of the stream has been encountered.
  98. // /// </summary>
  99. // /// <remarks>
  100. // /// An example of a symbol would be the byte code 0xFF.
  101. // /// In this case, if the first byte of the
  102. // /// word is 0xFF, the encoding has specifically
  103. // /// designated this as the end of the stream. Therefore, calls to
  104. // /// Decompress will result in an end of stream exception.
  105. // ///
  106. // /// Failing to reserve a code as the end of stream will mean that
  107. // /// streaming points will include its own symbol to represent the end of the
  108. // /// stream, taking 1 extra byte per point encoded.
  109. // /// </remarks>
  110. // public override bool ContainsEndOfStreamSymbol
  111. // {
  112. // get
  113. // {
  114. // return false;
  115. // }
  116. // }
  117. // /// <summary>
  118. // /// The byte code to use as the end of stream symbol.
  119. // /// May throw NotSupportedException if <see cref="CombinedEncodingBase{TKey,TValue}.ContainsEndOfStreamSymbol"/> is false.
  120. // /// </summary>
  121. // public override byte EndOfStreamSymbol
  122. // {
  123. // get
  124. // {
  125. // throw new NotSupportedException();
  126. // }
  127. // }
  128. // /// <summary>
  129. // /// Encodes <see cref="key"/> and <see cref="value"/> to the provided <see cref="stream"/>.
  130. // /// </summary>
  131. // /// <param name="stream">where to write the data</param>
  132. // /// <param name="prevKey">the previous key if required by <see cref="CombinedEncodingBase{TKey,TValue}.UsesPreviousKey"/>. Otherwise null.</param>
  133. // /// <param name="prevValue">the previous value if required by <see cref="CombinedEncodingBase{TKey,TValue}.UsesPreviousValue"/>. Otherwise null.</param>
  134. // /// <param name="key">the key to encode</param>
  135. // /// <param name="value">the value to encode</param>
  136. // /// <returns>the number of bytes necessary to encode this key/value.</returns>
  137. // public override void Encode(BinaryStreamBase stream, HistorianKey prevKey, HistorianValue prevValue, HistorianKey key, HistorianValue value)
  138. // {
  139. // stream.Write(key.Timestamp);
  140. // stream.Write(key.PointID);
  141. // stream.Write(key.EntryNumber);
  142. // stream.Write(value.Value1);
  143. // stream.Write(value.Value2);
  144. // stream.Write(value.Value3);
  145. // }
  146. // /// <summary>
  147. // /// Decodes <see cref="key"/> and <see cref="value"/> from the provided <see cref="stream"/>.
  148. // /// </summary>
  149. // /// <param name="stream">where to read the data</param>
  150. // /// <param name="prevKey">the previous key if required by <see cref="CombinedEncodingBase{TKey,TValue}.UsesPreviousKey"/>. Otherwise null.</param>
  151. // /// <param name="prevValue">the previous value if required by <see cref="CombinedEncodingBase{TKey,TValue}.UsesPreviousValue"/>. Otherwise null.</param>
  152. // /// <param name="key">the place to store the decoded key</param>
  153. // /// <param name="value">the place to store the decoded value</param>
  154. // /// <param name="isEndOfStream">outputs true if the end of the stream symbol is detected. Not all encoding methods have an end of stream symbol and therefore will always return false.</param>
  155. // /// <returns>the number of bytes necessary to decode the next key/value.</returns>
  156. // public override void Decode(BinaryStreamBase stream, HistorianKey prevKey, HistorianValue prevValue, HistorianKey key, HistorianValue value, out bool isEndOfStream)
  157. // {
  158. // isEndOfStream = false;
  159. // key.Timestamp = stream.ReadUInt64();
  160. // key.PointID = stream.ReadUInt64();
  161. // key.EntryNumber = stream.ReadUInt64();
  162. // value.Value1 = stream.ReadUInt64();
  163. // value.Value2 = stream.ReadUInt64();
  164. // value.Value3 = stream.ReadUInt64();
  165. // }
  166. // /// <summary>
  167. // /// Decodes <see cref="key"/> and <see cref="value"/> from the provided <see cref="stream"/>.
  168. // /// </summary>
  169. // /// <param name="stream">where to read the data</param>
  170. // /// <param name="prevKey">the previous key if required by <see cref="CombinedEncodingBase{TKey,TValue}.UsesPreviousKey"/>. Otherwise null.</param>
  171. // /// <param name="prevValue">the previous value if required by <see cref="CombinedEncodingBase{TKey,TValue}.UsesPreviousValue"/>. Otherwise null.</param>
  172. // /// <param name="key">the place to store the decoded key</param>
  173. // /// <param name="value">the place to store the decoded value</param>
  174. // /// <param name="isEndOfStream">outputs true if the end of the stream symbol is detected. Not all encoding methods have an end of stream symbol and therefore will always return false.</param>
  175. // /// <returns>the number of bytes necessary to decode the next key/value.</returns>
  176. // public override unsafe int Decode(byte* stream, HistorianKey prevKey, HistorianValue prevValue, HistorianKey key, HistorianValue value, out bool isEndOfStream)
  177. // {
  178. // isEndOfStream = false;
  179. // key.Timestamp = *(ulong*)stream;
  180. // key.PointID = *(ulong*)(stream + 8);
  181. // key.EntryNumber = *(ulong*)(stream + 16);
  182. // value.Value1 = *(ulong*)(stream + 24);
  183. // value.Value2 = *(ulong*)(stream + 32);
  184. // value.Value3 = *(ulong*)(stream + 40);
  185. // return 48;
  186. // }
  187. // /// <summary>
  188. // /// Encodes <see cref="key"/> and <see cref="value"/> to the provided <see cref="stream"/>.
  189. // /// </summary>
  190. // /// <param name="stream">where to write the data</param>
  191. // /// <param name="prevKey">the previous key if required by <see cref="CombinedEncodingBase{TKey,TValue}.UsesPreviousKey"/>. Otherwise null.</param>
  192. // /// <param name="prevValue">the previous value if required by <see cref="CombinedEncodingBase{TKey,TValue}.UsesPreviousValue"/>. Otherwise null.</param>
  193. // /// <param name="key">the key to encode</param>
  194. // /// <param name="value">the value to encode</param>
  195. // /// <returns>the number of bytes necessary to encode this key/value.</returns>
  196. // public override unsafe int Encode(byte* stream, HistorianKey prevKey, HistorianValue prevValue, HistorianKey key, HistorianValue value)
  197. // {
  198. // *(ulong*)stream = key.Timestamp;
  199. // *(ulong*)(stream + 8) = key.PointID;
  200. // *(ulong*)(stream + 16) = key.EntryNumber;
  201. // *(ulong*)(stream + 24) = value.Value1;
  202. // *(ulong*)(stream + 32) = value.Value2;
  203. // *(ulong*)(stream + 40) = value.Value3;
  204. // return 48;
  205. // }
  206. // /// <summary>
  207. // /// Clones this encoding method.
  208. // /// </summary>
  209. // /// <returns>A clone</returns>
  210. // public override CombinedEncodingBase<HistorianKey, HistorianValue> Clone()
  211. // {
  212. // return new HistorianFixedSizeCombinedEncoding();
  213. // }
  214. // }
  215. //}