Пример #1
0
        private void BuildTable(string val)
        {
            // check we have what we need. did i check for this already?!
            ///////////////////////////////////////////////////////////////////
            string[] cis = new string[] { "XTENSION", "BITPIX", "NAXIS", "NAXIS1", "NAXIS2", "PCOUNT", "GCOUNT" };
            for (int i = 0; i < cis.Length; i++)
            {
                Utils.CheckBool(_cardImages[i].Key.Equals(cis[i]), "Table extenstion doesn't have the requirted cardimages");
            }

            // we are fine, continue...
            ///////////////////////////////////////////////////////////////////
            long numBytesPerRow = long.Parse(_cardImages[3].Value); // same for both ASCII and Binary table
            long numRows        = long.Parse(_cardImages[4].Value); // same for both ASCII and Binary table
            int  numFields      = int.Parse(val);                   // number of columns

            _paramsLength = uint.Parse(_cardImages[5].Value);       // Non zero for binary tables only
            uint numGroups = uint.Parse(_cardImages[6].Value);      // must be one for binary table

            Utils.CheckBool(numGroups == 1, "GCOUNT of Binary Table must be 1");

            // now we're ready for table creation
            ///////////////////////////////////////////////////////////////////
            TableType t = (_type == HDUType.ASCIITable) ? TableType.ASCII : TableType.Binary;

            _table = new HDUTable(this, t, numRows, numFields, numBytesPerRow);
            if (_paramsLength > 0)
            {
                _heap = new byte[_paramsLength];
            }
        }
Пример #2
0
        internal TableCellASCII(TableRow row, FieldInfoBase fi)
            : base(row, fi)
        {
            HDUTable table = row.Header.Table as HDUTable;

            _offset = table.BytesPerRow * row.Index + fi.Offset - 1;    // -1 as FITS TBCOLn starts from 1 not from zero
        }
Пример #3
0
 internal RowEnumerator(HDUTable table)
 {
     _table      = table;
     _cursor     = -1;
     _numRows    = table.Length;
     _currentRow = null;
 }
Пример #4
0
        internal TableCellBinary(TableRow row, FieldInfoBase fi)
            : base(row, fi)
        {
            HDUTable table = row.Header.Table as HDUTable;

            _offset = table.BytesPerRow * row.Index + fi.Offset;
        }
Пример #5
0
        internal TableHeader(HDUTable table, int numFields)
        {
            _table             = table;
            _numFields         = numFields;
            _fieldNameIndexMap = new Dictionary <string, int>(numFields);
            _fieldsInfo        = new List <FieldInfoBase>(numFields);
            for (int i = 0; i < numFields; i++)
            {
                switch (table.Type)
                {
                case TableType.ASCII:
                    _fieldsInfo.Add(new FieldInfoA(this, i));
                    break;

                case TableType.Binary:
                    _fieldsInfo.Add(new FieldInfoB(this, i));
                    break;

                default:
                    throw new Exception("Invalid table type encountered");
                }
            }
        }