1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

0026937: Eliminate NO_CXX_EXCEPTION macro support

Macro NO_CXX_EXCEPTION was removed from code.
Method Raise() was replaced by explicit throw statement.
Method Standard_Failure::Caught() was replaced by normal C++mechanism of exception transfer.
Method Standard_Failure::Caught() is deprecated now.
Eliminated empty constructors.
Updated samples.
Eliminate empty method ChangeValue from NCollection_Map class.
Removed not operable methods from NCollection classes.
This commit is contained in:
ski
2017-02-02 16:35:21 +03:00
committed by apn
parent 0c63f2f8b9
commit 9775fa6110
1146 changed files with 4860 additions and 6183 deletions

View File

@@ -63,20 +63,20 @@ static void CheckCurveData
const Standard_Boolean Periodic)
{
if (Degree < 1 || Degree > Geom2d_BSplineCurve::MaxDegree()) {
Standard_ConstructionError::Raise("BSpline curve : invalid degree");
throw Standard_ConstructionError("BSpline curve : invalid degree");
}
if (CPoles.Length() < 2) Standard_ConstructionError::Raise("BSpline curve : at least 2 poles required");
if (CKnots.Length() != CMults.Length()) Standard_ConstructionError::Raise("BSpline curve : Knot and Mult array size mismatch");
if (CPoles.Length() < 2) throw Standard_ConstructionError("BSpline curve : at least 2 poles required");
if (CKnots.Length() != CMults.Length()) throw Standard_ConstructionError("BSpline curve : Knot and Mult array size mismatch");
for (Standard_Integer I = CKnots.Lower(); I < CKnots.Upper(); I++) {
if (CKnots (I+1) - CKnots (I) <= Epsilon (Abs(CKnots (I)))) {
Standard_ConstructionError::Raise("BSpline curve : Knots interval values too close");
throw Standard_ConstructionError("BSpline curve : Knots interval values too close");
}
}
if (CPoles.Length() != BSplCLib::NbPoles(Degree,Periodic,CMults))
Standard_ConstructionError::Raise("BSpline curve : # Poles and degree mismatch");
throw Standard_ConstructionError("BSpline curve : # Poles and degree mismatch");
}
//=======================================================================
@@ -183,12 +183,12 @@ Geom2d_BSplineCurve::Geom2d_BSplineCurve
Periodic);
if (Weights.Length() != Poles.Length())
Standard_ConstructionError::Raise("Geom2d_BSplineCurve :Weights and Poles array size mismatch");
throw Standard_ConstructionError("Geom2d_BSplineCurve :Weights and Poles array size mismatch");
Standard_Integer i;
for (i = Weights.Lower(); i <= Weights.Upper(); i++) {
if (Weights(i) <= gp::Resolution()) {
Standard_ConstructionError::Raise("Geom2d_BSplineCurve: Weights values too small");
throw Standard_ConstructionError("Geom2d_BSplineCurve: Weights values too small");
}
}
@@ -234,7 +234,7 @@ void Geom2d_BSplineCurve::IncreaseDegree
if (Degree == deg) return;
if (Degree < deg || Degree > Geom2d_BSplineCurve::MaxDegree()) {
Standard_ConstructionError::Raise("BSpline curve : IncreaseDegree : bad degree value");
throw Standard_ConstructionError("BSpline curve : IncreaseDegree : bad degree value");
}
Standard_Integer FromK1 = FirstUKnotIndex ();
@@ -371,7 +371,7 @@ void Geom2d_BSplineCurve::InsertKnots(const TColStd_Array1OfReal& Knots,
if (!BSplCLib::PrepareInsertKnots(deg,periodic,
knots->Array1(),mults->Array1(),
Knots,&Mults,nbpoles,nbknots,Epsilon,Add))
Standard_ConstructionError::Raise("Geom2d_BSplineCurve::InsertKnots");
throw Standard_ConstructionError("Geom2d_BSplineCurve::InsertKnots");
if (nbpoles == poles->Length()) return;
@@ -431,7 +431,7 @@ Standard_Boolean Geom2d_BSplineCurve::RemoveKnot
Standard_Integer I2 = LastUKnotIndex ();
if (Index < I1 || Index > I2) {
Standard_OutOfRange::Raise("BSpline curve : RemoveKnot : index out of range");
throw Standard_OutOfRange("BSpline curve : RemoveKnot : index out of range");
}
const TColgp_Array1OfPnt2d & oldpoles = poles->Array1();
@@ -495,12 +495,12 @@ void Geom2d_BSplineCurve::InsertPoleAfter
const gp_Pnt2d& P,
const Standard_Real Weight)
{
if (Index < 0 || Index > poles->Length()) Standard_OutOfRange::Raise("BSpline curve : InsertPoleAfter: Index and #pole mismatch");
if (Index < 0 || Index > poles->Length()) throw Standard_OutOfRange("BSpline curve : InsertPoleAfter: Index and #pole mismatch");
if (Weight <= gp::Resolution()) Standard_ConstructionError::Raise("BSpline curve : InsertPoleAfter: Weight too small");
if (Weight <= gp::Resolution()) throw Standard_ConstructionError("BSpline curve : InsertPoleAfter: Weight too small");
if (knotSet == GeomAbs_NonUniform || knotSet == GeomAbs_PiecewiseBezier) {
Standard_ConstructionError::Raise("BSpline curve : InsertPoleAfter : bad knotSet type");
throw Standard_ConstructionError("BSpline curve : InsertPoleAfter : bad knotSet type");
}
const TColStd_Array1OfReal& cknots = knots->Array1();
@@ -597,12 +597,12 @@ void Geom2d_BSplineCurve::InsertPoleBefore
void Geom2d_BSplineCurve::RemovePole
(const Standard_Integer Index)
{
if (Index < 1 || Index > poles->Length()) Standard_OutOfRange::Raise("BSpline curve :RemovePole : Index and #pole mismatch");
if (Index < 1 || Index > poles->Length()) throw Standard_OutOfRange("BSpline curve :RemovePole : Index and #pole mismatch");
if (poles->Length() <= 2) Standard_ConstructionError::Raise("BSpline curve : RemovePole : #pole is already minimum");
if (poles->Length() <= 2) throw Standard_ConstructionError("BSpline curve : RemovePole : #pole is already minimum");
if (knotSet == GeomAbs_NonUniform || knotSet == GeomAbs_PiecewiseBezier)
Standard_ConstructionError::Raise("BSpline curve : RemovePole: bad knotSet type");
throw Standard_ConstructionError("BSpline curve : RemovePole: bad knotSet type");
Standard_Integer i;
Handle(TColStd_HArray1OfReal) nknots =
@@ -686,7 +686,7 @@ void Geom2d_BSplineCurve::Segment(const Standard_Real aU1,
const Standard_Real aU2)
{
if (aU2 < aU1)
Standard_DomainError::Raise("Geom2d_BSplineCurve::Segment");
throw Standard_DomainError("Geom2d_BSplineCurve::Segment");
//
Standard_Real AbsUMax = Max(Abs(FirstParameter()),Abs(LastParameter()));
Standard_Real Eps = Max (Epsilon(AbsUMax), Precision::PConfusion());
@@ -727,7 +727,7 @@ void Geom2d_BSplineCurve::Segment(const Standard_Real aU1,
Standard_Real Period = LastParameter() - FirstParameter();
DU = U2 - U1;
if (DU - Period > Precision::PConfusion())
Standard_DomainError::Raise("Geom2d_BSplineCurve::Segment");
throw Standard_DomainError("Geom2d_BSplineCurve::Segment");
if (DU > Period)
DU = Period;
}
@@ -845,20 +845,20 @@ void Geom2d_BSplineCurve::SetKnot
(const Standard_Integer Index,
const Standard_Real K)
{
if (Index < 1 || Index > knots->Length()) Standard_OutOfRange::Raise("BSpline curve : SetKnot: Index and #pole mismatch");
if (Index < 1 || Index > knots->Length()) throw Standard_OutOfRange("BSpline curve : SetKnot: Index and #pole mismatch");
Standard_Real DK = Abs(Epsilon (K));
if (Index == 1) {
if (K >= knots->Value(2) - DK) Standard_ConstructionError::Raise("BSpline curve :SetKnot :K out of range");
if (K >= knots->Value(2) - DK) throw Standard_ConstructionError("BSpline curve :SetKnot :K out of range");
}
else if (Index == knots->Length()) {
if (K <= knots->Value (knots->Length()-1) + DK) {
Standard_ConstructionError::Raise("BSpline curve : SetKnot : K out of range");
throw Standard_ConstructionError("BSpline curve : SetKnot : K out of range");
}
}
else {
if (K <= knots->Value(Index-1) + DK ||
K >= knots->Value(Index+1) - DK ) {
Standard_ConstructionError::Raise("BSpline curve : SetKnot: K out of range");
throw Standard_ConstructionError("BSpline curve : SetKnot: K out of range");
}
}
if (K != knots->Value (Index)) {
@@ -946,13 +946,13 @@ void Geom2d_BSplineCurve::SetPeriodic ()
void Geom2d_BSplineCurve::SetOrigin(const Standard_Integer Index)
{
if (!periodic)
Standard_NoSuchObject::Raise("Geom2d_BSplineCurve::SetOrigin");
throw Standard_NoSuchObject("Geom2d_BSplineCurve::SetOrigin");
Standard_Integer i,k;
Standard_Integer first = FirstUKnotIndex();
Standard_Integer last = LastUKnotIndex();
if ((Index < first) || (Index > last))
Standard_DomainError::Raise("Geom2d_BSplineCurve::SetOrigin");
throw Standard_DomainError("Geom2d_BSplineCurve::SetOrigin");
Standard_Integer nbknots = knots->Length();
Standard_Integer nbpoles = poles->Length();
@@ -1087,7 +1087,7 @@ void Geom2d_BSplineCurve::SetPole
(const Standard_Integer Index,
const gp_Pnt2d& P)
{
if (Index < 1 || Index > poles->Length()) Standard_OutOfRange::Raise("BSpline curve : SetPole : index and #pole mismatch");
if (Index < 1 || Index > poles->Length()) throw Standard_OutOfRange("BSpline curve : SetPole : index and #pole mismatch");
poles->SetValue (Index, P);
maxderivinvok = 0;
}
@@ -1115,9 +1115,9 @@ void Geom2d_BSplineCurve::SetWeight
(const Standard_Integer Index,
const Standard_Real W)
{
if (Index < 1 || Index > poles->Length()) Standard_OutOfRange::Raise("BSpline curve : SetWeight: Index and #pole mismatch");
if (Index < 1 || Index > poles->Length()) throw Standard_OutOfRange("BSpline curve : SetWeight: Index and #pole mismatch");
if (W <= gp::Resolution ()) Standard_ConstructionError::Raise("BSpline curve : SetWeight: Weight too small");
if (W <= gp::Resolution ()) throw Standard_ConstructionError("BSpline curve : SetWeight: Weight too small");
Standard_Boolean rat = IsRational() || (Abs(W - 1.) > gp::Resolution());
@@ -1155,7 +1155,7 @@ void Geom2d_BSplineCurve::MovePoint(const Standard_Real U,
{
if (Index1 < 1 || Index1 > poles->Length() ||
Index2 < 1 || Index2 > poles->Length() || Index1 > Index2) {
Standard_OutOfRange::Raise("BSpline curve : MovePoint: Index and #pole mismatch");
throw Standard_OutOfRange("BSpline curve : MovePoint: Index and #pole mismatch");
}
TColgp_Array1OfPnt2d npoles(1, poles->Length());
gp_Pnt2d P0;

View File

@@ -106,12 +106,12 @@ Geom2d_BezierCurve::Geom2d_BezierCurve
Standard_Integer nbpoles = Poles.Length();
if (Weights.Length() != nbpoles)
Standard_ConstructionError::Raise();
throw Standard_ConstructionError();
Standard_Integer i;
for (i = 1; i <= nbpoles; i++) {
if (Weights(i) <= gp::Resolution()) {
Standard_ConstructionError::Raise();
throw Standard_ConstructionError();
}
}

View File

@@ -72,7 +72,7 @@ Geom2d_Circle::Geom2d_Circle (const Ax2d& A, const Standard_Real Radius,
const Standard_Boolean Sense)
: radius(Radius) {
if (Radius < 0.0) { Standard_ConstructionError::Raise(); }
if (Radius < 0.0) { throw Standard_ConstructionError(); }
pos = gp_Ax22d(A, Sense);
}
@@ -85,7 +85,7 @@ Geom2d_Circle::Geom2d_Circle (const gp_Ax22d& A, const Standard_Real Radius)
: radius (Radius) {
if (Radius < 0.0) { Standard_ConstructionError::Raise(); }
if (Radius < 0.0) { throw Standard_ConstructionError(); }
pos = A;
}
@@ -108,7 +108,7 @@ void Geom2d_Circle::SetCirc2d (const gp_Circ2d& C) {
void Geom2d_Circle::SetRadius (const Standard_Real R)
{
if (R < 0.0) { Standard_ConstructionError::Raise(); }
if (R < 0.0) { throw Standard_ConstructionError(); }
radius = R;
}

View File

@@ -80,7 +80,7 @@ Geom2d_Ellipse::Geom2d_Ellipse (const Ax2d& MajorAxis,
:majorRadius (MajorRadius), minorRadius (MinorRadius){
if (MajorRadius < MinorRadius || MinorRadius < 0.0 ) {
Standard_ConstructionError::Raise();
throw Standard_ConstructionError();
}
pos = gp_Ax22d(MajorAxis, Sense);
}
@@ -97,7 +97,7 @@ Geom2d_Ellipse::Geom2d_Ellipse (const gp_Ax22d& Axis,
: majorRadius (MajorRadius), minorRadius (MinorRadius)
{
if (MajorRadius < MinorRadius || MinorRadius < 0.0 ) {
Standard_ConstructionError::Raise();
throw Standard_ConstructionError();
}
pos = Axis;
}
@@ -124,7 +124,7 @@ void Geom2d_Ellipse::SetElips2d (const gp_Elips2d& E)
void Geom2d_Ellipse::SetMajorRadius (const Standard_Real MajorRadius)
{
if (MajorRadius < minorRadius)
Standard_ConstructionError::Raise();
throw Standard_ConstructionError();
else
majorRadius = MajorRadius;
}
@@ -138,7 +138,7 @@ void Geom2d_Ellipse::SetMajorRadius (const Standard_Real MajorRadius)
void Geom2d_Ellipse::SetMinorRadius (const Standard_Real MinorRadius)
{
if (MinorRadius < 0 || majorRadius < MinorRadius)
{ Standard_ConstructionError::Raise(); }
{ throw Standard_ConstructionError(); }
else
{ minorRadius = MinorRadius; }
}

View File

@@ -82,7 +82,7 @@ Geom2d_Hyperbola::Geom2d_Hyperbola (const Ax2d& A,
: majorRadius (MajorRadius), minorRadius (MinorRadius)
{
if( MajorRadius < 0.0|| MinorRadius < 0.0)
Standard_ConstructionError::Raise();
throw Standard_ConstructionError();
pos = gp_Ax22d(A, Sense);
}
@@ -97,7 +97,7 @@ Geom2d_Hyperbola::Geom2d_Hyperbola (const gp_Ax22d& Axis,
: majorRadius (MajorRadius), minorRadius (MinorRadius)
{
if( MajorRadius < 0.0|| MinorRadius < 0.0)
Standard_ConstructionError::Raise();
throw Standard_ConstructionError();
pos = Axis;
}
@@ -123,7 +123,7 @@ void Geom2d_Hyperbola::SetHypr2d (const gp_Hypr2d& H)
void Geom2d_Hyperbola::SetMajorRadius (const Standard_Real MajorRadius)
{
if (MajorRadius < 0.0)
Standard_ConstructionError::Raise();
throw Standard_ConstructionError();
else
majorRadius = MajorRadius;
}
@@ -137,7 +137,7 @@ void Geom2d_Hyperbola::SetMajorRadius (const Standard_Real MajorRadius)
void Geom2d_Hyperbola::SetMinorRadius (const Standard_Real MinorRadius)
{
if (MinorRadius < 0.0 )
Standard_ConstructionError::Raise();
throw Standard_ConstructionError();
else
minorRadius = MinorRadius;
}

View File

@@ -146,7 +146,7 @@ void Geom2d_OffsetCurve::SetBasisCurve (const Handle(Geom2d_Curve)& C,
// Raise exception if still C0
if (isC0)
Standard_ConstructionError::Raise("Offset on C0 curve");
throw Standard_ConstructionError("Offset on C0 curve");
}
//
if(isTrimmed)
@@ -265,7 +265,7 @@ gp_Vec2d Geom2d_OffsetCurve::DN (const Standard_Real U,
case 2: D2( U, PBidon, VBidon, VN); break;
case 3: D3( U, PBidon, VBidon, VBidon, VN); break;
default:
Standard_NotImplemented::Raise("Exception: Derivative order is greater than 3. "
throw Standard_NotImplemented("Exception: Derivative order is greater than 3. "
"Cannot compute of derivative.");
}

View File

@@ -77,7 +77,7 @@ Geom2d_Parabola::Geom2d_Parabola (const Ax2d& MirrorAxis,
const Standard_Boolean Sense)
: focalLength (Focal)
{
if (Focal < 0.0) { Standard_ConstructionError::Raise(); }
if (Focal < 0.0) { throw Standard_ConstructionError(); }
pos = gp_Ax22d(MirrorAxis, Sense);
}
@@ -90,7 +90,7 @@ Geom2d_Parabola::Geom2d_Parabola (const Ax2d& MirrorAxis,
Geom2d_Parabola::Geom2d_Parabola (const gp_Ax22d& Axis, const Standard_Real Focal)
: focalLength (Focal)
{
if (Focal < 0.0) { Standard_ConstructionError::Raise(); }
if (Focal < 0.0) { throw Standard_ConstructionError(); }
pos = Axis;
}
@@ -114,7 +114,7 @@ Geom2d_Parabola::Geom2d_Parabola (const Ax2d& D, const Pnt2d& F) {
void Geom2d_Parabola::SetFocal (const Standard_Real Focal)
{
if (Focal < 0.0) Standard_ConstructionError::Raise();
if (Focal < 0.0) throw Standard_ConstructionError();
focalLength = Focal;
}

View File

@@ -72,7 +72,7 @@ Geom2d_TrimmedCurve::Geom2d_TrimmedCurve (const Handle(Geom2d_Curve)& C,
uTrim1 (U1),
uTrim2 (U2)
{
if(C.IsNull()) Standard_ConstructionError::Raise("Geom2d_TrimmedCurve:: C is null");
if(C.IsNull()) throw Standard_ConstructionError("Geom2d_TrimmedCurve:: C is null");
// kill trimmed basis curves
Handle(Geom2d_TrimmedCurve) T = Handle(Geom2d_TrimmedCurve)::DownCast(C);
if (!T.IsNull())
@@ -118,7 +118,7 @@ void Geom2d_TrimmedCurve::SetTrim (const Standard_Real U1,
{
Standard_Boolean sameSense = Standard_True;
if (U1 == U2)
Standard_ConstructionError::Raise("Geom2d_TrimmedCurve::U1 == U2");
throw Standard_ConstructionError("Geom2d_TrimmedCurve::U1 == U2");
Standard_Real Udeb = basisCurve->FirstParameter();
Standard_Real Ufin = basisCurve->LastParameter();
@@ -149,8 +149,7 @@ void Geom2d_TrimmedCurve::SetTrim (const Standard_Real U1,
if ((Udeb - uTrim1 > Precision::PConfusion()) ||
(uTrim2 - Ufin > Precision::PConfusion())) {
Standard_ConstructionError::Raise
("Geom_TrimmedCurve::parameters out of range");
throw Standard_ConstructionError("Geom_TrimmedCurve::parameters out of range");
}
}

View File

@@ -27,7 +27,7 @@ DEFINE_STANDARD_HANDLE(Geom2d_UndefinedDerivative, Standard_DomainError)
#if !defined No_Exception && !defined No_Geom2d_UndefinedDerivative
#define Geom2d_UndefinedDerivative_Raise_if(CONDITION, MESSAGE) \
if (CONDITION) Geom2d_UndefinedDerivative::Raise(MESSAGE);
if (CONDITION) throw Geom2d_UndefinedDerivative(MESSAGE);
#else
#define Geom2d_UndefinedDerivative_Raise_if(CONDITION, MESSAGE)
#endif

View File

@@ -27,7 +27,7 @@ DEFINE_STANDARD_HANDLE(Geom2d_UndefinedValue, Standard_DomainError)
#if !defined No_Exception && !defined No_Geom2d_UndefinedValue
#define Geom2d_UndefinedValue_Raise_if(CONDITION, MESSAGE) \
if (CONDITION) Geom2d_UndefinedValue::Raise(MESSAGE);
if (CONDITION) throw Geom2d_UndefinedValue(MESSAGE);
#else
#define Geom2d_UndefinedValue_Raise_if(CONDITION, MESSAGE)
#endif