/// <summary> /// Gets all devices of the given type. /// </summary> /// <typeparam name="TDevice">The device class type.</typeparam> /// <returns>All device instances.</returns> public DeviceCollection <TDevice> GetDevices <TDevice>() where TDevice : Device { var type = DeviceTypeAttribute.GetAcceleratorType(typeof(TDevice)); return(deviceMapping.TryGetValue(type, out var devices) ? new DeviceCollection <TDevice>(devices) : new DeviceCollection <TDevice>(new List <Device>())); }
/// <summary> /// Gets all devices of the given type. /// </summary> /// <typeparam name="TDevice">The device class type.</typeparam> /// <returns>All device instances.</returns> public DeviceCollection <TDevice> GetDevices <TDevice>() where TDevice : Device { var type = DeviceTypeAttribute.GetAcceleratorType(typeof(TDevice)); return(deviceMapping.TryGetValue(type, out var devices) ? new DeviceCollection <TDevice>(devices) : throw new NotSupportedException( RuntimeErrorMessages.NotSupportedTargetAccelerator)); }