source: Sophya/trunk/SophyaLib/TArray/fioarr.h@ 785

Last change on this file since 785 was 772, checked in by ansari, 26 years ago

Separation MatrixRC et TMatrix, etc ... - Creation de TArray<T> Reza 10/3/2000

File size: 1.2 KB
Line 
1// This may look like C code, but it is really -*- C++ -*-
2// template array class for numerical types
3// R. Ansari, C.Magneville 03/2000
4
5#ifndef FIOTArray_SEEN
6#define FIOTArray_SEEN
7
8#include "machdefs.h"
9#include <iostream.h>
10#include "tarray.h"
11#include "ppersist.h"
12
13namespace SOPHYA {
14/////////////////////////////////////////////////////////////////////////
15// Classe pour la gestion de persistance
16template <class T>
17class FIO_TArray : public PPersist {
18public:
19 FIO_TArray();
20 FIO_TArray(string const & filename);
21 FIO_TArray(const TArray<T> & obj);
22 FIO_TArray(TArray<T> * obj);
23 virtual ~FIO_TArray();
24 virtual AnyDataObj* DataObj();
25 virtual void SetDataObj(AnyDataObj & o);
26 inline operator TArray<T>() { return(*dobj); }
27protected :
28 virtual void ReadSelf(PInPersist&);
29 virtual void WriteSelf(POutPersist&) const;
30 TArray<T> * dobj;
31 bool ownobj;
32};
33
34template <class T>
35inline POutPersist& operator << (POutPersist& os, TArray<T> & obj)
36{ FIO_TArray<T> fio(&obj); fio.Write(os); return(os); }
37template <class T>
38inline PInPersist& operator >> (PInPersist& is, TArray<T> & obj)
39{ FIO_TArray<T> fio(&obj); fio.Read(is); return(is); }
40
41} // Fin du namespace
42
43#endif
Note: See TracBrowser for help on using the repository browser.