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

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

MAJ commentaires pour documentation doxygen - Reza 9 Juin 2005

File size: 4.5 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//----------------------------------------------------------------------
11/*!
12 \class SOPHYA::PPF_TPointer_IO
13 \ingroup BaseTools
14 A template utility class with static methods to ease handling of array
15 I/O in PPF streams (POutPersist and PInPersist). It is not intented for
16 direct use in user programs, but for writing PPF persistence handler
17 classes (PPersist).
18 The C++ I/O operators POutPersist& << and PInPersist& >> should be defined for
19 new types and classes.
20*/
21
22namespace SOPHYA {
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//! \cond
40// declaration specifique pour ecriture sous forme de tableaux PPF
41DECL_TEMP_SPEC /* equivalent a template <> , pour SGI-CC en particulier */
42class PPF_TPointer_IO<char> {
43public:
44 static void Write(POutPersist & os, char const * arr, size_t n);
45 static void Read(PInPersist & is, char * arr, size_t n);
46};
47
48DECL_TEMP_SPEC /* equivalent a template <> , pour SGI-CC en particulier */
49class PPF_TPointer_IO<int_1> {
50public:
51 static void Write(POutPersist & os, int_1 const * arr, size_t n);
52 static void Read(PInPersist & is, int_1 * arr, size_t n);
53};
54DECL_TEMP_SPEC /* equivalent a template <> , pour SGI-CC en particulier */
55class PPF_TPointer_IO<uint_1> {
56public:
57 static void Write(POutPersist & os, uint_1 const * arr, size_t n);
58 static void Read(PInPersist & is, uint_1 * arr, size_t n);
59};
60
61DECL_TEMP_SPEC /* equivalent a template <> , pour SGI-CC en particulier */
62class PPF_TPointer_IO<int_2> {
63public:
64 static void Write(POutPersist & os, int_2 const * arr, size_t n);
65 static void Read(PInPersist & is, int_2 * arr, size_t n);
66};
67DECL_TEMP_SPEC /* equivalent a template <> , pour SGI-CC en particulier */
68class PPF_TPointer_IO<uint_2> {
69public:
70 static void Write(POutPersist & os, uint_2 const * arr, size_t n);
71 static void Read(PInPersist & is, uint_2 * arr, size_t n);
72};
73
74DECL_TEMP_SPEC /* equivalent a template <> , pour SGI-CC en particulier */
75class PPF_TPointer_IO<int_4> {
76public:
77 static void Write(POutPersist & os, int_4 const * arr, size_t n);
78 static void Read(PInPersist & is, int_4 * arr, size_t n);
79};
80DECL_TEMP_SPEC /* equivalent a template <> , pour SGI-CC en particulier */
81class PPF_TPointer_IO<uint_4> {
82public:
83 static void Write(POutPersist & os, uint_4 const * arr, size_t n);
84 static void Read(PInPersist & is, uint_4 * arr, size_t n);
85};
86
87DECL_TEMP_SPEC /* equivalent a template <> , pour SGI-CC en particulier */
88class PPF_TPointer_IO<int_8> {
89public:
90 static void Write(POutPersist & os, int_8 const * arr, size_t n);
91 static void Read(PInPersist & is, int_8 * arr, size_t n);
92};
93DECL_TEMP_SPEC /* equivalent a template <> , pour SGI-CC en particulier */
94class PPF_TPointer_IO<uint_8> {
95public:
96 static void Write(POutPersist & os, uint_8 const * arr, size_t n);
97 static void Read(PInPersist & is, uint_8 * arr, size_t n);
98};
99
100DECL_TEMP_SPEC /* equivalent a template <> , pour SGI-CC en particulier */
101class PPF_TPointer_IO<r_4> {
102public:
103 static void Write(POutPersist & os, r_4 const * arr, size_t n);
104 static void Read(PInPersist & is, r_4 * arr, size_t n);
105};
106DECL_TEMP_SPEC /* equivalent a template <> , pour SGI-CC en particulier */
107class PPF_TPointer_IO<r_8> {
108public:
109 static void Write(POutPersist & os, r_8 const * arr, size_t n);
110 static void Read(PInPersist & is, r_8 * arr, size_t n);
111};
112
113DECL_TEMP_SPEC /* equivalent a template <> , pour SGI-CC en particulier */
114class PPF_TPointer_IO< complex<r_4> > {
115public:
116 static void Write(POutPersist & os, complex<r_4> const * arr, size_t n);
117 static void Read(PInPersist & is, complex<r_4> * arr, size_t n);
118};
119DECL_TEMP_SPEC /* equivalent a template <> , pour SGI-CC en particulier */
120class PPF_TPointer_IO< complex<r_8> > {
121public:
122 static void Write(POutPersist & os, complex<r_8> const * arr, size_t n);
123 static void Read(PInPersist & is, complex<r_8> * arr, size_t n);
124};
125
126//! \endcond
127} // namespace SOPHYA
128
129#endif /* PPFTPOINTERIO_H_SEEN */
Note: See TracBrowser for help on using the repository browser.