Пример #1
0
        public IEnumerable <ICdlRecord> EnumRows(ArrayDataRecord record)
        {
            int page = 0;

            while (page < _directory.Count)
            {
                lock (_directory)
                {
                    BinaryReader br = new BinaryReader(_cache);
                    _cache.Seek(_directory[page], SeekOrigin.Begin);
                    ChunkInfo info = ChunkInfo.LoadInfo(br);
                    for (int i = 0; i < info.Count; i++)
                    {
                        if (record == null)
                        {
                            yield return(CdlTool.LoadRecord(br, _table));
                        }
                        else
                        {
                            CdlTool.LoadRecord(br, record);
                            yield return(record);
                        }
                    }
                }
                page++;
            }
        }
Пример #2
0
        public IEnumerable <IBedRecord> EnumRows(TableDataSetProperties props)
        {
            int page = 0;

            do
            {
                while (page < m_directory.Count)
                {
                    lock (m_directory)
                    {
                        BinaryReader br = new BinaryReader(m_cache);
                        m_cache.Seek(m_directory[page], SeekOrigin.Begin);
                        ChunkInfo info = ChunkInfo.LoadInfo(br);
                        for (int i = 0; i < info.Count; i++)
                        {
                            yield return(BedTool.LoadRecord(br, m_table));
                        }
                    }
                    page++;
                }
                if (State == TabularDataViewState.Loading)
                {
                    System.Threading.Thread.Sleep(100);
                }
            } while (State == TabularDataViewState.Loading);
        }
Пример #3
0
 private void DoRead(IDataQueue queue)
 {
     try
     {
         int page = 0;
         do
         {
             while (page < m_directory.Count)
             {
                 lock (m_directory)
                 {
                     BinaryReader br = new BinaryReader(m_cache);
                     m_cache.Seek(m_directory[page], SeekOrigin.Begin);
                     ChunkInfo info = ChunkInfo.LoadInfo(br);
                     for (int i = 0; i < info.Count; i++)
                     {
                         queue.PutRecord(BedTool.LoadRecord(br, m_table));
                     }
                 }
                 page++;
             }
             if (State == TabularDataViewState.Loading)
             {
                 System.Threading.Thread.Sleep(100);
             }
         } while (State == TabularDataViewState.Loading);
         queue.PutEof();
     }
     finally
     {
         queue.CloseWriting();
     }
 }
Пример #4
0
        public BedTable LoadTableData(TablePageProperties props)
        {
            lock (m_directory)
            {
                BedTable table = new BedTable(m_table);

                int start = 0;
                int count = m_serializedRows;
                if (props.Count != null)
                {
                    count = props.Count.Value;
                }
                if (props.Start != null)
                {
                    start = props.Start.Value;
                }

                if (start >= m_serializedRows)
                {
                    return(table);
                }
                int curdic = start / BUFFER_SIZE, skiprec = start % BUFFER_SIZE;
                Errors.Assert(curdic < m_directory.Count);
                m_cache.Seek(m_directory[curdic], SeekOrigin.Begin);

                int          availtables = m_directory.Count - curdic;
                BinaryReader br          = new BinaryReader(m_cache);
                while (table.Rows.Count < count && availtables >= 1)
                {
                    ChunkInfo info = ChunkInfo.LoadInfo(br);
                    if (skiprec > 0)
                    {
                        int skipbytes = 0;
                        for (int i = 0; i < skiprec; i++)
                        {
                            skipbytes += info.Lengths[i];
                        }
                        m_cache.Seek(skipbytes, SeekOrigin.Current);
                    }
                    int rec = skiprec;

                    while (rec < info.Count)
                    {
                        table.AddRowInternal(BedTool.LoadRecord(br, m_table));
                        rec++;
                    }
                    availtables--;
                    skiprec = 0;
                }
                return(table);
            }
        }
Пример #5
0
        public CdlTable LoadTableData(int start = 0, int?count = null)
        {
            lock (_directory)
            {
                CdlTable table = new CdlTable(_table);

                if (count == null)
                {
                    count = _serializedRows;
                }

                if (start >= _serializedRows)
                {
                    return(table);
                }
                int curdic = start / BUFFER_SIZE, skiprec = start % BUFFER_SIZE;
                _cache.Seek(_directory[curdic], SeekOrigin.Begin);

                int          availtables = _directory.Count - curdic;
                BinaryReader br          = new BinaryReader(_cache);
                while (table.Rows.Count < count && availtables >= 1)
                {
                    ChunkInfo info = ChunkInfo.LoadInfo(br);
                    if (skiprec > 0)
                    {
                        int skipbytes = 0;
                        for (int i = 0; i < skiprec; i++)
                        {
                            skipbytes += info.Lengths[i];
                        }
                        _cache.Seek(skipbytes, SeekOrigin.Current);
                    }
                    int rec = skiprec;

                    while (rec < info.Count)
                    {
                        table.AddRowInternal(CdlTool.LoadRecord(br, _table));
                        rec++;
                    }
                    availtables--;
                    skiprec = 0;
                }
                return(table);
            }
        }