[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 |
|
---|
[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
|
---|
| 36 | friend class FITS_DataTable;
|
---|
| 37 |
|
---|
| 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;
|
---|
| 49 | std::vector< SegDataBlock<string> > mSCols;
|
---|
| 50 | };
|
---|
| 51 |
|
---|
| 52 | /*! Writes the object in the POutPersist stream \b os */
|
---|
| 53 | inline POutPersist& operator << (POutPersist& os, DataTable & obj)
|
---|
[2699] | 54 | { ObjFileIO<BaseDataTable> fio(&obj); fio.Write(os); return(os); }
|
---|
[2688] | 55 | /*! Reads the object from the PInPersist stream \b is */
|
---|
| 56 | inline PInPersist& operator >> (PInPersist& is, DataTable & obj)
|
---|
[2699] | 57 | { ObjFileIO<BaseDataTable> fio(&obj); is.SkipToNextObject();
|
---|
| 58 | fio.Read(is); return(is); }
|
---|
[2688] | 59 | // Classe pour la gestion de persistance
|
---|
[2699] | 60 | // ObjFileIO<BaseDataTable>
|
---|
[2688] | 61 | } // namespace SOPHYA
|
---|
| 62 |
|
---|
| 63 | #endif
|
---|
| 64 |
|
---|