예제 #1
0
        // DetermineDevice
        public virtual void DetermineDevice(Plan plan)
        {
            // Recheck the NoDevice flag, as it will be set directly when a device-painted node has indicated not supported
            if (_nodes != null)
            {
                for (int index = 0; index < _nodes.Count; index++)
                {
                    if (_nodes[index].NoDevice)
                    {
                        NoDevice = true;
                        break;
                    }
                }
            }

            if (!NoDevice)
            {
                _device = _potentialDevice;
                if (_device != null)
                {
                    Schema.DevicePlan devicePlan = null;
                    if (ShouldSupport)
                    {
                        plan.EnsureDeviceStarted(_device);
                        devicePlan = _device.Prepare(plan, this);
                    }

                    if (devicePlan != null)
                    {
                        _deviceMessages = devicePlan.TranslationMessages;
                    }

                    if ((devicePlan != null) && devicePlan.IsSupported)
                    {
                        // If the plan could be supported via parameterization, it is not actually supported by the device
                        // and setting the device supported to false ensures that if this node is actually executed, the
                        // device will not be asked to perform a useless parameterization.
                        DeviceSupported = !CouldSupport;
                    }
                    else
                    {
                        if (!_device.IgnoreUnsupported && (DataType != null) && !IgnoreUnsupported && !plan.InTypeOfContext)
                        {
                            if ((devicePlan != null) && !plan.SuppressWarnings)
                            {
                                plan.Messages.Add(new CompilerException(CompilerException.Codes.UnsupportedPlan, CompilerErrorLevel.Warning, _device.Name, SafeEmitStatementAsString(), devicePlan.TranslationMessages.ToString()));
                            }
                        }
                        DeviceSupported = false;
                        NoDevice        = true;
                    }
                }
                else
                {
                    DeviceSupported = false;
                }
            }
            else
            {
                DeviceSupported = false;
            }
        }
예제 #2
0
 public virtual void ClearDeviceNode()
 {
     this._deviceNode     = null;
     this._deviceMessages = null;
 }