[2696] | 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 SWPPFDTABLE_H_SEEN
|
---|
| 7 | #define SWPPFDTABLE_H_SEEN
|
---|
| 8 |
|
---|
| 9 | #include "basedtable.h"
|
---|
| 10 | #include "swsegdb.h"
|
---|
| 11 | #include "ppfswapper.h"
|
---|
| 12 | #include "objfio.h"
|
---|
| 13 |
|
---|
| 14 |
|
---|
| 15 | namespace SOPHYA {
|
---|
| 16 |
|
---|
| 17 | class SwPPFDataTable : public BaseDataTable {
|
---|
| 18 | public:
|
---|
| 19 | SwPPFDataTable(sa_size_t segsz=512);
|
---|
| 20 | SwPPFDataTable(POutPersist & os, sa_size_t segsz=512);
|
---|
| 21 | SwPPFDataTable(SwPPFDataTable const& a);
|
---|
| 22 |
|
---|
| 23 | virtual sa_size_t AddColumn(FieldType ft, string const & cnom);
|
---|
| 24 |
|
---|
| 25 | // Filling data structures (adding lines)
|
---|
| 26 | virtual sa_size_t AddLine(const r_8* data);
|
---|
| 27 | virtual sa_size_t AddLine(const MuTyV * data);
|
---|
| 28 |
|
---|
| 29 | //! Equal (copy) operator - Copies the structure and shares the data \b a
|
---|
| 30 | inline SwPPFDataTable& operator = (SwPPFDataTable const& a)
|
---|
| 31 | { Clear(); Share(a); return *this ; }
|
---|
| 32 |
|
---|
| 33 | // Pour la gestion de persistance PPF
|
---|
| 34 | friend class ObjFileIO<SwPPFDataTable> ;
|
---|
| 35 |
|
---|
| 36 | //! Reset the table content and structure
|
---|
| 37 | void Clear();
|
---|
| 38 | /*! This method should be called in order to empty the swapout buffer,
|
---|
| 39 | before saving object to PPF stream
|
---|
| 40 | */
|
---|
| 41 | void SwapOutAll() const;
|
---|
| 42 | protected:
|
---|
| 43 | SwPPFDataTable(PInPersist & is, sa_size_t segsz);
|
---|
| 44 | void Share(SwPPFDataTable const & a);
|
---|
| 45 |
|
---|
| 46 | // Donnees en memoire
|
---|
| 47 | std::vector< SwSegDataBlock<int_4> > mICols;
|
---|
| 48 | PPFDataSwapper<int_4> mISwapper;
|
---|
| 49 | std::vector< SwSegDataBlock<int_8> > mLCols;
|
---|
| 50 | PPFDataSwapper<int_8> mLSwapper;
|
---|
| 51 | std::vector< SwSegDataBlock<r_4> > mFCols;
|
---|
| 52 | PPFDataSwapper<r_4> mFSwapper;
|
---|
| 53 | std::vector< SwSegDataBlock<r_8> > mDCols;
|
---|
| 54 | PPFDataSwapper<r_8> mDSwapper;
|
---|
| 55 | std::vector< SwSegDataBlock<string> > mSCols;
|
---|
| 56 | PPFDataSwapper<string> mSSwapper;
|
---|
| 57 |
|
---|
| 58 | POutPersist* mSwOut;
|
---|
| 59 | PInPersist* mSwIn;
|
---|
| 60 | };
|
---|
| 61 |
|
---|
| 62 | /*! Writes the object in the POutPersist stream \b os */
|
---|
| 63 | inline POutPersist& operator << (POutPersist& os, SwPPFDataTable & obj)
|
---|
| 64 | { obj.SwapOutAll(); ObjFileIO<SwPPFDataTable> fio(&obj); fio.Write(os); return(os); }
|
---|
| 65 | /*! Reads the object from the PInPersist stream \b is */
|
---|
| 66 | inline PInPersist& operator >> (PInPersist& is, SwPPFDataTable & obj)
|
---|
| 67 | { ObjFileIO<SwPPFDataTable> fio(&obj); is.SkipToNextObject(); fio.Read(is); return(is); }
|
---|
| 68 | // Classe pour la gestion de persistance
|
---|
| 69 | // ObjFileIO<SwPPFDataTable>
|
---|
| 70 | } // namespace SOPHYA
|
---|
| 71 |
|
---|
| 72 | #endif
|
---|
| 73 |
|
---|