/// <summary> /// Gets the number of bytes needed to store the given edge data type. /// </summary> /// <param name="type">The edge data type.</param> /// <returns>The number of bytes.</returns> /// <exception cref="Exception"></exception> public static int ByteCount(this EdgeDataType type) { switch (type) { case EdgeDataType.Byte: return(1); case EdgeDataType.Int16: case EdgeDataType.UInt16: return(2); case EdgeDataType.UInt32: case EdgeDataType.Int32: return(4); default: throw new Exception($"Unknown data type: {type}"); } }
internal static byte ToByte(this EdgeDataType edgeDataType) { return((byte)edgeDataType); }
/// <summary> /// Creates a new edge data coder. /// </summary> /// <param name="offset">The offset.</param> /// <param name="dataType">The data type.</param> protected EdgeDataCoder(int offset, EdgeDataType dataType) { this.Offset = offset; this.EdgeDataType = dataType; }