| 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
|
|---|
| 16 | class FITS_DataTable;
|
|---|
| 17 |
|
|---|
| 18 | class DataTable : public BaseDataTable {
|
|---|
| 19 | public:
|
|---|
| 20 | DataTable(sa_size_t segsz=512);
|
|---|
| 21 | DataTable(DataTable const& a, bool share=true);
|
|---|
| 22 |
|
|---|
| 23 | virtual sa_size_t AddColumn(FieldType ft, string const & cnom);
|
|---|
| 24 |
|
|---|
| 25 | //! Equal (copy) operator - Copies the data and the structure if necessary from \b a
|
|---|
| 26 | inline DataTable& operator = (BaseDataTable const& a)
|
|---|
| 27 | { CopyMerge(a, true) ; return *this ; }
|
|---|
| 28 | //! Equal (copy) operator - Copies the data and the structure if necessary from \b a
|
|---|
| 29 | inline DataTable& operator = (DataTable const& a)
|
|---|
| 30 | { CopyMerge(a, true) ; return *this ; }
|
|---|
| 31 |
|
|---|
| 32 | // Pour la gestion de persistance PPF
|
|---|
| 33 | friend class ObjFileIO<BaseDataTable> ;
|
|---|
| 34 | // pour fichiers FITS
|
|---|
| 35 | friend class FITS_DataTable;
|
|---|
| 36 |
|
|---|
| 37 | //! Reset the table content and structure
|
|---|
| 38 | virtual void Clear();
|
|---|
| 39 | protected:
|
|---|
| 40 | void Share(DataTable const & a);
|
|---|
| 41 | void Clone(DataTable const & a);
|
|---|
| 42 |
|
|---|
| 43 | // Donnees en memoire
|
|---|
| 44 | std::vector< SegDataBlock<int_4> > mICols;
|
|---|
| 45 | std::vector< SegDataBlock<int_8> > mLCols;
|
|---|
| 46 | std::vector< SegDataBlock<r_4> > mFCols;
|
|---|
| 47 | std::vector< SegDataBlock<r_8> > mDCols;
|
|---|
| 48 | std::vector< SegDataBlock<string> > mSCols;
|
|---|
| 49 | };
|
|---|
| 50 |
|
|---|
| 51 | /*! Writes the object in the POutPersist stream \b os */
|
|---|
| 52 | inline POutPersist& operator << (POutPersist& os, DataTable & obj)
|
|---|
| 53 | { ObjFileIO<BaseDataTable> fio(&obj); fio.Write(os); return(os); }
|
|---|
| 54 | /*! Reads the object from the PInPersist stream \b is */
|
|---|
| 55 | inline PInPersist& operator >> (PInPersist& is, DataTable & obj)
|
|---|
| 56 | { ObjFileIO<BaseDataTable> fio(&obj); is.SkipToNextObject();
|
|---|
| 57 | fio.Read(is); return(is); }
|
|---|
| 58 | // Classe pour la gestion de persistance
|
|---|
| 59 | // ObjFileIO<BaseDataTable>
|
|---|
| 60 | } // namespace SOPHYA
|
|---|
| 61 |
|
|---|
| 62 | #endif
|
|---|
| 63 |
|
|---|