source: Sophya/trunk/SophyaLib/HiStats/swppfdtable.h@ 2700

Last change on this file since 2700 was 2699, checked in by ansari, 20 years ago

1/ Corrections diverses ds BaseDataTable, en particulier GetSegment() -> GetCstSegment(), et ameliorations/debug divers
2/ Classe SWPPFDataTable debugge, rendu +/- operationnelle
3/ Gestionnaire PPersist de DataTable et SWPPFDataTable fusionnee en une seule
classe ObjFileIO<BaseDataTable> - mis ds fio_dtable.cc
4/ mis a jour histats.h avec swppfdtable.h, objlist.list et histinit.cc

Reza, 27 Avril 2005

File size: 2.6 KB
Line 
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
15namespace SOPHYA {
16
17class SwPPFDataTable : public BaseDataTable {
18public:
19 SwPPFDataTable(sa_size_t segsz=512);
20 SwPPFDataTable(POutPersist & os, sa_size_t segsz=512);
21 SwPPFDataTable(SwPPFDataTable const& a);
22
23 virtual ~SwPPFDataTable();
24
25 virtual sa_size_t AddColumn(FieldType ft, string const & cnom);
26
27 // Filling data structures (adding lines)
28 virtual sa_size_t AddLine(const r_8* data);
29 virtual sa_size_t AddLine(const MuTyV * data);
30
31 //! Equal (copy) operator - Copies the structure and shares the data \b a
32 inline SwPPFDataTable& operator = (SwPPFDataTable const& a)
33 { Clear(); Share(a); return *this ; }
34
35 // Pour la gestion de persistance PPF
36 friend class ObjFileIO<BaseDataTable> ;
37
38 //! Reset the table content and structure
39 virtual void Clear();
40 /*! This method should be called in order to empty the swapout buffer,
41 before saving object to PPF stream
42 */
43 void SwapOutAll() const;
44protected:
45 SwPPFDataTable(PInPersist & is, sa_size_t segsz);
46 void Share(SwPPFDataTable const & a);
47
48 // Donnees en memoire
49 std::vector< SwSegDataBlock<int_4> > mICols;
50 PPFDataSwapper<int_4> mISwapper;
51 std::vector< SwSegDataBlock<int_8> > mLCols;
52 PPFDataSwapper<int_8> mLSwapper;
53 std::vector< SwSegDataBlock<r_4> > mFCols;
54 PPFDataSwapper<r_4> mFSwapper;
55 std::vector< SwSegDataBlock<r_8> > mDCols;
56 PPFDataSwapper<r_8> mDSwapper;
57 std::vector< SwSegDataBlock<string> > mSCols;
58 PPFDataSwapper<string> mSSwapper;
59
60 // Output swap stream doit etre cree avant l'appel au constructeur
61 // et rester valide (non detruit) tant que l'objet SwPPFDataTable existe
62 POutPersist* mSwOut;
63 // Input swap stream - On cree un input swap stream et on fait
64 // un comptage de reference pour le detruire lorsque tous les tables
65 // l'utilisant sont supprimes
66 typedef struct { PInPersist* pis; uint_4 refcnt; } St_InSwap;
67 St_InSwap * mSwIn;
68};
69
70/*! Writes the object in the POutPersist stream \b os */
71inline POutPersist& operator << (POutPersist& os, SwPPFDataTable & obj)
72{ obj.SwapOutAll(); ObjFileIO<BaseDataTable> fio(&obj); fio.Write(os); return(os); }
73/*! Reads the object from the PInPersist stream \b is */
74inline PInPersist& operator >> (PInPersist& is, SwPPFDataTable & obj)
75{ ObjFileIO<BaseDataTable> fio(&obj); is.SkipToNextObject(); fio.Read(is); return(is); }
76
77} // namespace SOPHYA
78
79#endif
80
Note: See TracBrowser for help on using the repository browser.