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

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

1/ Suppression print de debug ds fiosegdb.h
2/ Ajout fichier ppftpointerio.cc avec les implementation specifiques de
la classe PPF_TPointer_IO<T> - qui etaient ds le .h , produisant des
warning 'multiply defined' avec OSF pour la fabrication shared-libs
3/ MAJ numero de version et Makefile

Reza 25/4/2005

File size: 1.2 KB
Line 
1// This may look like C code, but it is really -*- C++ -*-
2// Classe pour faciliter entree-sortie PPF pour des pointeurs
3// R. Ansari - Mars 2005
4
5#ifndef PPFTPOINTERIO_H_SEEN
6#define PPFTPOINTERIO_H_SEEN
7
8#include "ppersist.h"
9
10//----------------------------------------------------------------------
11namespace SOPHYA {
12
13/*!
14 \class SOPHYA::PPF_TPointer_IO
15 \ingroup BaseTools
16 A template utility class with static methods to ease handling of array
17 I/O in PPF streams (POutPersist and PInPersist). It is not intented for
18 direct use in user programs, but for writing PPF persistence handler
19 classes (PPersist).
20 The C++ I/O operators POutPersist& << and PInPersist& >> should be defined for
21 new types and classes.
22*/
23
24template <class T>
25class PPF_TPointer_IO {
26public:
27 //! Writes the array pointed to by \b arr (size \b n) to POutPersist stream \b os
28 static void Write(POutPersist & os, T const * arr, size_t n)
29 {
30 for(size_t k=0; k<n; k++) os << arr[k];
31 }
32 //! Reads from the PInPersist \b is into array pointed to by \b arr (size \b n)
33 static void Read(PInPersist & is, T * arr, size_t n)
34 {
35 for(size_t k=0; k<n; k++) is >> arr[k];
36 }
37};
38
39
40} // namespace SOPHYA
41
42#endif /* PPFTPOINTERIO_H_SEEN */
Note: See TracBrowser for help on using the repository browser.