[2865] | 1 | // This may look like C code, but it is really -*- C++ -*-
|
---|
| 2 | // Class DataTable (Row-Column data table in memory)
|
---|
| 3 | // R. Ansari - Avril 2005
|
---|
| 4 | // (C) LAL-IN2P3/CNRS CEA-DAPNIA
|
---|
| 5 |
|
---|
| 6 | #ifndef SWFITSDTABLE_H_SEEN
|
---|
| 7 | #define SWFITSDTABLE_H_SEEN
|
---|
| 8 |
|
---|
| 9 | #include "basedtable.h"
|
---|
| 10 | #include "swsegdb.h"
|
---|
| 11 | #include "fitsswapper.h"
|
---|
| 12 |
|
---|
[3069] | 13 | #include "fitshandler.h"
|
---|
[2865] | 14 |
|
---|
| 15 | namespace SOPHYA {
|
---|
| 16 |
|
---|
| 17 | //! An implementation of BaseDataTable with using FITS files as swap space.
|
---|
| 18 | class SwFitsDataTable : public BaseDataTable {
|
---|
| 19 | public:
|
---|
| 20 | SwFitsDataTable(sa_size_t segsz=512);
|
---|
| 21 | SwFitsDataTable(FitsInOutFile & os, sa_size_t segsz=512, bool fgcreate=true);
|
---|
[3069] | 22 | SwFitsDataTable(string fitsname, int hdunum=2, sa_size_t segsz=512);
|
---|
[2865] | 23 | SwFitsDataTable(SwFitsDataTable const& a);
|
---|
| 24 |
|
---|
| 25 | virtual ~SwFitsDataTable();
|
---|
| 26 |
|
---|
| 27 | virtual sa_size_t AddColumn(FieldType ft, string const & cnom);
|
---|
| 28 |
|
---|
[3395] | 29 | virtual sa_size_t WriteTableDefinitionToFits();
|
---|
| 30 |
|
---|
[2865] | 31 | // Filling data structures (adding lines)
|
---|
[2889] | 32 | virtual sa_size_t AddRow(const r_8* data);
|
---|
| 33 | virtual sa_size_t AddRow(const MuTyV * data);
|
---|
[3032] | 34 | virtual sa_size_t AddRow(DataTableRow const& data);
|
---|
[2865] | 35 |
|
---|
[2889] | 36 | //! Equal (copy) operator - Copies the data and the structure from \b a
|
---|
| 37 | inline SwFitsDataTable& operator = (BaseDataTable const& a)
|
---|
| 38 | { CopyMerge(a, true) ; return *this ; }
|
---|
| 39 | //! Equal (copy) operator - Copies the structure and shares the data \b a
|
---|
[2865] | 40 | inline SwFitsDataTable& operator = (SwFitsDataTable const& a)
|
---|
| 41 | { Clear(); Share(a); return *this ; }
|
---|
| 42 |
|
---|
[2889] | 43 | //! Acces the FitsInOutFile swap stream
|
---|
| 44 | inline FitsInOutFile& FitsSwapFile() { return mSwF; }
|
---|
[2865] | 45 |
|
---|
| 46 | //! Reset(Clear) the table content and structure
|
---|
| 47 | virtual void Clear();
|
---|
| 48 | /*! This method should be called in order to empty the swapout buffer,
|
---|
| 49 | before saving object to PPF stream
|
---|
| 50 | */
|
---|
| 51 | void SwapOutAll() const;
|
---|
| 52 |
|
---|
| 53 | // Pour la gestion I/O FITS
|
---|
| 54 | friend class FitsHandler<BaseDataTable> ;
|
---|
| 55 |
|
---|
| 56 | protected:
|
---|
| 57 | void Share(SwFitsDataTable const & a);
|
---|
| 58 | // Methode pour utilisation par FitsHandler<BaseDataTable>
|
---|
[2889] | 59 | sa_size_t AddColRd(FieldType ft, string const & cnom, int colidx=-1,
|
---|
| 60 | vector<int_8> const * swpos=NULL);
|
---|
[2865] | 61 |
|
---|
| 62 |
|
---|
| 63 | // Donnees (SegDataBlock) et leurs swapper
|
---|
| 64 | std::vector< SwSegDataBlock<int_4> > mICols;
|
---|
| 65 | std::vector< SwSegDataBlock<int_8> > mLCols;
|
---|
| 66 | std::vector< SwSegDataBlock<r_4> > mFCols;
|
---|
| 67 | std::vector< SwSegDataBlock<r_8> > mDCols;
|
---|
| 68 | std::vector< SwSegDataBlock< complex<r_4> > > mYCols;
|
---|
| 69 | std::vector< SwSegDataBlock< complex<r_8> > > mZCols;
|
---|
| 70 | std::vector< SwSegDataBlock<string> > mSCols;
|
---|
| 71 |
|
---|
| 72 | // In/Out swap file doit etre cree avant l'appel au constructeur
|
---|
| 73 | // et rester valide (non detruit) tant que l'objet SwFitsDataTable existe
|
---|
| 74 | FitsInOutFile mSwF;
|
---|
| 75 | bool mFgCreate; // true -> creation de table, false -> lecture
|
---|
[3395] | 76 | bool mFgDefDone; // true -> Definition de bin-table effectuee
|
---|
[2865] | 77 | };
|
---|
[3069] | 78 |
|
---|
[2865] | 79 |
|
---|
| 80 | } // namespace SOPHYA
|
---|
| 81 |
|
---|
| 82 | #endif
|
---|
| 83 |
|
---|