Beispiel #1
0
        private Axes(StepInstrution x, StepInstrution y, StepInstrution u, StepInstrution v)
        {
            InstructionX = x;
            InstructionY = y;
            InstructionU = u;
            InstructionV = v;

            //check instruction compatibility
            Type detectedType = null;

            foreach (var instruction in new[] { InstructionX, InstructionY, InstructionU, InstructionV })
            {
                if (instruction == null)
                {
                    continue;
                }

                if (detectedType == null)
                {
                    detectedType = instruction.GetType();
                }

                if (instruction.GetType() != detectedType)
                {
                    throw new NotSupportedException("All combined instructions must have same type.");
                }
            }

            if (detectedType == null)
            {
                throw new NullReferenceException("At least one axis has to be set by instruction.");
            }
        }
Beispiel #2
0
        /// <summary>
        /// Registers current instruction for estimation.
        /// </summary>
        internal void RegisterInstruction(StepInstrution instruction)
        {
            if (_currentInstruction == instruction)
            {
                //there is nothing to do
                return;
            }

            _currentInstruction = instruction;
            _timingIndex        = 0;
            _timingSum          = 0;
            _stepTimings        = new int[0];
            if (_currentInstruction == null)
            {
                //null instruction - reset buffers only
                return;
            }

            _stepTimings = instruction.GetStepTimings();
        }
Beispiel #3
0
 /// <summary>
 /// Instruct y axis.
 /// </summary>
 /// <param name="y">Instruction for y.</param>
 public static Axes Y(StepInstrution y)
 {
     return(new Axes(null, y, null, null));
 }
Beispiel #4
0
 /// <summary>
 /// Instruct x axis.
 /// </summary>
 /// <param name="x">Instruction for x.</param>
 public static Axes X(StepInstrution x)
 {
     return(new Axes(x, null, null, null));
 }
Beispiel #5
0
 /// <summary>
 /// Combines instructions for x and y axes.
 /// </summary>
 /// <param name="x">Instruction for x.</param>
 /// <param name="y">Instruction for y.</param>
 public static Axes XY(StepInstrution x, StepInstrution y)
 {
     return(new Axes(x, y, null, null));
 }
Beispiel #6
0
 /// <summary>
 /// Combines instructions for u,v, x, y axes.
 /// </summary>
 /// <param name="u">Instruction for u.</param>
 /// <param name="v">Instruction for v.</param>
 /// <param name="y">Instruction for y.</param>
 /// <param name="y">Instruction for y.</param>
 public static Axes UVXY(StepInstrution u, StepInstrution v, StepInstrution x, StepInstrution y)
 {
     return(new Axes(x, y, u, v));
 }