Changeset 306 in Sophya for trunk/SophyaLib/NTools/tvector.cc
- Timestamp:
- May 19, 1999, 12:17:42 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/NTools/tvector.cc
r302 r306 1 // $Id: tvector.cc,v 1. 3 1999-05-18 12:58:26ansari Exp $1 // $Id: tvector.cc,v 1.4 1999-05-19 10:17:42 ansari Exp $ 2 2 // C.Magneville 04/99 3 3 #include "machdefs.h" … … 99 99 } 100 100 101 /////////////////////////////////////////////////////////// 102 // -------------------------------------------------------- 103 // Les objets delegues pour la gestion de persistance 104 // -------------------------------------------------------- 105 /////////////////////////////////////////////////////////// 106 107 template <class T> 108 FIO_TVector<T>::FIO_TVector() 109 { 110 dobj=new TVector<T>; 111 ownobj=true; 112 } 113 114 template <class T> 115 FIO_TVector<T>::FIO_TVector(string const & filename) 116 { 117 dobj=new TVector<T>; 118 ownobj=true; 119 Read(filename); 120 } 121 122 template <class T> 123 FIO_TVector<T>::FIO_TVector(const TVector<T> & obj) 124 { 125 dobj = new TVector<T>(obj); 126 ownobj=true; 127 } 128 129 template <class T> 130 FIO_TVector<T>::FIO_TVector(TVector<T> * obj) 131 { 132 dobj = obj; 133 ownobj=false; 134 } 135 136 template <class T> 137 FIO_TVector<T>::~FIO_TVector() 138 { 139 if (ownobj && dobj) delete dobj; 140 } 141 142 template <class T> 143 AnyDataObj* FIO_TVector<T>::DataObj() 144 { 145 return(dobj); 146 } 147 148 template <class T> 149 void FIO_TVector<T>::ReadSelf(PInPersist& is) 150 { 151 // On lit les 3 premiers uint_4 152 // 0: Numero de version, 1 : NRows=NElts, 2 : NCol=1 153 uint_4 itab[3]; 154 is.Get(itab,3); 155 if (dobj == NULL) dobj = new TVector<T>(itab[1]); 156 else dobj->ReSize(itab[1]); 157 // On lit le NDataBlock 158 FIO_NDataBlock<T> fio_nd(&dobj->DataBlock()); 159 fio_nd.Read(is); 160 } 161 162 template <class T> 163 void FIO_TVector<T>::WriteSelf(POutPersist& os) const 164 { 165 if (dobj == NULL) return; 166 // On ecrit 3 uint_4 .... 167 // 0: Numero de version, 1 : NRows=NElts, 2 : NCol=1 168 uint_4 itab[3]; 169 itab[0] = 1; // Numero de version a 1 170 itab[1] = dobj->NElts(); 171 itab[2] = 1; 172 os.Put(itab,3); 173 // On ecrit le NDataBlock 174 FIO_NDataBlock<T> fio_nd(&dobj->DataBlock()); 175 fio_nd.Write(os); 176 } 177 101 178 /////////////////////////////////////////////////////////////// 102 179 #ifdef __CXX_PRAGMA_TEMPLATES__ … … 112 189 #pragma define_template TVector< complex<float> > 113 190 #pragma define_template TVector< complex<double> > 191 // Instances des delegues FileIO (PPersist) 192 #pragma define_template FIO_TVector<uint_1> 193 #pragma define_template FIO_TVector<uint_2> 194 #pragma define_template FIO_TVector<int_2> 195 #pragma define_template FIO_TVector<int_4> 196 #pragma define_template FIO_TVector<int_8> 197 #pragma define_template FIO_TVector<uint_4> 198 #pragma define_template FIO_TVector<uint_8> 199 #pragma define_template FIO_TVector<r_8> 200 #pragma define_template FIO_TVector<r_4> 201 #pragma define_template FIO_TVector< complex<float> > 202 #pragma define_template FIO_TVector< complex<double> > 114 203 #endif 115 204 … … 126 215 template class TVector< complex<float> >; 127 216 template class TVector< complex<double> >; 217 // Instances des delegues FileIO (PPersist) 218 template class FIO_TVector<uint_1>; 219 template class FIO_TVector<uint_2>; 220 template class FIO_TVector<int_2>; 221 template class FIO_TVector<int_4>; 222 template class FIO_TVector<int_8>; 223 template class FIO_TVector<uint_4>; 224 template class FIO_TVector<uint_8>; 225 template class FIO_TVector<r_8>; 226 template class FIO_TVector<r_4>; 227 template class FIO_TVector< complex<float> >; 228 template class FIO_TVector< complex<double> >; 128 229 #endif
Note:
See TracChangeset
for help on using the changeset viewer.