[2688] | 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 DATATABLE_H_SEEN
|
---|
| 7 | #define DATATABLE_H_SEEN
|
---|
| 8 |
|
---|
| 9 | #include "basedtable.h"
|
---|
| 10 | #include "objfio.h"
|
---|
| 11 |
|
---|
| 12 |
|
---|
| 13 | namespace SOPHYA {
|
---|
| 14 |
|
---|
| 15 | // Forward class declaration for Fits handler
|
---|
[2822] | 16 | template <class T> class FitsHandler;
|
---|
[2688] | 17 |
|
---|
[2808] | 18 | //! An implementation of BaseDataTable with data (columns) stored in memory.
|
---|
[2688] | 19 | class DataTable : public BaseDataTable {
|
---|
| 20 | public:
|
---|
| 21 | DataTable(sa_size_t segsz=512);
|
---|
| 22 | DataTable(DataTable const& a, bool share=true);
|
---|
| 23 |
|
---|
| 24 | virtual sa_size_t AddColumn(FieldType ft, string const & cnom);
|
---|
| 25 |
|
---|
[2693] | 26 | //! Equal (copy) operator - Copies the data and the structure if necessary from \b a
|
---|
| 27 | inline DataTable& operator = (BaseDataTable const& a)
|
---|
| 28 | { CopyMerge(a, true) ; return *this ; }
|
---|
| 29 | //! Equal (copy) operator - Copies the data and the structure if necessary from \b a
|
---|
[2691] | 30 | inline DataTable& operator = (DataTable const& a)
|
---|
| 31 | { CopyMerge(a, true) ; return *this ; }
|
---|
| 32 |
|
---|
[2688] | 33 | // Pour la gestion de persistance PPF
|
---|
[2699] | 34 | friend class ObjFileIO<BaseDataTable> ;
|
---|
[2688] | 35 | // pour fichiers FITS
|
---|
[2822] | 36 | friend class FitsHandler<BaseDataTable>;
|
---|
| 37 |
|
---|
[2688] | 38 | //! Reset the table content and structure
|
---|
[2699] | 39 | virtual void Clear();
|
---|
[2688] | 40 | protected:
|
---|
| 41 | void Share(DataTable const & a);
|
---|
| 42 | void Clone(DataTable const & a);
|
---|
| 43 |
|
---|
| 44 | // Donnees en memoire
|
---|
| 45 | std::vector< SegDataBlock<int_4> > mICols;
|
---|
| 46 | std::vector< SegDataBlock<int_8> > mLCols;
|
---|
| 47 | std::vector< SegDataBlock<r_4> > mFCols;
|
---|
| 48 | std::vector< SegDataBlock<r_8> > mDCols;
|
---|
[2827] | 49 | std::vector< SegDataBlock< complex<r_4> > > mYCols;
|
---|
| 50 | std::vector< SegDataBlock< complex<r_8> > > mZCols;
|
---|
[2688] | 51 | std::vector< SegDataBlock<string> > mSCols;
|
---|
| 52 | };
|
---|
| 53 |
|
---|
| 54 | /*! Writes the object in the POutPersist stream \b os */
|
---|
| 55 | inline POutPersist& operator << (POutPersist& os, DataTable & obj)
|
---|
[2699] | 56 | { ObjFileIO<BaseDataTable> fio(&obj); fio.Write(os); return(os); }
|
---|
[2688] | 57 | /*! Reads the object from the PInPersist stream \b is */
|
---|
| 58 | inline PInPersist& operator >> (PInPersist& is, DataTable & obj)
|
---|
[2699] | 59 | { ObjFileIO<BaseDataTable> fio(&obj); is.SkipToNextObject();
|
---|
| 60 | fio.Read(is); return(is); }
|
---|
[2688] | 61 | // Classe pour la gestion de persistance
|
---|
[2699] | 62 | // ObjFileIO<BaseDataTable>
|
---|
[2688] | 63 | } // namespace SOPHYA
|
---|
| 64 |
|
---|
| 65 | #endif
|
---|
| 66 |
|
---|