using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace irisMemory
{
    public class IrisConfig
    {
        private static Stack<byte[]> queueFace;   /* 队列1：用于存放相机采集的面部图像,供搜索眼睛 */
        private static Stack<byte[]> q2;   /* 队列2：用于存放搜到眼睛的面部图像,供质量评估 */
        private static Stack<int[]> q3;     /* 队列3：用于存放搜到眼睛的位置参数(x,y,r),供质量评估 */
        private static Stack<byte[]> queueIdentify;   /* 队列4：用于存放质量合格的眼部图像640*480,供虹膜识别 */

        private byte[] faceBuffer;        /* 用于保存相机采集的面部图像，从q1中取得 */
        private byte[] irisFaceBuffer;    /* 用于保存搜到眼睛的面部图像，从q2中取得 */
        private int[] irisPosBuffer;                  /* 用于保存搜到眼睛的位置参数，从q3中取得 */
        private byte[] qualifiedIrisBuffer;  /* 用于保存质量合格的眼部图像，从q4中取得 */


        private bool m_EyeFinderThreadRun; /* 用于强制结束搜眼线程 */
        private bool m_AssessThreadRun; /* 用于强制结束质量评估线程 */
        private bool m_IdentifyThreadRun; /* 用于强制结束识别线程 */

        private int key_FindEyes; /* 搜眼线程开启标志 */
        private int key_Assess;  /* 图像质量评估线程开启标志 */
        private int key_Identify; /* 虹膜识别线程开启标志 */

        private bool identifyAccess;


        private static IrisConfig _irisConfig;

        public Stack<byte[]> QueueFace
        {
            get
            {
                return queueFace;
            }

            set
            {
                queueFace = value;
            }
        }

        public Stack<byte[]> Q2
        {
            get
            {
                return q2;
            }

            set
            {
                q2 = value;
            }
        }

        public Stack<int[]> Q3
        {
            get
            {
                return q3;
            }

            set
            {
                q3 = value;
            }
        }

        public Stack<byte[]> QueueIdentify
        {
            get
            {
                return queueIdentify;
            }

            set
            {
                queueIdentify = value;
            }
        }

        public byte[] FaceBuffer
        {
            get
            {
                return faceBuffer;
            }

            set
            {
                faceBuffer = value;
            }
        }

        public byte[] IrisFaceBuffer
        {
            get
            {
                return irisFaceBuffer;
            }

            set
            {
                irisFaceBuffer = value;
            }
        }

        public int[] IrisPosBuffer
        {
            get
            {
                return irisPosBuffer;
            }

            set
            {
                irisPosBuffer = value;
            }
        }

        public byte[] QualifiedIrisBuffer
        {
            get
            {
                return qualifiedIrisBuffer;
            }

            set
            {
                qualifiedIrisBuffer = value;
            }
        }

        public bool EyeFinderThreadRun
        {
            get
            {
                return m_EyeFinderThreadRun;
            }

            set
            {
                m_EyeFinderThreadRun = value;
            }
        }

        public bool AssessThreadRun
        {
            get
            {
                return m_AssessThreadRun;
            }

            set
            {
                m_AssessThreadRun = value;
            }
        }

        public bool IdentifyThreadRun
        {
            get
            {
                return m_IdentifyThreadRun;
            }

            set
            {
                m_IdentifyThreadRun = value;
            }
        }

        public int Key_FindEyes
        {
            get
            {
                return key_FindEyes;
            }

            set
            {
                key_FindEyes = value;
            }
        }

        public int Key_Assess
        {
            get
            {
                return key_Assess;
            }

            set
            {
                key_Assess = value;
            }
        }

        public int Key_Identify
        {
            get
            {
                return key_Identify;
            }

            set
            {
                key_Identify = value;
            }
        }

        public bool IdentifyAccess
        {
            get
            {
                return identifyAccess;
            }

            set
            {
                identifyAccess = value;
            }
        }

        private IrisConfig()
        {
            QueueFace = new Stack<byte[]>();
            Q2 = new Stack<byte[]>();
            Q3 = new Stack<int[]>();
            QueueIdentify = new Stack<byte[]>();
            FaceBuffer = new byte[1280 * 960];
            IrisFaceBuffer = new byte[1280 * 960];
            IrisPosBuffer = new int[3];
            QualifiedIrisBuffer = new byte[640 * 480];
            EyeFinderThreadRun = false;
            AssessThreadRun = false;
            IdentifyThreadRun = false;
            Key_FindEyes = 0;
            Key_Assess = 0;
            Key_Identify = 0;

            IdentifyAccess = false;
        }

        public static IrisConfig GetInstance()
        {
            if (_irisConfig == null)
                _irisConfig = new IrisConfig();

            return _irisConfig;
        }


    }
}
