[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
|
---|
| 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 |
|
---|
[2693] | 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
|
---|
[2691] | 29 | inline DataTable& operator = (DataTable const& a)
|
---|
| 30 | { CopyMerge(a, true) ; return *this ; }
|
---|
| 31 |
|
---|
[2688] | 32 | // Pour la gestion de persistance PPF
|
---|
[2699] | 33 | friend class ObjFileIO<BaseDataTable> ;
|
---|
[2688] | 34 | // pour fichiers FITS
|
---|
| 35 | friend class FITS_DataTable;
|
---|
| 36 |
|
---|
| 37 | //! Reset the table content and structure
|
---|
[2699] | 38 | virtual void Clear();
|
---|
[2688] | 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)
|
---|
[2699] | 53 | { ObjFileIO<BaseDataTable> fio(&obj); fio.Write(os); return(os); }
|
---|
[2688] | 54 | /*! Reads the object from the PInPersist stream \b is */
|
---|
| 55 | inline PInPersist& operator >> (PInPersist& is, DataTable & obj)
|
---|
[2699] | 56 | { ObjFileIO<BaseDataTable> fio(&obj); is.SkipToNextObject();
|
---|
| 57 | fio.Read(is); return(is); }
|
---|
[2688] | 58 | // Classe pour la gestion de persistance
|
---|
[2699] | 59 | // ObjFileIO<BaseDataTable>
|
---|
[2688] | 60 | } // namespace SOPHYA
|
---|
| 61 |
|
---|
| 62 | #endif
|
---|
| 63 |
|
---|