public static Type GetTypeFromNexusDataType(NexusDataType dataType) { return(dataType switch { NexusDataType.BOOLEAN => typeof(bool), NexusDataType.UINT8 => typeof(Byte), NexusDataType.INT8 => typeof(SByte), NexusDataType.UINT16 => typeof(UInt16), NexusDataType.INT16 => typeof(Int16), NexusDataType.UINT32 => typeof(UInt32), NexusDataType.INT32 => typeof(Int32), NexusDataType.UINT64 => typeof(UInt64), NexusDataType.INT64 => typeof(Int64), NexusDataType.FLOAT32 => typeof(Single), NexusDataType.FLOAT64 => typeof(Double), _ => throw new NotSupportedException($"The specified data type '{dataType}' is not supported.") });
public ChannelDescription(Guid guid, string channelName, string datasetName, string group, NexusDataType dataType, SampleRateContainer sampleRate, string unit, BufferType bufferType) { this.Guid = guid; this.ChannelName = channelName; this.DatasetName = datasetName; this.Group = group; this.DataType = dataType; this.SampleRate = sampleRate; this.Unit = unit; this.BufferType = bufferType; }
public static IExtendedBuffer CreateExtendedBuffer(NexusDataType dataType, int length) { var type = typeof(ExtendedBuffer <>).MakeGenericType(new Type[] { NexusUtilities.GetTypeFromNexusDataType(dataType) }); return((IExtendedBuffer)Activator.CreateInstance(type, length)); }
private ChannelDescription CreateChannelDescription(string channelName, string group, NexusDataType dataType, SampleRateContainer sampleRate, string unit) { var guid = Guid.NewGuid(); var datasetName = sampleRate.ToUnitString(); return(new ChannelDescription(guid, channelName, datasetName, group, dataType, sampleRate, unit, BufferType.Simple)); }
public static int SizeOf(NexusDataType dataType) { return(NexusUtilities.SizeOf(NexusUtilities.GetTypeFromNexusDataType(dataType))); }