コード例 #1
0
ファイル: MasterList.cs プロジェクト: Flavio58it/MyCaffe
        /// <summary>
        /// The constructor.
        /// </summary>
        /// <param name="random">Specifies the CryptoRandom to use for random selection.</param>
        /// <param name="log">Specifies the output log.</param>
        /// <param name="src">Specifies the data source that holds the data on the database.</param>
        /// <param name="factory">Specifies the data factory used to access the database data.</param>
        /// <param name="rgAbort">Specifies the cancel handles.</param>
        /// <param name="nMaxLoadCount">Optionally, specifies to automaticall start the image refresh which only applies when the number of images loaded into memory is less than the actual number of images (default = false).</param>
        public MasterList(CryptoRandom random, Log log, SourceDescriptor src, DatasetFactory factory, List <WaitHandle> rgAbort, int nMaxLoadCount = 0)
        {
            m_random  = random;
            m_log     = log;
            m_src     = src;
            m_factory = factory;

            m_rgAbort.Add(m_evtCancel);
            if (rgAbort.Count > 0)
            {
                m_rgAbort.AddRange(rgAbort);
            }

            m_imgMean = m_factory.LoadImageMean(m_src.ID);

            m_nLoadCount = nMaxLoadCount;
            if (m_nLoadCount == 0 || m_nLoadCount > m_src.ImageCount)
            {
                m_nLoadCount = m_src.ImageCount;
            }

            m_rgImages     = new SimpleDatum[m_nLoadCount];
            m_nLoadedCount = 0;

            if (m_nLoadCount < m_src.ImageCount)
            {
                m_refreshManager = new RefreshManager(random, m_src, m_factory);
            }
        }