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