コード例 #1
0
ファイル: Library.cs プロジェクト: yuwenpeng/openHistorian
        internal static SortedTreeNodeBase <TKey, TValue> CreateTreeNode <TKey, TValue>(EncodingDefinition encodingMethod, byte level)
            where TKey : SnapTypeBase <TKey>, new()
            where TValue : SnapTypeBase <TValue>, new()
        {
            if ((object)encodingMethod == null)
            {
                throw new ArgumentNullException("encodingMethod");
            }

            if (encodingMethod.IsFixedSizeEncoding)
            {
                return(new FixedSizeNode <TKey, TValue>(level));
            }

            return(new GenericEncodedNode <TKey, TValue>(Encodings.GetEncodingMethod <TKey, TValue>(encodingMethod), level));
        }
コード例 #2
0
ファイル: Library.cs プロジェクト: yuwenpeng/openHistorian
 /// <summary>
 /// Creates a stream encoding from the provided <see cref="encodingMethod"/>.
 /// </summary>
 /// <typeparam name="TKey"></typeparam>
 /// <typeparam name="TValue"></typeparam>
 /// <param name="encodingMethod">the encoding method</param>
 /// <returns></returns>
 internal static StreamEncodingBase <TKey, TValue> CreateStreamEncoding <TKey, TValue>(EncodingDefinition encodingMethod)
     where TKey : SnapTypeBase <TKey>, new()
     where TValue : SnapTypeBase <TValue>, new()
 {
     return(new StreamEncodingGeneric <TKey, TValue>(encodingMethod));
 }