source: Sophya/trunk/SophyaExt/FitsIOServer/swfitsdtable.h@ 3111

Last change on this file since 3111 was 3069, checked in by ansari, 19 years ago

Correction plusieurs bugs lies a SwFitsDataTable - Reza 08/09/2006

File size: 2.6 KB
Line 
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
13#include "fitshandler.h"
14
15namespace SOPHYA {
16
17//! An implementation of BaseDataTable with using FITS files as swap space.
18class SwFitsDataTable : public BaseDataTable {
19public:
20 SwFitsDataTable(sa_size_t segsz=512);
21 SwFitsDataTable(FitsInOutFile & os, sa_size_t segsz=512, bool fgcreate=true);
22 SwFitsDataTable(string fitsname, int hdunum=2, sa_size_t segsz=512);
23 SwFitsDataTable(SwFitsDataTable const& a);
24
25 virtual ~SwFitsDataTable();
26
27 virtual sa_size_t AddColumn(FieldType ft, string const & cnom);
28
29 // Filling data structures (adding lines)
30 virtual sa_size_t AddRow(const r_8* data);
31 virtual sa_size_t AddRow(const MuTyV * data);
32 virtual sa_size_t AddRow(DataTableRow const& data);
33
34 //! Equal (copy) operator - Copies the data and the structure from \b a
35 inline SwFitsDataTable& operator = (BaseDataTable const& a)
36 { CopyMerge(a, true) ; return *this ; }
37 //! Equal (copy) operator - Copies the structure and shares the data \b a
38 inline SwFitsDataTable& operator = (SwFitsDataTable const& a)
39 { Clear(); Share(a); return *this ; }
40
41 //! Acces the FitsInOutFile swap stream
42 inline FitsInOutFile& FitsSwapFile() { return mSwF; }
43
44 //! Reset(Clear) the table content and structure
45 virtual void Clear();
46 /*! This method should be called in order to empty the swapout buffer,
47 before saving object to PPF stream
48 */
49 void SwapOutAll() const;
50
51 // Pour la gestion I/O FITS
52 friend class FitsHandler<BaseDataTable> ;
53
54protected:
55 void Share(SwFitsDataTable const & a);
56 // Methode pour utilisation par FitsHandler<BaseDataTable>
57 sa_size_t AddColRd(FieldType ft, string const & cnom, int colidx=-1,
58 vector<int_8> const * swpos=NULL);
59
60
61 // Donnees (SegDataBlock) et leurs swapper
62 std::vector< SwSegDataBlock<int_4> > mICols;
63 std::vector< SwSegDataBlock<int_8> > mLCols;
64 std::vector< SwSegDataBlock<r_4> > mFCols;
65 std::vector< SwSegDataBlock<r_8> > mDCols;
66 std::vector< SwSegDataBlock< complex<r_4> > > mYCols;
67 std::vector< SwSegDataBlock< complex<r_8> > > mZCols;
68 std::vector< SwSegDataBlock<string> > mSCols;
69
70 // In/Out swap file doit etre cree avant l'appel au constructeur
71 // et rester valide (non detruit) tant que l'objet SwFitsDataTable existe
72 FitsInOutFile mSwF;
73 bool mFgCreate; // true -> creation de table, false -> lecture
74};
75
76
77} // namespace SOPHYA
78
79#endif
80
Note: See TracBrowser for help on using the repository browser.