source: Sophya/trunk/SophyaLib/BaseTools/ppfswapper.h@ 2687

Last change on this file since 2687 was 2660, checked in by ansari, 20 years ago

1/ Ajout de la classe PPFWrapperSTLVector<T> pour gestion de persistence
PPF des vecteurs de STL (fichier ppfwrapstlv.h)
2/ Ajout de la classe SegDataBlock<T> (et l'interface SegDBInterface<T>)
pour la gestion de blocs de donnees segmentes (segdatablock.h) et son
gestionnaire PPF FIO_SegDataBlock<T> (fichier fiosegdb.h )
3/ Ajout de la classe SwSegDataBlock<T> (Data bloc segmente avec gestion
de swap) et la classe swapper PPF PPFDataSwapper<T> (fichiers
ppfswapper.h et swsegdb.h)
4/ Ajout de la classes utilitaire PPF_TPointer_IO<T> (fichier
ppftpointer.h)
5/ Enregistrement des classes handler PPF ds sophyainit.cc
6/ Amelioration de l'impression ds AnalyseTags (ppfbinstream.cc)
7/ MAJ Makefile et objlist.list (ajout de TimeStamp.cc en particulier)

Reza , 7 Avril 2005

File size: 1.5 KB
Line 
1// This may look like C code, but it is really -*- C++ -*-
2// Gestion de block de donnees swapable
3// R. Ansari Mars 2005
4// LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA
5#ifndef PPFSWAPPER_H
6#define PPFSWAPPER_H
7
8
9#include "machdefs.h"
10#include "swsegdb.h"
11#include "ppersist.h"
12#include "ppftpointerio.h"
13
14namespace SOPHYA {
15/*!
16 \class SOPHYA::PPFDataSwapper
17 \ingroup BaseTools
18 Implementation of SOPHYA::DataSwapperInterface interface on PPF streams
19 (POutPersist , PInPersist) to be used with SOPHYA::SwSegDataBlock classes.
20*/
21
22template <class T>
23class PPFDataSwapper : public DataSwapperInterface<T> {
24public:
25 PPFDataSwapper(POutPersist & os) { ppfos = &os; ppfis = NULL;}
26 PPFDataSwapper(PInPersist & is) { ppfos = NULL; ppfis = &is;}
27 PPFDataSwapper(PInPersist & is, POutPersist & os) { ppfos = &os; ppfis = &is;}
28 virtual int_8 WriteToSwap(const T * d, size_t sz, int_8 idx, int_8 oswp=0, bool osw=false)
29 {
30 if (ppfos == NULL) throw NotAvailableOperation("PPFDataSwapper<T>::WriteToSwap() - No POutPersist stream !");
31 int_8 tag = ppfos->WritePositionTag();
32 PPF_TPointer_IO<T>::Write(*ppfos, d, sz);
33 return tag;
34 }
35 virtual void ReadFromSwap(int_8 idx, int_8 swp, T* d, size_t sz)
36 {
37 if (ppfis == NULL) throw NotAvailableOperation("PPFDataSwapper<T>::ReadFromSwap() - No PInPersist stream !");
38 bool ok = ppfis->GotoPositionTag(swp);
39 PPF_TPointer_IO<T>::Read(*ppfis, d, sz);
40 return;
41 }
42protected:
43 POutPersist* ppfos;
44 PInPersist* ppfis;
45};
46
47} // Fin du namespace
48
49#endif
Note: See TracBrowser for help on using the repository browser.