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 "tmatrix.h"
|
---|
12 | #include "tvector.h"
|
---|
13 | #include "ppersist.h"
|
---|
14 |
|
---|
15 | namespace SOPHYA {
|
---|
16 | /////////////////////////////////////////////////////////////////////////
|
---|
17 | //! Class for persistent management of TArray
|
---|
18 | /*!
|
---|
19 | This class manage also persistence for TMatrix and TVector.
|
---|
20 | \sa TArray TMatrix TVector.
|
---|
21 | */
|
---|
22 | template <class T>
|
---|
23 | class FIO_TArray : public PPersist {
|
---|
24 | public:
|
---|
25 | FIO_TArray();
|
---|
26 | FIO_TArray(string const & filename);
|
---|
27 | FIO_TArray(const TArray<T> & obj);
|
---|
28 | FIO_TArray(TArray<T> * obj);
|
---|
29 | virtual ~FIO_TArray();
|
---|
30 | virtual AnyDataObj* DataObj();
|
---|
31 | virtual void SetDataObj(AnyDataObj & o);
|
---|
32 | inline operator TArray<T>() { return(*dobj); }
|
---|
33 | protected :
|
---|
34 | virtual void ReadSelf(PInPersist&);
|
---|
35 | virtual void WriteSelf(POutPersist&) const;
|
---|
36 | TArray<T> * dobj; //!< Pointer to the connected TArray
|
---|
37 | bool ownobj; //!< true if the connected object belong to the class
|
---|
38 | };
|
---|
39 |
|
---|
40 | //! Write TArray \b obj into POutPersist stream \b os
|
---|
41 | template <class T>
|
---|
42 | inline POutPersist& operator << (POutPersist& os, TArray<T> & obj)
|
---|
43 | { FIO_TArray<T> fio(&obj); fio.Write(os); return(os); }
|
---|
44 |
|
---|
45 | //! Read TArray \b obj from PInPersist stream \b os
|
---|
46 | template <class T>
|
---|
47 | inline PInPersist& operator >> (PInPersist& is, TArray<T> & obj)
|
---|
48 | { FIO_TArray<T> fio(&obj); fio.Read(is); return(is); }
|
---|
49 |
|
---|
50 |
|
---|
51 | } // Fin du namespace
|
---|
52 |
|
---|
53 | #endif
|
---|