Commit 578f834064b3591bbb78e8349e893f0251fedbca

Authored by knodlseder
1 parent 36774daf

remove ostream operator (now handled by GFitsTableCol base class)

include/GFitsTable.hpp
... ... @@ -20,6 +20,8 @@
20 20 #define GFITSTABLE_HPP
21 21  
22 22 /* __ Includes ___________________________________________________________ */
  23 +#include <iostream>
  24 +#include "GLog.hpp"
23 25 #include "GFitsHDU.hpp"
24 26 #include "GFitsTableCol.hpp"
25 27  
... ... @@ -39,6 +41,7 @@ class GFitsTable : public GFitsHDU {
39 41  
40 42 // I/O friends
41 43 friend std::ostream& operator<< (std::ostream& os, const GFitsTable& table);
  44 + friend GLog& operator<< (GLog& log, const GFitsTable& table);
42 45  
43 46 public:
44 47 // Constructors and destructors
... ... @@ -65,16 +68,15 @@ public:
65 68  
66 69 protected:
67 70 // Protected methods
68   - void init_members(void);
69   - void copy_members(const GFitsTable& table);
70   - void free_members(void);
71   - void data_open(void* vptr);
72   - void data_save(void);
73   - void data_close(void);
74   - void data_connect(void* vptr);
75   - char* get_ttype(const int& colnum) const;
76   - char* get_tform(const int& colnum) const;
77   - char* get_tunit(const int& colnum) const;
  71 + void data_open(void* vptr);
  72 + void data_save(void);
  73 + void data_close(void);
  74 + void data_connect(void* vptr);
  75 + std::ostream& data_dump(std::ostream& os) const;
  76 + GLog& data_dump(GLog& log) const;
  77 + char* get_ttype(const int& colnum) const;
  78 + char* get_tform(const int& colnum) const;
  79 + char* get_tunit(const int& colnum) const;
78 80  
79 81 // Protected data area
80 82 int m_type; //!< Table type (1=ASCII, 2=Binary)
... ... @@ -84,6 +86,9 @@ protected:
84 86  
85 87 private:
86 88 // Private methods
  89 + void init_members(void);
  90 + void copy_members(const GFitsTable& table);
  91 + void free_members(void);
87 92 };
88 93  
89 94 #endif /* GFITSTABLE_HPP */
... ...
include/GFitsTableBitCol.hpp
... ... @@ -20,6 +20,7 @@
20 20 #define GFITSTABLEBITCOL_HPP
21 21  
22 22 /* __ Includes ___________________________________________________________ */
  23 +#include <string>
23 24 #include "GFitsTableCol.hpp"
24 25  
25 26  
... ... @@ -34,9 +35,6 @@
34 35 ***************************************************************************/
35 36 class GFitsTableBitCol : public GFitsTableCol {
36 37  
37   - // I/O friends
38   - friend std::ostream& operator<< (std::ostream& os, const GFitsTableBitCol& column);
39   -
40 38 public:
41 39 // Constructors and destructors
42 40 GFitsTableBitCol(void);
... ...
include/GFitsTableBoolCol.hpp
... ... @@ -20,6 +20,7 @@
20 20 #define GFITSTABLEBOOLCOL_HPP
21 21  
22 22 /* __ Includes ___________________________________________________________ */
  23 +#include <string>
23 24 #include "GFitsTableCol.hpp"
24 25  
25 26  
... ... @@ -35,9 +36,6 @@
35 36 ***************************************************************************/
36 37 class GFitsTableBoolCol : public GFitsTableCol {
37 38  
38   - // I/O friends
39   - friend std::ostream& operator<< (std::ostream& os, const GFitsTableBoolCol& column);
40   -
41 39 public:
42 40 // Constructors and destructors
43 41 GFitsTableBoolCol(void);
... ...
include/GFitsTableDoubleCol.hpp
... ... @@ -20,6 +20,7 @@
20 20 #define GFITSTABLEDOUBLECOL_HPP
21 21  
22 22 /* __ Includes ___________________________________________________________ */
  23 +#include <string>
23 24 #include "GFitsTableCol.hpp"
24 25  
25 26  
... ... @@ -32,9 +33,6 @@
32 33 ***************************************************************************/
33 34 class GFitsTableDoubleCol : public GFitsTableCol {
34 35  
35   - // I/O friends
36   - friend std::ostream& operator<< (std::ostream& os, const GFitsTableDoubleCol& column);
37   -
38 36 public:
39 37 // Constructors and destructors
40 38 GFitsTableDoubleCol(void);
... ...
include/GFitsTableFloatCol.hpp
... ... @@ -20,6 +20,7 @@
20 20 #define GFITSTABLEFLOATCOL_HPP
21 21  
22 22 /* __ Includes ___________________________________________________________ */
  23 +#include <string>
23 24 #include "GFitsTableCol.hpp"
24 25  
25 26  
... ... @@ -32,9 +33,6 @@
32 33 ***************************************************************************/
33 34 class GFitsTableFloatCol : public GFitsTableCol {
34 35  
35   - // I/O friends
36   - friend std::ostream& operator<< (std::ostream& os, const GFitsTableFloatCol& column);
37   -
38 36 public:
39 37 // Constructors and destructors
40 38 GFitsTableFloatCol(void);
... ...
include/GFitsTableLongCol.hpp
... ... @@ -20,6 +20,7 @@
20 20 #define GFITSTABLELONGCOL_HPP
21 21  
22 22 /* __ Includes ___________________________________________________________ */
  23 +#include <string>
23 24 #include "GFitsTableCol.hpp"
24 25  
25 26  
... ... @@ -32,9 +33,6 @@
32 33 ***************************************************************************/
33 34 class GFitsTableLongCol : public GFitsTableCol {
34 35  
35   - // I/O friends
36   - friend std::ostream& operator<< (std::ostream& os, const GFitsTableLongCol& column);
37   -
38 36 public:
39 37 // Constructors and destructors
40 38 GFitsTableLongCol(void);
... ...
include/GFitsTableLongLongCol.hpp
... ... @@ -20,6 +20,7 @@
20 20 #define GFITSTABLELONGLONGCOL_HPP
21 21  
22 22 /* __ Includes ___________________________________________________________ */
  23 +#include <string>
23 24 #include "GFitsTableCol.hpp"
24 25  
25 26  
... ... @@ -32,9 +33,6 @@
32 33 ***************************************************************************/
33 34 class GFitsTableLongLongCol : public GFitsTableCol {
34 35  
35   - // I/O friends
36   - friend std::ostream& operator<< (std::ostream& os, const GFitsTableLongLongCol& column);
37   -
38 36 public:
39 37 // Constructors and destructors
40 38 GFitsTableLongLongCol(void);
... ...
include/GFitsTableShortCol.hpp
... ... @@ -20,6 +20,7 @@
20 20 #define GFITSTABLESHORTCOL_HPP
21 21  
22 22 /* __ Includes ___________________________________________________________ */
  23 +#include <string>
23 24 #include "GFitsTableCol.hpp"
24 25  
25 26  
... ... @@ -32,9 +33,6 @@
32 33 ***************************************************************************/
33 34 class GFitsTableShortCol : public GFitsTableCol {
34 35  
35   - // I/O friends
36   - friend std::ostream& operator<< (std::ostream& os, const GFitsTableShortCol& column);
37   -
38 36 public:
39 37 // Constructors and destructors
40 38 GFitsTableShortCol(void);
... ...
include/GFitsTableStringCol.hpp
... ... @@ -20,6 +20,7 @@
20 20 #define GFITSTABLESTRINGCOL_HPP
21 21  
22 22 /* __ Includes ___________________________________________________________ */
  23 +#include <string>
23 24 #include "GFitsTableCol.hpp"
24 25  
25 26  
... ... @@ -32,9 +33,6 @@
32 33 ***************************************************************************/
33 34 class GFitsTableStringCol : public GFitsTableCol {
34 35  
35   - // I/O friends
36   - friend std::ostream& operator<< (std::ostream& os, const GFitsTableStringCol& column);
37   -
38 36 public:
39 37 // Constructors and destructors
40 38 GFitsTableStringCol(void);
... ...
include/GFitsTableULongCol.hpp
... ... @@ -20,6 +20,7 @@
20 20 #define GFITSTABLEULONGCOL_HPP
21 21  
22 22 /* __ Includes ___________________________________________________________ */
  23 +#include <string>
23 24 #include "GFitsTableCol.hpp"
24 25  
25 26  
... ... @@ -32,9 +33,6 @@
32 33 ***************************************************************************/
33 34 class GFitsTableULongCol : public GFitsTableCol {
34 35  
35   - // I/O friends
36   - friend std::ostream& operator<< (std::ostream& os, const GFitsTableULongCol& column);
37   -
38 36 public:
39 37 // Constructors and destructors
40 38 GFitsTableULongCol(void);
... ...
include/GFitsTableUShortCol.hpp
... ... @@ -20,6 +20,7 @@
20 20 #define GFITSTABLEUSHORTCOL_HPP
21 21  
22 22 /* __ Includes ___________________________________________________________ */
  23 +#include <string>
23 24 #include "GFitsTableCol.hpp"
24 25  
25 26  
... ... @@ -32,9 +33,6 @@
32 33 ***************************************************************************/
33 34 class GFitsTableUShortCol : public GFitsTableCol {
34 35  
35   - // I/O friends
36   - friend std::ostream& operator<< (std::ostream& os, const GFitsTableUShortCol& column);
37   -
38 36 public:
39 37 // Constructors and destructors
40 38 GFitsTableUShortCol(void);
... ...
src/fits/GFitsTableBitCol.cpp
... ... @@ -15,7 +15,7 @@
15 15 #ifdef HAVE_CONFIG_H
16 16 #include <config.h>
17 17 #endif
18   -#include <iostream>
  18 +#include <string>
19 19 #include "GException.hpp"
20 20 #include "GTools.hpp"
21 21 #include "GFitsCfitsio.hpp"
... ... @@ -522,17 +522,10 @@ void GFitsTableBitCol::load_column(void)
522 522 // Compute number of Bytes and Bits per row
523 523 m_bytes_per_row = (m_number > 0) ? ((m_number-1) / 8) + 1 : 0;
524 524 m_bits_per_row = m_bytes_per_row * 8;
525   -
  525 +
526 526 // Compute length of memory array
527 527 m_size = m_bytes_per_row * m_length;
528   -/*
529   -std::cout << m_name
530   - << " size=" << m_size
531   - << " bits=" << m_bits
532   - << " bytes_per_row=" << m_bytes_per_row
533   - << " bits_per_row=" << m_bits_per_row << std::endl;
534   -*/
535   -
  528 +
536 529 // Load only if the column has a positive size
537 530 if (m_size > 0) {
538 531  
... ... @@ -629,7 +622,7 @@ void GFitsTableBitCol::get_bit(const int&amp; row, const int&amp; inx)
629 622 if (row < 0 || row >= m_length)
630 623 throw GException::out_of_range(G_GET_BIT, row, 0, m_length-1);
631 624 #endif
632   -
  625 +
633 626 // Check inx value
634 627 #if defined(G_RANGE_CHECK)
635 628 if (inx < 0 || inx >= m_number)
... ... @@ -680,18 +673,3 @@ void GFitsTableBitCol::set_pending(void)
680 673 = Friends =
681 674 = =
682 675 ==========================================================================*/
683   -
684   -/***********************************************************************//**
685   - * @brief Output operator
686   - *
687   - * @param[in] os Output stream.
688   - * @param[in] column Column to put in output stream.
689   - ***************************************************************************/
690   -std::ostream& operator<< (std::ostream& os, const GFitsTableBitCol& column)
691   -{
692   - // Dump column in output stream
693   - column.dump_column(os, column.m_data);
694   -
695   - // Return output stream
696   - return os;
697   -}
... ...
src/fits/GFitsTableBoolCol.cpp
... ... @@ -15,7 +15,7 @@
15 15 #ifdef HAVE_CONFIG_H
16 16 #include <config.h>
17 17 #endif
18   -#include <iostream>
  18 +#include <string>
19 19 #include "GException.hpp"
20 20 #include "GTools.hpp"
21 21 #include "GFitsCfitsio.hpp"
... ... @@ -193,7 +193,7 @@ std::string GFitsTableBoolCol::string(const int&amp; row, const int&amp; inx)
193 193  
194 194 // Convert bool into string
195 195 std::string result = (m_data[offset(row,inx)]) ? "T" : "F";
196   -
  196 +
197 197 // Return value
198 198 return result;
199 199 }
... ... @@ -582,18 +582,3 @@ void GFitsTableBoolCol::free_buffer(void)
582 582 = Friends =
583 583 = =
584 584 ==========================================================================*/
585   -
586   -/***********************************************************************//**
587   - * @brief Output operator
588   - *
589   - * @param[in] os Output stream.
590   - * @param[in] column Column to put in output stream.
591   - ***************************************************************************/
592   -std::ostream& operator<< (std::ostream& os, const GFitsTableBoolCol& column)
593   -{
594   - // Dump column in output stream
595   - column.dump_column(os, column.m_data);
596   -
597   - // Return output stream
598   - return os;
599   -}
... ...
src/fits/GFitsTableDoubleCol.cpp
... ... @@ -15,7 +15,7 @@
15 15 #ifdef HAVE_CONFIG_H
16 16 #include <config.h>
17 17 #endif
18   -#include <iostream>
  18 +#include <string>
19 19 #include "GException.hpp"
20 20 #include "GTools.hpp"
21 21 #include "GFitsCfitsio.hpp"
... ... @@ -479,18 +479,3 @@ void GFitsTableDoubleCol::init_data(void)
479 479 = Friends =
480 480 = =
481 481 ==========================================================================*/
482   -
483   -/***********************************************************************//**
484   - * @brief Output operator
485   - *
486   - * @param[in] os Output stream
487   - * @param[in] column Column to put in output stream
488   - ***************************************************************************/
489   -std::ostream& operator<< (std::ostream& os, const GFitsTableDoubleCol& column)
490   -{
491   - // Dump column in output stream
492   - column.dump_column(os, column.m_data);
493   -
494   - // Return output stream
495   - return os;
496   -}
... ...
src/fits/GFitsTableFloatCol.cpp
... ... @@ -15,7 +15,7 @@
15 15 #ifdef HAVE_CONFIG_H
16 16 #include <config.h>
17 17 #endif
18   -#include <iostream>
  18 +#include <string>
19 19 #include "GException.hpp"
20 20 #include "GTools.hpp"
21 21 #include "GFitsCfitsio.hpp"
... ... @@ -479,18 +479,3 @@ void GFitsTableFloatCol::init_data(void)
479 479 = Friends =
480 480 = =
481 481 ==========================================================================*/
482   -
483   -/***********************************************************************//**
484   - * @brief Output operator
485   - *
486   - * @param[in] os Output stream.
487   - * @param[in] column Column to put in output stream.
488   - ***************************************************************************/
489   -std::ostream& operator<< (std::ostream& os, const GFitsTableFloatCol& column)
490   -{
491   - // Dump column in output stream
492   - column.dump_column(os, column.m_data);
493   -
494   - // Return output stream
495   - return os;
496   -}
... ...
src/fits/GFitsTableLongCol.cpp
... ... @@ -15,7 +15,7 @@
15 15 #ifdef HAVE_CONFIG_H
16 16 #include <config.h>
17 17 #endif
18   -#include <iostream>
  18 +#include <string>
19 19 #include "GException.hpp"
20 20 #include "GTools.hpp"
21 21 #include "GFitsCfitsio.hpp"
... ... @@ -479,18 +479,3 @@ void GFitsTableLongCol::init_data(void)
479 479 = Friends =
480 480 = =
481 481 ==========================================================================*/
482   -
483   -/***********************************************************************//**
484   - * @brief Output operator
485   - *
486   - * @param[in] os Output stream.
487   - * @param[in] column Column to put in output stream.
488   - ***************************************************************************/
489   -std::ostream& operator<< (std::ostream& os, const GFitsTableLongCol& column)
490   -{
491   - // Dump column in output stream
492   - column.dump_column(os, column.m_data);
493   -
494   - // Return output stream
495   - return os;
496   -}
... ...
src/fits/GFitsTableLongLongCol.cpp
... ... @@ -15,7 +15,7 @@
15 15 #ifdef HAVE_CONFIG_H
16 16 #include <config.h>
17 17 #endif
18   -#include <iostream>
  18 +#include <string>
19 19 #include "GException.hpp"
20 20 #include "GTools.hpp"
21 21 #include "GFitsCfitsio.hpp"
... ... @@ -479,18 +479,3 @@ void GFitsTableLongLongCol::init_data(void)
479 479 = Friends =
480 480 = =
481 481 ==========================================================================*/
482   -
483   -/***********************************************************************//**
484   - * @brief Output operator
485   - *
486   - * @param[in] os Output stream
487   - * @param[in] column Column to put in output stream
488   - ***************************************************************************/
489   -std::ostream& operator<< (std::ostream& os, const GFitsTableLongLongCol& column)
490   -{
491   - // Dump column in output stream
492   - column.dump_column(os, column.m_data);
493   -
494   - // Return output stream
495   - return os;
496   -}
... ...
src/fits/GFitsTableShortCol.cpp
... ... @@ -15,7 +15,7 @@
15 15 #ifdef HAVE_CONFIG_H
16 16 #include <config.h>
17 17 #endif
18   -#include <iostream>
  18 +#include <string>
19 19 #include "GException.hpp"
20 20 #include "GTools.hpp"
21 21 #include "GFitsCfitsio.hpp"
... ... @@ -479,18 +479,3 @@ void GFitsTableShortCol::init_data(void)
479 479 = Friends =
480 480 = =
481 481 ==========================================================================*/
482   -
483   -/***********************************************************************//**
484   - * @brief Output operator
485   - *
486   - * @param[in] os Output stream
487   - * @param[in] column Column to put in output stream
488   - ***************************************************************************/
489   -std::ostream& operator<< (std::ostream& os, const GFitsTableShortCol& column)
490   -{
491   - // Dump column in output stream
492   - column.dump_column(os, column.m_data);
493   -
494   - // Return output stream
495   - return os;
496   -}
... ...
src/fits/GFitsTableStringCol.cpp
... ... @@ -15,8 +15,7 @@
15 15 #ifdef HAVE_CONFIG_H
16 16 #include <config.h>
17 17 #endif
18   -#include <iostream>
19   -#include <string.h>
  18 +#include <string>
20 19 #include "GException.hpp"
21 20 #include "GTools.hpp"
22 21 #include "GFitsCfitsio.hpp"
... ... @@ -328,7 +327,7 @@ void GFitsTableStringCol::copy_members(const GFitsTableStringCol&amp; column)
328 327 // Copy NULL value
329 328 if (column.m_nulval != NULL) {
330 329 m_nulval = new char[m_width+1];
331   - strncpy(m_nulval, column.m_nulval, m_width);
  330 + strncpy(m_nulval, column.m_nulval, m_width);
332 331 }
333 332  
334 333 // Small memory option: release column if it was fetch above
... ... @@ -622,18 +621,3 @@ void GFitsTableStringCol::free_buffer(void)
622 621 = Friends =
623 622 = =
624 623 ==========================================================================*/
625   -
626   -/***********************************************************************//**
627   - * @brief Output operator
628   - *
629   - * @param[in] os Output stream.
630   - * @param[in] column Column to put in output stream.
631   - ***************************************************************************/
632   -std::ostream& operator<< (std::ostream& os, const GFitsTableStringCol& column)
633   -{
634   - // Dump column in output stream
635   - column.dump_column(os, column.m_data);
636   -
637   - // Return output stream
638   - return os;
639   -}
... ...
src/fits/GFitsTableULongCol.cpp
... ... @@ -15,7 +15,7 @@
15 15 #ifdef HAVE_CONFIG_H
16 16 #include <config.h>
17 17 #endif
18   -#include <iostream>
  18 +#include <string>
19 19 #include "GException.hpp"
20 20 #include "GTools.hpp"
21 21 #include "GFitsCfitsio.hpp"
... ... @@ -476,18 +476,3 @@ void GFitsTableULongCol::init_data(void)
476 476 = Friends =
477 477 = =
478 478 ==========================================================================*/
479   -
480   -/***********************************************************************//**
481   - * @brief Output operator
482   - *
483   - * @param[in] os Output stream.
484   - * @param[in] column Column to put in output stream.
485   - ***************************************************************************/
486   -std::ostream& operator<< (std::ostream& os, const GFitsTableULongCol& column)
487   -{
488   - // Dump column in output stream
489   - column.dump_column(os, column.m_data);
490   -
491   - // Return output stream
492   - return os;
493   -}
... ...
src/fits/GFitsTableUShortCol.cpp
... ... @@ -15,7 +15,7 @@
15 15 #ifdef HAVE_CONFIG_H
16 16 #include <config.h>
17 17 #endif
18   -#include <iostream>
  18 +#include <string>
19 19 #include "GException.hpp"
20 20 #include "GTools.hpp"
21 21 #include "GFitsCfitsio.hpp"
... ... @@ -476,18 +476,3 @@ void GFitsTableUShortCol::init_data(void)
476 476 = Friends =
477 477 = =
478 478 ==========================================================================*/
479   -
480   -/***********************************************************************//**
481   - * @brief Output operator
482   - *
483   - * @param[in] os Output stream.
484   - * @param[in] column Column to put in output stream.
485   - ***************************************************************************/
486   -std::ostream& operator<< (std::ostream& os, const GFitsTableUShortCol& column)
487   -{
488   - // Dump column in output stream
489   - column.dump_column(os, column.m_data);
490   -
491   - // Return output stream
492   - return os;
493   -}
... ...