[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"
|
---|
[2322] | 9 | #include <iostream>
|
---|
[772] | 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
|
---|
[772] | 18 | template <class T>
|
---|
| 19 | class FIO_TArray : public PPersist {
|
---|
| 20 | public:
|
---|
| 21 | FIO_TArray();
|
---|
| 22 | FIO_TArray(string const & filename);
|
---|
| 23 | FIO_TArray(const TArray<T> & obj);
|
---|
| 24 | FIO_TArray(TArray<T> * obj);
|
---|
| 25 | virtual ~FIO_TArray();
|
---|
| 26 | virtual AnyDataObj* DataObj();
|
---|
| 27 | virtual void SetDataObj(AnyDataObj & o);
|
---|
| 28 | inline operator TArray<T>() { return(*dobj); }
|
---|
| 29 | protected :
|
---|
| 30 | virtual void ReadSelf(PInPersist&);
|
---|
| 31 | virtual void WriteSelf(POutPersist&) const;
|
---|
[894] | 32 | TArray<T> * dobj; //!< Pointer to the connected TArray
|
---|
| 33 | bool ownobj; //!< true if the connected object belong to the class
|
---|
[772] | 34 | };
|
---|
| 35 |
|
---|
[958] | 36 | /*! \ingroup TArray \fn operator<<(POutPersist&,TArray<T>&)
|
---|
| 37 | \brief Write TArray \b obj into POutPersist stream \b os */
|
---|
[772] | 38 | template <class T>
|
---|
| 39 | inline POutPersist& operator << (POutPersist& os, TArray<T> & obj)
|
---|
| 40 | { FIO_TArray<T> fio(&obj); fio.Write(os); return(os); }
|
---|
[894] | 41 |
|
---|
[958] | 42 | /*! \ingroup TArray \fn operator>>(PInPersist&,TArray<T>&)
|
---|
| 43 | \brief Read TArray \b obj from PInPersist stream \b os */
|
---|
[772] | 44 | template <class T>
|
---|
| 45 | inline PInPersist& operator >> (PInPersist& is, TArray<T> & obj)
|
---|
[2478] | 46 | { FIO_TArray<T> fio(&obj); is.SkipToNextObject(); fio.Read(is); return(is); }
|
---|
[772] | 47 |
|
---|
[804] | 48 |
|
---|
[772] | 49 | } // Fin du namespace
|
---|
| 50 |
|
---|
| 51 | #endif
|
---|