示例#1
0
 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.")
     });
示例#2
0
 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;
 }
示例#3
0
        public static IExtendedBuffer CreateExtendedBuffer(NexusDataType dataType, int length)
        {
            var type = typeof(ExtendedBuffer <>).MakeGenericType(new Type[] { NexusUtilities.GetTypeFromNexusDataType(dataType) });

            return((IExtendedBuffer)Activator.CreateInstance(type, length));
        }
示例#4
0
        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));
        }
示例#5
0
 public static int SizeOf(NexusDataType dataType)
 {
     return(NexusUtilities.SizeOf(NexusUtilities.GetTypeFromNexusDataType(dataType)));
 }