Commit 44ec1f15f24cb1831a24ee30e09c7e96a02ab606
1 parent
15b84304
replace FITS table column() method by access operator[]
Showing
3 changed files
with
26 additions
and
22 deletions
ChangeLog
| ... | ... | @@ -15,6 +15,7 @@ |
| 15 | 15 | Protect parfile read/write by a file lock |
| 16 | 16 | LM optimizer frees any internally fixed parameter at exit |
| 17 | 17 | Add row and column manipulation methods for FITS tables |
| 18 | + Replace FITS table column methods by access operators | |
| 18 | 19 | |
| 19 | 20 | 2011-07-20 Juergen Knoedlseder <knodlseder@cesr.fr> |
| 20 | 21 | ... | ... |
NEWS
| ... | ... | @@ -42,6 +42,9 @@ Add row appending, insertion and removal capabilities to FITS |
| 42 | 42 | tables. Implement also proper removing of obsolete columns from |
| 43 | 43 | a FITS file. |
| 44 | 44 | |
| 45 | +Replace the GFitsTable::column() methods by [] access operators. | |
| 46 | +This allows for more compact and intuitive coding. | |
| 47 | + | |
| 45 | 48 | |
| 46 | 49 | 5. Linear algebra module |
| 47 | 50 | ------------------------ | ... | ... |
test/test_GFits.cpp
| ... | ... | @@ -2069,8 +2069,8 @@ void test_bintable_double(void) |
| 2069 | 2069 | // |
| 2070 | 2070 | |
| 2071 | 2071 | // Get column |
| 2072 | - GFitsTableDoubleCol* col_dbl = | |
| 2073 | - (GFitsTableDoubleCol*)((GFitsTable*)fits.hdu(1))->column("DOUBLE"); | |
| 2072 | + GFitsTableDoubleCol* col_dbl = | |
| 2073 | + (GFitsTableDoubleCol*)&(*fits.table(1))["DOUBLE"]; | |
| 2074 | 2074 | |
| 2075 | 2075 | // Check double precision table (operator access) |
| 2076 | 2076 | tot_dbl = 0.0; |
| ... | ... | @@ -2125,8 +2125,8 @@ void test_bintable_double(void) |
| 2125 | 2125 | // |
| 2126 | 2126 | |
| 2127 | 2127 | // Get column |
| 2128 | - GFitsTableDoubleCol* col_dbl10 = | |
| 2129 | - (GFitsTableDoubleCol*)((GFitsTable*)fits.hdu(1))->column("DOUBLE10"); | |
| 2128 | + GFitsTableDoubleCol* col_dbl10 = | |
| 2129 | + (GFitsTableDoubleCol*)&(*fits.table(1))["DOUBLE10"]; | |
| 2130 | 2130 | |
| 2131 | 2131 | // Check double precision table (operator access) |
| 2132 | 2132 | tot_dbl = 0.0; |
| ... | ... | @@ -2426,7 +2426,7 @@ void test_bintable_float(void) |
| 2426 | 2426 | |
| 2427 | 2427 | // Get column |
| 2428 | 2428 | GFitsTableFloatCol* col_flt = |
| 2429 | - (GFitsTableFloatCol*)((GFitsTable*)fits.hdu(1))->column("FLOAT"); | |
| 2429 | + (GFitsTableFloatCol*)&(*fits.table(1))["FLOAT"]; | |
| 2430 | 2430 | |
| 2431 | 2431 | // Check single precision table (operator access) |
| 2432 | 2432 | tot_flt = 0.0; |
| ... | ... | @@ -2482,7 +2482,7 @@ void test_bintable_float(void) |
| 2482 | 2482 | |
| 2483 | 2483 | // Get column |
| 2484 | 2484 | GFitsTableFloatCol* col_flt10 = |
| 2485 | - (GFitsTableFloatCol*)((GFitsTable*)fits.hdu(1))->column("FLOAT10"); | |
| 2485 | + (GFitsTableFloatCol*)&(*fits.table(1))["FLOAT10"]; | |
| 2486 | 2486 | |
| 2487 | 2487 | // Check single precision table (operator access) |
| 2488 | 2488 | tot_flt = 0.0; |
| ... | ... | @@ -2787,7 +2787,7 @@ void test_bintable_short(void) |
| 2787 | 2787 | |
| 2788 | 2788 | // Get column |
| 2789 | 2789 | GFitsTableShortCol* col_sht = |
| 2790 | - (GFitsTableShortCol*)((GFitsTable*)fits.hdu(1))->column("SHORT"); | |
| 2790 | + (GFitsTableShortCol*)&(*fits.table(1))["SHORT"]; | |
| 2791 | 2791 | |
| 2792 | 2792 | // Check short table (operator access) |
| 2793 | 2793 | tot_sht = 0; |
| ... | ... | @@ -2843,7 +2843,7 @@ void test_bintable_short(void) |
| 2843 | 2843 | |
| 2844 | 2844 | // Get column |
| 2845 | 2845 | GFitsTableShortCol* col_sht10 = |
| 2846 | - (GFitsTableShortCol*)((GFitsTable*)fits.hdu(1))->column("SHORT10"); | |
| 2846 | + (GFitsTableShortCol*)&(*fits.table(1))["SHORT10"]; | |
| 2847 | 2847 | |
| 2848 | 2848 | // Check short table (operator access) |
| 2849 | 2849 | tot_sht = 0; |
| ... | ... | @@ -3147,7 +3147,7 @@ void test_bintable_ushort(void) |
| 3147 | 3147 | |
| 3148 | 3148 | // Get column |
| 3149 | 3149 | GFitsTableUShortCol* col_sht = |
| 3150 | - (GFitsTableUShortCol*)((GFitsTable*)fits.hdu(1))->column("USHORT"); | |
| 3150 | + (GFitsTableUShortCol*)&(*fits.table(1))["USHORT"]; | |
| 3151 | 3151 | |
| 3152 | 3152 | // Check table (operator access) |
| 3153 | 3153 | tot_sht = 0; |
| ... | ... | @@ -3203,7 +3203,7 @@ void test_bintable_ushort(void) |
| 3203 | 3203 | |
| 3204 | 3204 | // Get column |
| 3205 | 3205 | GFitsTableUShortCol* col_sht10 = |
| 3206 | - (GFitsTableUShortCol*)((GFitsTable*)fits.hdu(1))->column("USHORT10"); | |
| 3206 | + (GFitsTableUShortCol*)&(*fits.table(1))["USHORT10"]; | |
| 3207 | 3207 | |
| 3208 | 3208 | // Check table (operator access) |
| 3209 | 3209 | tot_sht = 0; |
| ... | ... | @@ -3506,7 +3506,7 @@ void test_bintable_long(void) |
| 3506 | 3506 | |
| 3507 | 3507 | // Get column |
| 3508 | 3508 | GFitsTableLongCol* col_lng = |
| 3509 | - (GFitsTableLongCol*)((GFitsTable*)fits.hdu(1))->column("LONG"); | |
| 3509 | + (GFitsTableLongCol*)&(*fits.table(1))["LONG"]; | |
| 3510 | 3510 | |
| 3511 | 3511 | // Check long table (operator access) |
| 3512 | 3512 | tot_lng = 0; |
| ... | ... | @@ -3562,7 +3562,7 @@ void test_bintable_long(void) |
| 3562 | 3562 | |
| 3563 | 3563 | // Get column |
| 3564 | 3564 | GFitsTableLongCol* col_lng10 = |
| 3565 | - (GFitsTableLongCol*)((GFitsTable*)fits.hdu(1))->column("LONG10"); | |
| 3565 | + (GFitsTableLongCol*)&(*fits.table(1))["LONG10"]; | |
| 3566 | 3566 | |
| 3567 | 3567 | // Check long table (operator access) |
| 3568 | 3568 | tot_lng = 0; |
| ... | ... | @@ -3865,7 +3865,7 @@ void test_bintable_longlong(void) |
| 3865 | 3865 | |
| 3866 | 3866 | // Get column |
| 3867 | 3867 | GFitsTableLongLongCol* col_lng = |
| 3868 | - (GFitsTableLongLongCol*)((GFitsTable*)fits.hdu(1))->column("LONGLONG"); | |
| 3868 | + (GFitsTableLongLongCol*)&(*fits.table(1))["LONGLONG"]; | |
| 3869 | 3869 | |
| 3870 | 3870 | // Check table (operator access) |
| 3871 | 3871 | tot_lng = 0; |
| ... | ... | @@ -3921,7 +3921,7 @@ void test_bintable_longlong(void) |
| 3921 | 3921 | |
| 3922 | 3922 | // Get column |
| 3923 | 3923 | GFitsTableLongLongCol* col_lng10 = |
| 3924 | - (GFitsTableLongLongCol*)((GFitsTable*)fits.hdu(1))->column("LONGLONG10"); | |
| 3924 | + (GFitsTableLongLongCol*)&(*fits.table(1))["LONGLONG10"]; | |
| 3925 | 3925 | |
| 3926 | 3926 | // Check table (operator access) |
| 3927 | 3927 | tot_lng = 0; |
| ... | ... | @@ -4224,7 +4224,7 @@ void test_bintable_ulong(void) |
| 4224 | 4224 | |
| 4225 | 4225 | // Get column |
| 4226 | 4226 | GFitsTableULongCol* col_lng = |
| 4227 | - (GFitsTableULongCol*)((GFitsTable*)fits.hdu(1))->column("ULONG"); | |
| 4227 | + (GFitsTableULongCol*)&(*fits.table(1))["ULONG"]; | |
| 4228 | 4228 | |
| 4229 | 4229 | // Check table (operator access) |
| 4230 | 4230 | tot_lng = 0; |
| ... | ... | @@ -4280,7 +4280,7 @@ void test_bintable_ulong(void) |
| 4280 | 4280 | |
| 4281 | 4281 | // Get column |
| 4282 | 4282 | GFitsTableULongCol* col_lng10 = |
| 4283 | - (GFitsTableULongCol*)((GFitsTable*)fits.hdu(1))->column("ULONG10"); | |
| 4283 | + (GFitsTableULongCol*)&(*fits.table(1))["ULONG10"]; | |
| 4284 | 4284 | |
| 4285 | 4285 | // Check table (operator access) |
| 4286 | 4286 | tot_lng = 0; |
| ... | ... | @@ -4581,7 +4581,7 @@ void test_bintable_string(void) |
| 4581 | 4581 | |
| 4582 | 4582 | // Get column |
| 4583 | 4583 | GFitsTableStringCol* col_str = |
| 4584 | - (GFitsTableStringCol*)((GFitsTable*)fits.hdu(1))->column("STRING"); | |
| 4584 | + (GFitsTableStringCol*)&(*fits.table(1))["STRING"]; | |
| 4585 | 4585 | |
| 4586 | 4586 | // Check string table (operator access) |
| 4587 | 4587 | tot_str.clear(); |
| ... | ... | @@ -4637,7 +4637,7 @@ void test_bintable_string(void) |
| 4637 | 4637 | |
| 4638 | 4638 | // Get column |
| 4639 | 4639 | GFitsTableStringCol* col_str10 = |
| 4640 | - (GFitsTableStringCol*)((GFitsTable*)fits.hdu(1))->column("STRING10"); | |
| 4640 | + (GFitsTableStringCol*)&(*fits.table(1))["STRING10"]; | |
| 4641 | 4641 | |
| 4642 | 4642 | // Check table (operator access) |
| 4643 | 4643 | tot_str.clear(); |
| ... | ... | @@ -4946,7 +4946,7 @@ void test_bintable_logical(void) |
| 4946 | 4946 | |
| 4947 | 4947 | // Get column |
| 4948 | 4948 | GFitsTableBoolCol* col = |
| 4949 | - (GFitsTableBoolCol*)((GFitsTable*)fits.hdu(1))->column("LOGICAL"); | |
| 4949 | + (GFitsTableBoolCol*)&(*fits.table(1))["LOGICAL"]; | |
| 4950 | 4950 | |
| 4951 | 4951 | // Check table (operator access) |
| 4952 | 4952 | tot_int = 0; |
| ... | ... | @@ -5002,7 +5002,7 @@ void test_bintable_logical(void) |
| 5002 | 5002 | |
| 5003 | 5003 | // Get column |
| 5004 | 5004 | GFitsTableBoolCol* col10 = |
| 5005 | - (GFitsTableBoolCol*)((GFitsTable*)fits.hdu(1))->column("LOGICAL10"); | |
| 5005 | + (GFitsTableBoolCol*)&(*fits.table(1))["LOGICAL10"]; | |
| 5006 | 5006 | |
| 5007 | 5007 | // Check table (operator access) |
| 5008 | 5008 | tot_int = 0; |
| ... | ... | @@ -5310,7 +5310,7 @@ void test_bintable_bit(void) |
| 5310 | 5310 | |
| 5311 | 5311 | // Get column |
| 5312 | 5312 | GFitsTableBitCol* col = |
| 5313 | - (GFitsTableBitCol*)((GFitsTable*)fits.hdu(1))->column("BIT"); | |
| 5313 | + (GFitsTableBitCol*)&(*fits.table(1))["BIT"]; | |
| 5314 | 5314 | |
| 5315 | 5315 | // Check table (operator access) |
| 5316 | 5316 | tot_int = 0; |
| ... | ... | @@ -5366,7 +5366,7 @@ void test_bintable_bit(void) |
| 5366 | 5366 | |
| 5367 | 5367 | // Get column |
| 5368 | 5368 | GFitsTableBitCol* col10 = |
| 5369 | - (GFitsTableBitCol*)((GFitsTable*)fits.hdu(1))->column("BIT10"); | |
| 5369 | + (GFitsTableBitCol*)&(*fits.table(1))["BIT10"]; | |
| 5370 | 5370 | |
| 5371 | 5371 | // Check table (operator access) |
| 5372 | 5372 | tot_int = 0; | ... | ... |