00001
00002
00014 #ifndef FitsNTuple_H
00015 #define FitsNTuple_H
00016
00017 #include "datasrcs/DataSource.h"
00018
00019 namespace hippodraw {
00020
00021 class DataColumn;
00022 class FitsFile;
00023
00031 class MDL_HIPPOPLOT_API FitsNTuple : public DataSource
00032 {
00033
00034 private:
00035
00038 std::vector < DataColumn * > m_columns;
00039
00042 FitsFile * m_file;
00043
00047 int m_hdu_num;
00048
00054 FitsNTuple ( );
00055
00059 void checkLabel ( const std::string & label );
00060
00061 public:
00062
00065 FitsNTuple ( FitsFile * file );
00066
00069 virtual ~FitsNTuple();
00070
00074 virtual void copy ( const DataSource & );
00075
00078 const FitsFile * getFile () const;
00079
00083 virtual void notifyObservers ( ) const;
00084
00087 virtual unsigned int rows () const;
00088
00093 std::size_t size ( unsigned int c ) const;
00094
00097 virtual bool empty () const;
00098
00102 virtual void clear ();
00103
00107 virtual void reserve ( unsigned int count );
00108
00111 virtual double
00112 operator [] ( std::vector < unsigned int > & indices ) const;
00113
00114 virtual double valueAt ( unsigned int row, unsigned int column ) const;
00115
00124 int addColumn ( const std::string & label,
00125 const std::vector < double > & column );
00126
00135 virtual int addColumn ( const std::string & label,
00136 const std::vector < double > & column,
00137 const std::vector < intptr_t > & shape );
00138
00146 void replaceColumn ( unsigned int index,
00147 const std::vector < double > & data );
00148
00156 virtual void replaceColumn ( unsigned int index,
00157 const std::vector < double > & data,
00158 const std::vector < intptr_t > & shape );
00159
00166 void replaceColumn ( const std::string & label,
00167 const std::vector < double > & data,
00168 const std::vector < intptr_t > & shape );
00169
00172 virtual const std::vector < double > & getRow ( unsigned int ) const;
00173
00180 virtual void setShape ( std::vector < unsigned int > & shape );
00181
00184 const std::vector < unsigned int > & getShape () const;
00185
00186 virtual bool fillRange ( unsigned int column, Range & ) const;
00187
00190 virtual void fillShape ( std::vector < intptr_t > & shape,
00191 unsigned int index ) const;
00192
00198 virtual const std::vector < double > & getColumn ( unsigned int c ) const;
00199
00200 private:
00201
00204 void initColumns ();
00205
00209 int fillDataCache ( unsigned int column );
00210
00213 virtual double * doubleArrayAt ( unsigned int row,
00214 unsigned int column ) const;
00215
00216 };
00217
00218 }
00219
00220 #endif // FitsNTuple_H