- Timestamp:
- Apr 26, 2002, 6:48:22 PM (23 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/BaseTools/fiondblock.cc
r1426 r1967 9 9 #include "pexceptions.h" 10 10 #include "fiondblock.h" 11 #include "datatype.h" 12 #include <typeinfo> 11 13 12 14 //////////////////////////////////////////////////////////////// … … 71 73 { 72 74 NDataBlock<T> * po = dynamic_cast< NDataBlock<T> * >(&o); 73 if (po == NULL) throw TypeMismatchExc("FIO_NDataBlock<T>::SetDataObj() - Type Mismatch Error"); 75 if (po == NULL) { 76 char buff[160]; 77 sprintf(buff,"FIO_NDataBlock<T><%s>::SetDataObj(%s) - Object type error ! ", 78 DataTypeInfo<T>::getTypeName().c_str(), typeid(o).name()); 79 throw TypeMismatchExc(PExcLongMessage(buff)); 80 } 74 81 if (ownobj && dobj) delete dobj; 75 82 dobj = po; ownobj = false; -
trunk/SophyaLib/BaseTools/objfio.h
r754 r1967 27 27 virtual AnyDataObj* DataObj() { return(dobj); } 28 28 virtual void SetDataObj(AnyDataObj & o) 29 { T * po = dynamic_cast< T * >(& o); if (po == NULL) return; 30 if (ownobj && dobj) delete dobj; dobj = po; ownobj = false; } 31 29 { 30 T * po = dynamic_cast< T * >(& o); 31 if (po == NULL) { 32 char buff[160]; 33 sprintf(buff,"ObjFileIO<T>::SetDataObj(%s) - Object type error ! ", 34 typeid(o).name()); 35 throw TypeMismatchExc(PExcLongMessage(buff)); 36 } 37 if (ownobj && dobj) delete dobj; dobj = po; ownobj = false; 38 } 39 32 40 inline operator T() { return(*dobj); } 33 41 -
trunk/SophyaLib/BaseTools/sversion.h
r1958 r1967 3 3 4 4 #define SOPHYA_VERSION 1.3 5 #define SOPHYA_REVISION 556 #define SOPHYA_TAG "V_ Jan2002"5 #define SOPHYA_REVISION 60 6 #define SOPHYA_TAG "V_Mar2002" 7 7 8 8 #endif -
trunk/SophyaLib/NTools/cimage.cc
r1390 r1967 8 8 #include "pexceptions.h" 9 9 #include "cimage.h" 10 #include "datatype.h" 11 #include <typeinfo> 10 12 11 13 /*! … … 115 117 { 116 118 Image<T> * po = dynamic_cast< Image<T> * >(&o); 117 if (po == NULL) return; 119 if (po == NULL) { 120 char buff[160]; 121 sprintf(buff,"FIO_Image<%s>::SetDataObj(%s) - Object type error ! ", 122 DataTypeInfo<T>::getTypeName().c_str(), typeid(o).name()); 123 throw TypeMismatchExc(PExcLongMessage(buff)); 124 } 118 125 if (ownobj && dobj) delete dobj; 119 126 dobj = po; ownobj = false; -
trunk/SophyaLib/SkyMap/fiolocalmap.cc
r1624 r1967 4 4 #include "pexceptions.h" 5 5 #include "fiondblock.h" 6 #include "datatype.h" 7 #include <typeinfo> 6 8 7 9 //******************************************************************* … … 72 74 { 73 75 LocalMap<T> * po = dynamic_cast< LocalMap<T> * >(&o); 74 if (po == NULL) return; 76 if (po == NULL) { 77 char buff[160]; 78 sprintf(buff,"FIO_LocalMap<%s>::SetDataObj(%s) - Object type error ! ", 79 DataTypeInfo<T>::getTypeName().c_str(), typeid(o).name()); 80 throw TypeMismatchExc(PExcLongMessage(buff)); 81 } 75 82 if (ownobj && dobj) delete dobj; 76 83 dobj = po; ownobj = false; -
trunk/SophyaLib/SkyMap/fiospherethetaphi.cc
r1624 r1967 4 4 #include "pexceptions.h" 5 5 #include "fiondblock.h" 6 #include "datatype.h" 7 #include <typeinfo> 6 8 7 9 /////////////////////////////////////////////////////////// … … 57 59 { 58 60 SphereThetaPhi<T> * po = dynamic_cast< SphereThetaPhi<T> * >(&o); 59 if (po == NULL) return; 61 if (po == NULL) { 62 char buff[160]; 63 sprintf(buff,"FIO_SphereThetaPhi<%s>::SetDataObj(%s) - Object type error ! ", 64 DataTypeInfo<T>::getTypeName().c_str(), typeid(o).name()); 65 throw TypeMismatchExc(PExcLongMessage(buff)); 66 } 67 60 68 if (ownobj && dobj) delete dobj; 61 69 dobj = po; ownobj = false; -
trunk/SophyaLib/SkyMap/spherepos.cc
r764 r1967 2 2 3 3 #include "spherepos.h" 4 #include "datatype.h" 5 #include <typeinfo> 4 6 5 static char *head_spherepos_cc_ = "$Header: /Users/garnier/temp/CVSSophya/SophyaLib/SkyMap/spherepos.cc,v 1. 1.1.1 2000-03-02 17:05:39ansari Exp $";7 static char *head_spherepos_cc_ = "$Header: /Users/garnier/temp/CVSSophya/SophyaLib/SkyMap/spherepos.cc,v 1.2 2002-04-26 16:48:22 ansari Exp $"; 6 8 7 9 … … 72 74 { 73 75 SphereCoordSys * po = dynamic_cast<SphereCoordSys *>(&o); 74 if (po == NULL) return; 76 if (po == NULL) { 77 char buff[160]; 78 sprintf(buff,"FIO_SphereCoordSys::SetDataObj(%s) - Object type error ! ", 79 typeid(o).name()); 80 throw TypeMismatchExc(PExcLongMessage(buff)); 81 } 82 75 83 if (ownobj && dobj) delete dobj; 76 84 dobj = po; ownobj = false; -
trunk/SophyaProg/Examples/arr1.icc
r1650 r1967 1 // Fichier arr1.icc 2 // Exemple d'utilisation de tableaux 3 // Appel: runcxx -f arr1.icc 4 // Creation , remplissage d'une matrice 5 TMatrix<r_4> ma(7,9); 6 ma = RegularSequence(0.1, 0.05); 7 cout << "\n arr1.icc: ma = " << ma << endl; 8 float min, max; 9 // Utilisation des sous-tableaux 10 ma(Range(2,4), Range(4,7)) = M_PI; 11 cout << "\n Apres ma(Range(2,4), Range(4,7)) = " << ma << endl; 12 // Appel de methodes 13 ma.MinMax(min, max); 14 cout << " MinMax(ma) : min= " << min << " max= " << max << endl; 15 TMatrix<r_4> sma = Sin(ma); 16 cout << "\n test pour runcxx - sma = Sin(ma)= " << sma << endl; 17 sma.MinMax(min, max); 18 cout << " MinMax(sma) : min= " << min << " max= " << max << endl; 1 // We create a integer array SizeX=7, SizeY=5 2 TArray<int_4> ia(7,5); 3 // We fill it with a sequence of numbers starting at 10., with step = 2. 4 ia = RegularSequence(10., 2.); 5 cout << " ----- Array IA = \n " << ia << endl; 6 TArray<int_4> ib = ia(Range(0,3), Range(3,4), Range(0)); 7 cout << " ----- Array IB IA(Range(0,3), Range(3,2)) = \n" << ib << endl; 8 // sub array extraction, Range(2,4) : starting position=2 , End=4 9 TArray<int_4> ic = ia(Range(2,3),Range(1,3),Range(0)); 10 cout << " ----- Array IC IA(Range(2,3),Range(1,3)) = \n " << ic << endl; 11 // we set the sub-array to zero, this should reflect in the original array 12 // sub-arrays share their data with parent array 13 ic = 0; 14 cout << " ----- Array IC Apres (=0) = \n " << ic << endl; 15 cout << " ----- Array IB Apres IC=0 = \n " << ib << endl; 16 cout << " ----- Array IA Apres IC=0 = \n " << ia << endl; 17 cout << " >>>>>> Writing in arrt.ppf <<<<<<< " << endl; 18 POutPersist pos("arrt.ppf"); 19 // We write the three arrays in the stream 20 pos << ia << ib << ic; 19 21 20 // Vector , matrix multiplication21 Vector v1(5);22 v1 = 12.;23 Vector v2(5);24 v2 = 14;25 Matrix m = v2*v1.Transpose();26 cout << " m= v2*v1.Transpose() : " << m;27 // Computing the scalar product28 cout << " v1.v2 = " << (v1.Transpose()*v2).toScalar() << endl;
Note:
See TracChangeset
for help on using the changeset viewer.