Opc.Ua.Server.MonitoredItemQueue.Dequeue C# (CSharp) Method

Dequeue() private method

Removes a value and an error from the queue.
private Dequeue ( DataValue &value, ServiceResult &error ) : bool
value DataValue The value removed from the queue.
error ServiceResult The error removed from the queue.
return bool
        private bool Dequeue(out DataValue value, out ServiceResult error)
        {
            value = null;
            error = null;

            // check for empty queue.
            if (m_start < 0)
            {
                return false;
            }

            value = m_values[m_start];
            m_values[m_start] = null;

            if (m_errors != null)
            {
                error = m_errors[m_start];
                m_errors[m_start] = null;
            }

            // set the overflow bit.
            if (m_overflow == m_start)
            {
                SetOverflowBit(ref value, ref error);
                m_overflow = -1;
            }

            m_start++;

            // check if queue has been emptied.
            if (m_start == m_end)
            {
                m_start = -1;
                m_end = 0;
            }

            // check for wrap around.
            else if (m_start >= m_values.Length)
            {
                m_start = 0;
            }

            Utils.Trace("DEQUEUE VALUE: Value={0} CODE={1}<{1:X8}> OVERFLOW={2}", value.WrappedValue, value.StatusCode.Code, value.StatusCode.Overflow);

            return true;
        }