Changeset 4035 in Sophya for trunk/SophyaLib/TArray/tarray.cc
- Timestamp:
- Nov 14, 2011, 5:28:25 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/TArray/tarray.cc
r3850 r4035 197 197 : BaseArray() , mNDBlock(a.mNDBlock) 198 198 { 199 if (a.NbDimensions() == 0) return; // Reza-Nov 2011: we allow copy contrsuctor on non allocated arrays 199 200 string exmsg = "TArray<T>::TArray(const TArray<T>&)"; 200 201 if (!UpdateSizes(a, exmsg)) throw( ParmError(exmsg) ); … … 210 211 : BaseArray() , mNDBlock(a.mNDBlock, share) 211 212 { 212 if (a.NbDimensions() == 0) return; 213 if (a.NbDimensions() == 0) return; // Reza-Nov 2011: we allow copy contrsuctor on non allocated arrays 213 214 string exmsg = "TArray<T>::TArray(const TArray<T>&, bool)"; 214 215 if (!UpdateSizes(a, exmsg)) throw( ParmError(exmsg) ); … … 216 217 } 217 218 218 //! Constructor with size and contents copied (after conversion) from a different type TArray 219 template <class T> 220 TArray<T>::TArray(const BaseArray& a) 219 //! Constructor with size and contents copied (after conversion) from an array with different data type. 220 /*! 221 The array size and memory layout are copied from the array \b a, or a packed array is created if \b pack==true. 222 \param a : original array, to copy sizes and data from 223 \param pack : if \b true , create a packed array, else same memory layout as \b a. 224 */ 225 template <class T> 226 TArray<T>::TArray(const BaseArray& a, bool pack) 221 227 : BaseArray() , mNDBlock() 222 228 { 223 229 if (a.NbDimensions() == 0) return; 224 string exmsg = "TArray<T>::TArray(const BaseArray&)"; 225 if (!UpdateSizes(a, exmsg)) throw( ParmError(exmsg) ); 226 mNDBlock.ReSize(totsize_); 227 // if (a.mInfo) mInfo = new DVList(*(a.mInfo)); - pb protected ! 230 string exmsg = "TArray<T>::TArray(const BaseArray&,bool)"; 231 ReSize(a,pack,false); 228 232 ConvertAndCopyElt(a); 233 if (a.HasInfoObject()) mInfo = new DVList(*(a.getInfoPointer())); 229 234 } 230 235 … … 1626 1631 } 1627 1632 SetSeq(es); 1628 cout << "TArray<T>::ReadASCII()/Info: " << n << " elements read from stream " 1629 << " (Row,Col= " << nr << "," << nc << ")" << endl; 1633 if (BaseArray::GetPrintLevel()>0) 1634 cout << "TArray<T>::ReadASCII()/Info: " << n << " elements read from stream " 1635 << " (Row,Col= " << nr << "," << nc << ")" << endl; 1630 1636 return(n); 1631 1637 }
Note:
See TracChangeset
for help on using the changeset viewer.