Changeset 2506 in Sophya


Ignore:
Timestamp:
Mar 15, 2004, 5:46:56 PM (22 years ago)
Author:
ansari
Message:

Remplacement THROW par throw - Reza 15/03/2004

Location:
trunk/SophyaLib/NTools
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/NTools/cspline.cc

    r2322 r2506  
    4444if( x != NULL && y != NULL) ComputeCSpline();
    4545
    46 END_CONSTRUCTOR
    4746}
    4847
     
    5655  , YP1(yp1), YPn(ypn), X(NULL), Y(NULL), Y2(NULL), tmp(NULL)
    5756{
    58 END_CONSTRUCTOR
    5957}
    6058
     
    125123      printf("CSpline::SetNewTab_Erreur: X[%d]>=X[%d] (%g>=%g)\n"
    126124            ,i-1,i,X[i-1],X[i]);
    127       THROW(inconsistentErr);
     125      throw ParmError(PExcLongMessage(""));
    128126    }
    129127  }
     
    219217if( corrupt_Y2 ) {
    220218  cout<<"CSpline::CSplineInt: calcul des coef du spline corrupted"<<endl;
    221   THROW(inconsistentErr);
     219  throw ParmError(PExcLongMessage(""));
    222220}
    223221
     
    234232  cout<<"CSpline::CSplineInt: pout khi="<<khi<<" klo="<<klo
    235233      <<" memes valeurs de X[]: "<<X[khi]<<endl;
    236   THROW(inconsistentErr);
     234  throw ParmError(PExcLongMessage(""));
    237235}
    238236
     
    293291if( x1 != NULL && x2 != NULL && y != NULL) ComputeCSpline();
    294292
    295 END_CONSTRUCTOR
    296293}
    297294
     
    306303  , Nel_S(0), S(NULL), Sint(NULL), tmp(NULL)
    307304{
    308 END_CONSTRUCTOR
    309305}
    310306
     
    391387      { printf("CSpline::SetNewTab_Erreur: X1[%d]>=X1[%d] (%g>=%g)\n"
    392388              ,i-1,i,X1[i-1],X1[i]);
    393         THROW(inconsistentErr); }
     389        throw ParmError(PExcLongMessage("")); }
    394390    for(int j=0;j<Nel2;j++) Ytmp[j*Nel1+i]  = y[j*Nel1+ind[i]];
    395391  }
     
    402398      { printf("CSpline::SetNewTab_Erreur: X2[%d]>=X2[%d] (%g>=%g)\n"
    403399              ,j-1,j,X2[j-1],X2[j]);
    404         THROW(inconsistentErr); }
     400        throw ParmError(PExcLongMessage("")); }
    405401    for(int i=0;i<Nel1;i++) Y[j*Nel1+i] = Ytmp[j*Nel1+ind[i]];
    406402  }
  • trunk/SophyaLib/NTools/dates.cc

    r2322 r2506  
    4444#endif
    4545  SetZone(p);
    46   END_CONSTRUCTOR;
    4746}
    4847
     
    5453{
    5554  SetZone(nom);
    56   END_CONSTRUCTOR
    5755}
    5856
     
    9492    dstStopMonth   = Date::mois_Mars;
    9593    dstOffset      = 1;
    96   } else THROW(parmErr);
     94  } else throw ParmError("TimeZone::SetZone() ");
    9795}
    9896
     
    104102{
    105103  Date dt = date;
    106   if (dt.MM < 0 || dt.JJ < 0) THROW(inconsistentErr)
     104  if (dt.MM < 0 || dt.JJ < 0) throw ParmError(PExcLongMessage(""));
    107105  if (dt.hh >= 0) dt += gmtOffset/24.0; // date "fictive" en local d'hiver
    108106  else dt.ss = dt.hh = dt.mm = 0;       // minuit local si heure indeterminee
     
    185183//--
    186184{
    187   if (mois<1 || mois>12) THROW(inconsistentErr);
     185  if (mois<1 || mois>12) throw ParmError(PExcLongMessage(""));
    188186 
    189187  switch(mois) {
     
    265263//--
    266264{
    267    if (UndetTime() && !AllUndetTime()) THROW(inconsistentErr);
    268    if (UndetDate() && !AllUndetDate()) THROW(inconsistentErr);
     265   if (UndetTime() && !AllUndetTime()) throw ParmError(PExcLongMessage(""));
     266   if (UndetDate() && !AllUndetDate()) throw ParmError(PExcLongMessage(""));
    269267   double t=0;
    270268   if (!UndetDate()) {
     
    341339  ss = TM->tm_sec;
    342340  nuit = 0;
    343   END_CONSTRUCTOR
    344341}
    345342
     
    351348: JJ(J), MM(M), AA(A), hh(h), mm(m), ss(s), timeZone(gTimeZone), nuit(0)
    352349{
    353   END_CONSTRUCTOR
    354350}
    355351
     
    364360{
    365361  Set(t);
    366   END_CONSTRUCTOR
    367362}
    368363
     
    388383{
    389384  Set(date,heure,tOpt);
    390   END_CONSTRUCTOR
    391385}
    392386
     
    403397{
    404398  Set(date,heure,tOpt);
    405   END_CONSTRUCTOR
    406399}
    407400
     
    435428    if (p[0] == '?' && (p[1] == '?' || p[1] == '/'))   JJ = -1;
    436429    else {
    437       if (!isdigit(p[0])) THROW(inconsistentErr);
    438       if (!isdigit(p[1]) && p[1] != '/') THROW(inconsistentErr);
     430      if (!isdigit(p[0])) ParmError(PExcLongMessage(""));
     431      if (!isdigit(p[1]) && p[1] != '/') ParmError(PExcLongMessage(""));
    439432      JJ = atoi(p);
    440       if (JJ <= 0) THROW(inconsistentErr);
     433      if (JJ <= 0) ParmError(PExcLongMessage(""));
    441434    }
    442435   
    443436    if (p[1] == '/') p += 2;
    444437    else if (p[2] == '/') p+= 3;
    445     else THROW(inconsistentErr);
     438    else ParmError(PExcLongMessage(""));
    446439
    447440    if (p[0] == '?' && (p[1] == '?' || p[1] == '/'))   MM = -1;
    448441    else {
    449       if (!isdigit(p[0])) THROW(inconsistentErr);
    450       if (!isdigit(p[1]) && p[1] != '/') THROW(inconsistentErr);
     442      if (!isdigit(p[0])) ParmError(PExcLongMessage(""));
     443      if (!isdigit(p[1]) && p[1] != '/') ParmError(PExcLongMessage(""));
    451444      MM = atoi(p);
    452       if (MM <= 0 || MM >12) THROW(inconsistentErr);
     445      if (MM <= 0 || MM >12) ParmError(PExcLongMessage(""));
    453446    }
    454447
    455448    if (p[1] == '/') p += 2;
    456449    else if (p[2] == '/') p+= 3;
    457     else THROW(inconsistentErr);
     450    else ParmError(PExcLongMessage(""));
    458451
    459452    if (p[0] == '?')  AA = -1;
    460453    else {
    461       if (!isdigit(p[0])) THROW(inconsistentErr);
    462       if (!isdigit(p[1])) THROW(inconsistentErr);
     454      if (!isdigit(p[0])) ParmError(PExcLongMessage(""));
     455      if (!isdigit(p[1])) ParmError(PExcLongMessage(""));
    463456      AA = atoi(p);
    464457      if (AA < 100 && AA >= 0 && date[6] != '0') AA += 1900;
    465458    }
    466459   
    467     if (AA > 0 && MM > 0 && JJ > 0 && JJ > MonthDays(MM,AA)) THROW(inconsistentErr);
     460    if (AA > 0 && MM > 0 && JJ > 0 && JJ > MonthDays(MM,AA)) ParmError(PExcLongMessage(""));
    468461   
    469462   } else if (strlen(date)==4) {      // Code EROS de date
    470463     if (date[0] == '?') AA = -1;
    471464     else {
    472        if (!isdigit(date[0])) THROW(inconsistentErr);
     465       if (!isdigit(date[0])) ParmError(PExcLongMessage(""));
    473466       AA = 1990 + date[0] - '0';
    474467     }
     
    476469     if (date[1] == '?') MM = -1;
    477470     else {
    478        if (!isalpha(date[1])) THROW(inconsistentErr);
     471       if (!isalpha(date[1])) ParmError(PExcLongMessage(""));
    479472       if (islower(date[1]))
    480473         MM = date[1] - 'a' + 1;
    481474       else
    482475         MM = date[1] - 'A' + 1;
    483        if (MM<1 || MM>12) THROW(inconsistentErr);
     476       if (MM<1 || MM>12) ParmError(PExcLongMessage(""));
    484477     }
    485478     
    486479     if (date[2] == '?' && date[3] == '?') JJ = -1;
    487480     else {
    488        if (!isdigit(date[2])) THROW(inconsistentErr);
    489        if (!isdigit(date[3])) THROW(inconsistentErr);
     481       if (!isdigit(date[2])) ParmError(PExcLongMessage(""));
     482       if (!isdigit(date[3])) ParmError(PExcLongMessage(""));
    490483       JJ = atoi(date+2);
    491484     }
    492485     
    493      if (AA > 0 && MM > 0 && JJ > 0 && JJ > MonthDays(MM,AA)) THROW(inconsistentErr);
     486     if (AA > 0 && MM > 0 && JJ > 0 && JJ > MonthDays(MM,AA)) ParmError(PExcLongMessage(""));
    494487     nuit = 1;
    495    } else THROW(inconsistentErr);   // Mauvaise longueur
     488   } else ParmError(PExcLongMessage(""));   // Mauvaise longueur
    496489  } else {                          // Pas de date
    497490    JJ = MM = AA = -1;
     
    502495    if (p[0] == '?' && (p[1] == '?' || p[1] == ':'))   hh = -1;
    503496    else {
    504       if (!isdigit(p[0])) THROW(inconsistentErr);
    505       if (!isdigit(p[1]) && p[1] != ':') THROW(inconsistentErr);
     497      if (!isdigit(p[0])) ParmError(PExcLongMessage(""));
     498      if (!isdigit(p[1]) && p[1] != ':') ParmError(PExcLongMessage(""));
    506499      hh = atoi(p);
    507500    }
     
    509502    if (p[1] == ':') p += 2;
    510503    else if (p[2] == ':') p+= 3;
    511     else THROW(inconsistentErr);
     504    else ParmError(PExcLongMessage(""));
    512505
    513506    if (p[0] == '?' && (p[1] == '?' || p[1] == ':'))   mm = -1;
    514507    else {
    515       if (!isdigit(p[0])) THROW(inconsistentErr);
    516       if (!isdigit(p[1]) && p[1] != '/') THROW(inconsistentErr);
     508      if (!isdigit(p[0])) ParmError(PExcLongMessage(""));
     509      if (!isdigit(p[1]) && p[1] != '/') ParmError(PExcLongMessage(""));
    517510      mm = atoi(p);
    518511    }
     
    520513    if (p[1] == ':') p += 2;
    521514    else if (p[2] == ':') p+= 3;
    522     else THROW(inconsistentErr);
     515    else ParmError(PExcLongMessage(""));
    523516
    524517    if (p[0] == '?')   ss = -1;
    525518    else {
    526       if (!isdigit(p[0])) THROW(inconsistentErr);
     519      if (!isdigit(p[0])) ParmError(PExcLongMessage(""));
    527520      ss = atoi(p);
    528521    }
     
    585578
    586579  if (dt.AA != -1) {
    587     if (dt.AA < 1990 || dt.AA > 2016) THROW(inconsistentErr);
     580    if (dt.AA < 1990 || dt.AA > 2016) ParmError(PExcLongMessage(""));
    588581    int i = dt.AA - 1990;
    589582    if (i<10)
     
    771764//--
    772765{
    773   if (a.UndetTime() != b.UndetTime()) THROW(inconsistentErr);
    774   if (a.UndetDate() != b.UndetDate()) THROW(inconsistentErr);
     766  if (a.UndetTime() != b.UndetTime()) ParmError(PExcLongMessage(""));
     767  if (a.UndetDate() != b.UndetDate()) ParmError(PExcLongMessage(""));
    775768  return a.GetDays() - b.GetDays();
    776769}
  • trunk/SophyaLib/NTools/generaldata.cc

    r2344 r2506  
    9595 }
    9696
    97  END_CONSTRUCTOR
    9897}
    9998
     
    106105  , BuffVar(NULL), BuffVarR4(NULL)
    107106{
    108  END_CONSTRUCTOR
    109107}
    110108
  • trunk/SophyaLib/NTools/generalfit.cc

    r2407 r2506  
    3939 deltaParm = new double[nPar];
    4040 tmpParm   = new double[nPar];
    41  END_CONSTRUCTOR
    4241}
    4342
     
    197196 ASSERT( nPar>0 );
    198197 deltaParm = new double[nPar];
    199  END_CONSTRUCTOR
    200198}
    201199
     
    329327 } ENDTRY
    330328
    331  END_CONSTRUCTOR
    332329}
    333330
     
    371368 } ENDTRY
    372369
    373  END_CONSTRUCTOR
    374370}
    375371
     
    452448#endif
    453449FileStep = fopen(filename,"w");
    454 if(FileStep==NULL) THROW(nullPtrErr);
     450if(FileStep==NULL) throw NullPtrError("GeneralFit::WriteStep()");
    455451}
    456452
  • trunk/SophyaLib/NTools/imageop.cc

    r832 r2506  
    2929#define CHECKIMG2(_img_,_x_,_y_)                                  \
    3030      if ((_x_ >= (_img_).siz_x) || (_y_ >= (_img_).siz_y) ||              \
    31           (_x_ < 0) || (_y_ < 0)) THROW(rangeCheckErr);  \
    32       if (!(_img_).ImagePtr()) THROW(nullPtrErr)
     31          (_x_ < 0) || (_y_ < 0)) throw RangeCheckError("imageop.cc - CHECKIMG2") ;  \
     32      if (!(_img_).ImagePtr()) throw NullPtrError("imageop.cc - CHECKIMG2")
    3333#else
    3434#if defined(IMGVOIDCHECK)
  • trunk/SophyaLib/NTools/integ.cc

    r2423 r2506  
    444444GLInteg::AddBound(double x)
    445445{
    446  if (x<=mXMin || x>=mXMax) THROW(rangeCheckErr);
     446 if (x<=mXMin || x>=mXMax) throw RangeCheckError("GLInteg::AddBound()") ;
    447447 // On introduira les classes d'exections apres reflexion et de maniere systematique (Rz+cmv)
    448448 // if (x<=mXMin || x>=mXMax) throw range_error("GLInteg::AddBound  bound outside interval");
  • trunk/SophyaLib/NTools/perandom.cc

    r2322 r2506  
    2727  for(int_4 j=0; j<nBin; j++)
    2828    (*this)(j) /= (*this)(nBin-1);
    29   END_CONSTRUCTOR
    3029}
    3130
     
    4847  for(int_4 j=0; j<nBin; j++)
    4948    (*this)(j) /= (*this)(nBin-1);
    50   END_CONSTRUCTOR
    5149}
    5250
     
    6563  for(int_4 j=0; j<nBin; j++)
    6664    (*this)(j) /= (*this)(nBin-1);
    67   END_CONSTRUCTOR
    6865}
    6966
     
    151148   
    152149   nx = nBinX;
    153   END_CONSTRUCTOR
    154150}
    155151
     
    179175   delete[] tabX;
    180176   nx = nBinX;
    181   END_CONSTRUCTOR
    182177}
    183178
  • trunk/SophyaLib/NTools/poly.cc

    r2344 r2506  
    2020: TVector<r_8>(degre+1), dirty(0), deg(0)
    2121{
    22   END_CONSTRUCTOR
    2322}
    2423
     
    2726:TVector<r_8>(a), dirty(a.dirty), deg(a.deg)
    2827{
    29   END_CONSTRUCTOR
    3028}
    3129
     
    9694      return Root2(roots(0),roots(1));
    9795    default :
    98       THROW(parmErr);
     96      throw ParmError("Poly::Roots()") ;
    9997    }
    10098}
     
    106104{
    107105  UpdateDegIfDirty();
    108   if (deg != 1) THROW(sizeMismatchErr);
     106  if (deg != 1) ParmError("Poly::Root1() deg!= 1") ;
    109107
    110108  if (Element(1) == 0) return 0;
     
    118116{
    119117  UpdateDegIfDirty();
    120   if (deg != 2) THROW(sizeMismatchErr);
     118  if (deg != 2) throw SzMismatchError("Poly::Root2() deg != 2") ;
    121119
    122120  double delta = Element(1)*Element(1) - 4*Element(0)*Element(2);
     
    227225{
    228226  int n = x.NElts();
    229   if (n != (int)y.NElts()) THROW(sizeMismatchErr);
     227  if (n != (int)y.NElts()) throw SzMismatchError("Poly::Fit() ");
    230228
    231229  Realloc(degre);
     
    262260{
    263261  int n = x.NElts();
    264   if (n != (int)y.NElts()) THROW(sizeMismatchErr);
    265   if (n != (int)erry2.NElts()) THROW(sizeMismatchErr);
     262  if (n != (int)y.NElts()) throw SzMismatchError("Poly::Fit() ");
     263  if (n != (int)erry2.NElts()) throw SzMismatchError("Poly::Fit() ") ;
    266264
    267265  Realloc(degre);
     
    288286Poly Poly::power(int n) const // a accelerer !!!
    289287{
    290   if (n < 0) THROW(rangeCheckErr);
     288  if (n < 0) throw RangeCheckError("Poly::power() n<0 ");
    291289  if (n == 0) { Poly r(0); r[0] = 1; return r;}
    292290  if (n == 1) { return *this; }
     
    358356 maxDegX(degreX), maxDegY(degreY), degX(0), degY(0), deg(0)
    359357{
    360   END_CONSTRUCTOR
    361358}
    362359
     
    370367    for (int j=0; j<=degY; j++)
    371368      Coef(i,j) = polX[i]*polY[j];
    372   END_CONSTRUCTOR
    373369}
    374370
     
    379375 degX(a.degX), degY(a.degY), deg(a.deg)
    380376{
    381   END_CONSTRUCTOR
    382377}
    383378
     
    467462{
    468463  int n = x.NElts();
    469   if (n != (int)y.NElts()) THROW(sizeMismatchErr);
    470   if (n != (int)z.NElts()) THROW(sizeMismatchErr);
     464  if (n != (int)y.NElts()) throw SzMismatchError("Poly2::Fit() - 1");
     465  if (n != (int)z.NElts()) throw SzMismatchError("Poly2::Fit() - 2");
    471466
    472467  Realloc(degreX, degreY);
     
    510505{
    511506  int n = x.NElts();
    512   if (n != (int)y.NElts()) THROW(sizeMismatchErr);
    513   if (n != (int)z.NElts()) THROW(sizeMismatchErr);
    514   if (n != (int)errz2.NElts()) THROW(sizeMismatchErr);
     507  if (n != (int)y.NElts()) throw SzMismatchError("Poly2::Fit() - 3");
     508  if (n != (int)z.NElts()) throw SzMismatchError("Poly2::Fit() - 4");
     509  if (n != (int)errz2.NElts()) throw SzMismatchError("Poly2::Fit() - 5");
    515510
    516511  Realloc(degreX, degreY);
     
    551546{
    552547  int n = x.NElts();
    553   if (n != (int)y.NElts()) THROW(sizeMismatchErr);
    554   if (n != (int)z.NElts()) THROW(sizeMismatchErr);
     548  if (n != (int)y.NElts()) throw SzMismatchError("Poly2::Fit() - 6");
     549  if (n != (int)z.NElts()) throw SzMismatchError("Poly2::Fit() - 7");
    555550
    556551  Realloc(degre, degre);   // certains vaudront 0, impose.
     
    604599{
    605600  int n = x.NElts();
    606   if (n != (int)y.NElts()) THROW(sizeMismatchErr);
    607   if (n != (int)z.NElts()) THROW(sizeMismatchErr);
    608   if (n != (int)errz2.NElts()) THROW(sizeMismatchErr);
     601  if (n != (int)y.NElts()) throw SzMismatchError("Poly2::Fit() - 8");
     602  if (n != (int)z.NElts()) throw SzMismatchError("Poly2::Fit() - 9");
     603  if (n != (int)errz2.NElts()) throw SzMismatchError("Poly2::Fit() - 10");
    609604
    610605  Realloc(degre, degre);
     
    733728Poly2 Poly2::power(int n) const
    734729{
    735   if (n < 0) THROW(rangeCheckErr);
     730  if (n < 0) throw RangeCheckError("Poly2::power(n<0) ");
    736731  if (n == 0) { Poly2 r(0); r.Coef(0,0) = 1; return r;}
    737732  if (n == 1) { return *this; }
  • trunk/SophyaLib/NTools/poly.h

    r1584 r2506  
    11// This may look like C code, but it is really -*- C++ -*-
    22//
    3 // $Id: poly.h,v 1.10 2001-07-19 08:33:49 ansari Exp $
     3// $Id: poly.h,v 1.11 2004-03-15 16:46:56 ansari Exp $
    44//
    55
     
    176176  //! Return index of coefficient of X^dx * Y^dy in the vector
    177177  inline int IndCoef(int dx, int dy) const {
    178     if (dx>maxDegX || dy>maxDegY) THROW(rangeCheckErr);
     178    if (dx>maxDegX || dy>maxDegY) throw RangeCheckError("Poly2::IndCoef()");
    179179    return dx + (maxDegX+1)*dy;
    180180  }
     
    189189  //! Return coefficient of X^dx * Y^dy
    190190  inline double& Coef(int dx, int dy) {
    191     if (dx>maxDegX || dy>maxDegY) THROW(rangeCheckErr);
     191    if (dx>maxDegX || dy>maxDegY) throw RangeCheckError("Poly2::Coef() ");
    192192    dirty = 1; return Element(IndCoef(dx,dy));
    193193  }
  • trunk/SophyaLib/NTools/simplesort.cc

    r244 r2506  
    11//
    2 // $Id: simplesort.cc,v 1.2 1999-04-22 16:18:50 ansari Exp $
     2// $Id: simplesort.cc,v 1.3 2004-03-15 16:46:56 ansari Exp $
    33//
    44
     
    1818SimpleSort::SimpleSort(int nElts)
    1919: numElts(nElts), index(new TRIPAIRE[nElts])
    20 {END_CONSTRUCTOR}
     20{
     21}
    2122                       
    2223SimpleSort::~SimpleSort()
Note: See TracChangeset for help on using the changeset viewer.