1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0023964: Extrema_ExtXX::Point methods might return constant reference instead of copy

Changed definitions of Point() functions
Removal of floating point exceptions from previous commit
This commit is contained in:
azv 2013-09-19 15:56:51 +04:00 committed by bugmaster
parent 295cb05393
commit 5d99f2c887
34 changed files with 41 additions and 28 deletions

View File

@ -138,6 +138,7 @@ is
is static; is static;
Point (me; N: Integer) returns POnCurv Point (me; N: Integer) returns POnCurv
---C++: return const &
---Purpose: Returns the point of the Nth extremum distance. ---Purpose: Returns the point of the Nth extremum distance.
raises NotDone from StdFail, raises NotDone from StdFail,
-- if IsDone(me)=False. -- if IsDone(me)=False.

View File

@ -444,7 +444,7 @@ Standard_Boolean Extrema_ExtPElC::IsMin (const Standard_Integer N) const
} }
//============================================================================= //=============================================================================
Extrema_POnCurv Extrema_ExtPElC::Point (const Standard_Integer N) const const Extrema_POnCurv& Extrema_ExtPElC::Point (const Standard_Integer N) const
{ {
if ((N < 1) || (N > NbExt())) { Standard_OutOfRange::Raise(); } if ((N < 1) || (N > NbExt())) { Standard_OutOfRange::Raise(); }
return myPoint[N-1]; return myPoint[N-1];

View File

@ -142,6 +142,7 @@ is
is static; is static;
Point (me; N: Integer) returns POnCurv2d Point (me; N: Integer) returns POnCurv2d
---C++: return const &
---Purpose: Returns the point of the Nth extremum distance. ---Purpose: Returns the point of the Nth extremum distance.
raises NotDone from StdFail, raises NotDone from StdFail,
-- if IsDone(me)=False. -- if IsDone(me)=False.

View File

@ -328,7 +328,7 @@ Standard_Boolean Extrema_ExtPElC2d::IsMin (const Standard_Integer N) const
} }
//============================================================================= //=============================================================================
Extrema_POnCurv2d Extrema_ExtPElC2d::Point (const Standard_Integer N) const const Extrema_POnCurv2d& Extrema_ExtPElC2d::Point (const Standard_Integer N) const
{ {
if ((N < 1) || (N > NbExt())) { Standard_OutOfRange::Raise(); } if ((N < 1) || (N > NbExt())) { Standard_OutOfRange::Raise(); }
return myPoint[N-1]; return myPoint[N-1];

View File

@ -101,6 +101,7 @@ is
is static; is static;
Point (me; N: Integer) returns POnSurf Point (me; N: Integer) returns POnSurf
---C++: return const &
---Purpose: Returns the point of the Nth resulting distance. ---Purpose: Returns the point of the Nth resulting distance.
raises NotDone from StdFail, raises NotDone from StdFail,
-- if IsDone(me)=False. -- if IsDone(me)=False.

View File

@ -408,7 +408,7 @@ Standard_Real Extrema_ExtPElS::SquareDistance (const Standard_Integer N) const
} }
//============================================================================= //=============================================================================
Extrema_POnSurf Extrema_ExtPElS::Point (const Standard_Integer N) const const Extrema_POnSurf& Extrema_ExtPElS::Point (const Standard_Integer N) const
{ {
if (!IsDone()) { StdFail_NotDone::Raise(); } if (!IsDone()) { StdFail_NotDone::Raise(); }
if ((N < 1) || (N > myNbExt)) { Standard_OutOfRange::Raise(); } if ((N < 1) || (N > myNbExt)) { Standard_OutOfRange::Raise(); }

View File

@ -88,6 +88,7 @@ is
is static; is static;
Point (me; N: Integer) returns POnSurf Point (me; N: Integer) returns POnSurf
---C++: return const &
---Purpose: Returns the point of the Nth resulting distance. ---Purpose: Returns the point of the Nth resulting distance.
raises NotDone from StdFail, raises NotDone from StdFail,
-- if IsDone(me)=False. -- if IsDone(me)=False.

View File

@ -416,7 +416,7 @@ Standard_Real Extrema_ExtPExtS::SquareDistance (const Standard_Integer N) const
} }
//============================================================================= //=============================================================================
Extrema_POnSurf Extrema_ExtPExtS::Point (const Standard_Integer N) const const Extrema_POnSurf& Extrema_ExtPExtS::Point (const Standard_Integer N) const
{ {
if (!IsDone()) { StdFail_NotDone::Raise(); } if (!IsDone()) { StdFail_NotDone::Raise(); }
if ((N < 1) || (N > myNbExt)) { Standard_OutOfRange::Raise(); } if ((N < 1) || (N > myNbExt)) { Standard_OutOfRange::Raise(); }

View File

@ -85,6 +85,7 @@ is
is static; is static;
Point (me; N: Integer) returns POnSurf Point (me; N: Integer) returns POnSurf
---C++: return const &
---Purpose: Returns the point of the Nth resulting distance. ---Purpose: Returns the point of the Nth resulting distance.
raises NotDone from StdFail, raises NotDone from StdFail,
-- if IsDone(me)=False. -- if IsDone(me)=False.

View File

@ -528,7 +528,7 @@ Standard_Real Extrema_ExtPRevS::SquareDistance(const Standard_Integer N) const
//purpose : //purpose :
//======================================================================= //=======================================================================
Extrema_POnSurf Extrema_ExtPRevS::Point(const Standard_Integer N) const const Extrema_POnSurf& Extrema_ExtPRevS::Point(const Standard_Integer N) const
{ {
if (!IsDone()) { StdFail_NotDone::Raise(); } if (!IsDone()) { StdFail_NotDone::Raise(); }
if ((N < 1) || (N > myNbExt)) { Standard_OutOfRange::Raise(); } if ((N < 1) || (N > myNbExt)) { Standard_OutOfRange::Raise(); }

View File

@ -116,6 +116,7 @@ is
is static; is static;
Point (me; N: Integer) returns POnSurf Point (me; N: Integer) returns POnSurf
---C++: return const &
---Purpose: Returns the point of the Nth resulting distance. ---Purpose: Returns the point of the Nth resulting distance.
raises NotDone from StdFail, raises NotDone from StdFail,
-- if IsDone(me)=False. -- if IsDone(me)=False.

View File

@ -332,7 +332,7 @@ Standard_Integer Extrema_ExtPS::NbExt() const
Extrema_POnSurf Extrema_ExtPS::Point(const Standard_Integer N) const const Extrema_POnSurf& Extrema_ExtPS::Point(const Standard_Integer N) const
{ {
if(!myDone) StdFail_NotDone::Raise(); if(!myDone) StdFail_NotDone::Raise();
return myPoints.Value(N); return myPoints.Value(N);

View File

@ -66,6 +66,7 @@ is
is static; is static;
Point (me; N: Integer) returns POnSurf Point (me; N: Integer) returns POnSurf
---C++: return const &
---Purpose: Returns the point of the Nth resulting distance. ---Purpose: Returns the point of the Nth resulting distance.
raises NotDone from StdFail, raises NotDone from StdFail,
-- if IsDone(me)=False. -- if IsDone(me)=False.

View File

@ -102,7 +102,7 @@ Standard_Real Extrema_ExtPSOfRev::SquareDistance (const Standard_Integer N) cons
} }
//============================================================================= //=============================================================================
Extrema_POnSurf Extrema_ExtPSOfRev::Point (const Standard_Integer N) const const Extrema_POnSurf& Extrema_ExtPSOfRev::Point (const Standard_Integer N) const
{ {
if (!IsDone()) { StdFail_NotDone::Raise(); } if (!IsDone()) { StdFail_NotDone::Raise(); }
return myPoint.Value(N); return myPoint.Value(N);

View File

@ -89,6 +89,7 @@ is
-- if N < 1 or N > NbExt(me). -- if N < 1 or N > NbExt(me).
Point (me; N: Integer) returns POnC Point (me; N: Integer) returns POnC
---C++: return const &
---Purpose: Returns the Nth extremum. ---Purpose: Returns the Nth extremum.
raises OutOfRange from Standard, raises OutOfRange from Standard,
TypeMismatch from Standard; TypeMismatch from Standard;

View File

@ -411,7 +411,7 @@ Standard_Boolean Extrema_FuncExtPC::IsMin (const Standard_Integer N) const
return (myIsMin.Value(N) == 1); return (myIsMin.Value(N) == 1);
} }
//============================================================================= //=============================================================================
POnC Extrema_FuncExtPC::Point (const Standard_Integer N) const const POnC & Extrema_FuncExtPC::Point (const Standard_Integer N) const
{ {
if (!myPinit || !myCinit) Standard_TypeMismatch::Raise(); if (!myPinit || !myCinit) Standard_TypeMismatch::Raise();
return myPoint.Value(N); return myPoint.Value(N);

View File

@ -105,6 +105,7 @@ is
-- if N < 1 or N > NbExt(me). -- if N < 1 or N > NbExt(me).
Point (me; N: Integer) returns POnSurf Point (me; N: Integer) returns POnSurf
---C++: return const &
---Purpose: Returns the Nth extremum. ---Purpose: Returns the Nth extremum.
raises OutOfRange; raises OutOfRange;
-- if N < 1 or N > NbExt(me). -- if N < 1 or N > NbExt(me).

View File

@ -160,7 +160,7 @@ Standard_Real Extrema_FuncExtPS::SquareDistance (const Standard_Integer N) const
} }
//============================================================================= //=============================================================================
Extrema_POnSurf Extrema_FuncExtPS::Point (const Standard_Integer N) const const Extrema_POnSurf& Extrema_FuncExtPS::Point (const Standard_Integer N) const
{ {
if (!myPinit || !mySinit) Standard_TypeMismatch::Raise(); if (!myPinit || !mySinit) Standard_TypeMismatch::Raise();
return myPoint.Value(N); return myPoint.Value(N);

View File

@ -78,11 +78,13 @@ is
-- if N < 1 or N > NbExt(me). -- if N < 1 or N > NbExt(me).
PointOnS1 (me; N: Integer) returns POnSurf PointOnS1 (me; N: Integer) returns POnSurf
---C++: return const &
---Purpose: Return the Nth extremum on S1. ---Purpose: Return the Nth extremum on S1.
raises OutOfRange; raises OutOfRange;
-- if N < 1 or N > NbExt(me). -- if N < 1 or N > NbExt(me).
PointOnS2 (me; N: Integer) returns POnSurf PointOnS2 (me; N: Integer) returns POnSurf
---C++: return const &
---Purpose: Renvoie le Nieme extremum sur S2. ---Purpose: Renvoie le Nieme extremum sur S2.
raises OutOfRange; raises OutOfRange;
-- si N < 1 ou N > NbExt(me). -- si N < 1 ou N > NbExt(me).

View File

@ -257,7 +257,7 @@ Standard_Real Extrema_FuncExtSS::SquareDistance (const Standard_Integer N) const
//purpose : //purpose :
//======================================================================= //=======================================================================
Extrema_POnSurf Extrema_FuncExtSS::PointOnS1 (const Standard_Integer N) const const Extrema_POnSurf& Extrema_FuncExtSS::PointOnS1 (const Standard_Integer N) const
{ {
if (!myS1init || !myS2init) Standard_TypeMismatch::Raise(); if (!myS1init || !myS2init) Standard_TypeMismatch::Raise();
return myPoint1.Value(N); return myPoint1.Value(N);
@ -267,7 +267,7 @@ Extrema_POnSurf Extrema_FuncExtSS::PointOnS1 (const Standard_Integer N) const
//purpose : //purpose :
//======================================================================= //=======================================================================
Extrema_POnSurf Extrema_FuncExtSS::PointOnS2 (const Standard_Integer N) const const Extrema_POnSurf& Extrema_FuncExtSS::PointOnS2 (const Standard_Integer N) const
{ {
if (!myS1init || !myS2init) Standard_TypeMismatch::Raise(); if (!myS1init || !myS2init) Standard_TypeMismatch::Raise();
return myPoint2.Value(N); return myPoint2.Value(N);

View File

@ -118,6 +118,7 @@ is
is static; is static;
Point(me; N: Integer from Standard) returns ThePOnC Point(me; N: Integer from Standard) returns ThePOnC
---C++: return const &
---Purpose: Returns the point of the <N>th extremum distance. ---Purpose: Returns the point of the <N>th extremum distance.
raises NotDone from StdFail, raises NotDone from StdFail,
OutOfRange from Standard OutOfRange from Standard

View File

@ -337,7 +337,7 @@ Standard_Boolean Extrema_GExtPC::IsMin(const Standard_Integer N) const
//purpose : //purpose :
//======================================================================= //=======================================================================
ThePOnC Extrema_GExtPC::Point(const Standard_Integer N) const const ThePOnC & Extrema_GExtPC::Point(const Standard_Integer N) const
{ {
if(!mydone) StdFail_NotDone::Raise(); if(!mydone) StdFail_NotDone::Raise();
if ((N < 1) || (N > mySqDist.Length())) Standard_OutOfRange::Raise(); if ((N < 1) || (N > mySqDist.Length())) Standard_OutOfRange::Raise();

View File

@ -119,6 +119,7 @@ is
is static; is static;
Point (me) returns ThePOnC Point (me) returns ThePOnC
---C++: return const &
---Purpose: Returns the point of the extremum distance. ---Purpose: Returns the point of the extremum distance.
raises NotDone from StdFail raises NotDone from StdFail
-- if IsDone(me)=False. -- if IsDone(me)=False.

View File

@ -330,20 +330,14 @@ Standard_Boolean Extrema_GLocateExtPC::IsMin () const
//purpose : //purpose :
//======================================================================= //=======================================================================
ThePOnC Extrema_GLocateExtPC::Point () const const ThePOnC & Extrema_GLocateExtPC::Point () const
{ {
if (!myDone) { StdFail_NotDone::Raise(); } if (!myDone) { StdFail_NotDone::Raise(); }
ThePOnC P;
if (type == GeomAbs_BezierCurve) { if (type == GeomAbs_BezierCurve) {
P = myLocExtPC.Point(); return myLocExtPC.Point();
} }
else if(type == GeomAbs_BSplineCurve || type == GeomAbs_OtherCurve) { else if(type == GeomAbs_BSplineCurve || type == GeomAbs_OtherCurve) {
P = mypp; return mypp;
} }
else { return myExtremPC.Point(numberext);
if (numberext != 0) {
P = myExtremPC.Point(numberext);
}
}
return P;
} }

View File

@ -133,6 +133,7 @@ is
Point (me; N: Integer) returns POnC Point (me; N: Integer) returns POnC
---C++: return const &
---Purpose: Returns the point of the Nth extremum distance. ---Purpose: Returns the point of the Nth extremum distance.
raises TypeMismatch from Standard, raises TypeMismatch from Standard,
NotDone from StdFail, NotDone from StdFail,

View File

@ -235,7 +235,7 @@ Standard_Boolean Extrema_GenExtPC::IsMin (const Standard_Integer N) const {
//purpose : //purpose :
//======================================================================= //=======================================================================
POnC Extrema_GenExtPC::Point (const Standard_Integer N) const const POnC & Extrema_GenExtPC::Point (const Standard_Integer N) const
{ {
if (!IsDone()) { StdFail_NotDone::Raise(); } if (!IsDone()) { StdFail_NotDone::Raise(); }
return myF.Point(N); return myF.Point(N);

View File

@ -126,6 +126,7 @@ is
is static; is static;
Point (me; N: Integer) returns POnSurf Point (me; N: Integer) returns POnSurf
---C++: return const &
---Purpose: Returns the point of the Nth resulting distance. ---Purpose: Returns the point of the Nth resulting distance.
raises NotDone from StdFail, raises NotDone from StdFail,
-- if IsDone(me)=False. -- if IsDone(me)=False.

View File

@ -953,7 +953,7 @@ Standard_Real Extrema_GenExtPS::SquareDistance (const Standard_Integer N) const
} }
//============================================================================= //=============================================================================
Extrema_POnSurf Extrema_GenExtPS::Point (const Standard_Integer N) const const Extrema_POnSurf& Extrema_GenExtPS::Point (const Standard_Integer N) const
{ {
if (!IsDone()) { StdFail_NotDone::Raise(); } if (!IsDone()) { StdFail_NotDone::Raise(); }
return myF.Point(N); return myF.Point(N);

View File

@ -111,6 +111,7 @@ is
is static; is static;
PointOnS1 (me; N: Integer) returns POnSurf PointOnS1 (me; N: Integer) returns POnSurf
---C++: return const &
---Purpose: Returns the point of the Nth resulting distance. ---Purpose: Returns the point of the Nth resulting distance.
raises NotDone from StdFail, raises NotDone from StdFail,
-- if IsDone(me)=False. -- if IsDone(me)=False.
@ -119,6 +120,7 @@ is
is static; is static;
PointOnS2 (me; N: Integer) returns POnSurf PointOnS2 (me; N: Integer) returns POnSurf
---C++: return const &
---Purpose: Returns the point of the Nth resulting distance. ---Purpose: Returns the point of the Nth resulting distance.
raises NotDone from StdFail, raises NotDone from StdFail,
-- if IsDone(me)=False. -- if IsDone(me)=False.

View File

@ -321,7 +321,7 @@ Standard_Real Extrema_GenExtSS::SquareDistance(const Standard_Integer N) const
//purpose : //purpose :
//======================================================================= //=======================================================================
Extrema_POnSurf Extrema_GenExtSS::PointOnS1(const Standard_Integer N) const const Extrema_POnSurf& Extrema_GenExtSS::PointOnS1(const Standard_Integer N) const
{ {
if (!IsDone()) { StdFail_NotDone::Raise(); } if (!IsDone()) { StdFail_NotDone::Raise(); }
return myF.PointOnS1(N); return myF.PointOnS1(N);
@ -332,7 +332,7 @@ Extrema_POnSurf Extrema_GenExtSS::PointOnS1(const Standard_Integer N) const
//purpose : //purpose :
//======================================================================= //=======================================================================
Extrema_POnSurf Extrema_GenExtSS::PointOnS2(const Standard_Integer N) const const Extrema_POnSurf& Extrema_GenExtSS::PointOnS2(const Standard_Integer N) const
{ {
if (!IsDone()) { StdFail_NotDone::Raise(); } if (!IsDone()) { StdFail_NotDone::Raise(); }
return myF.PointOnS2(N); return myF.PointOnS2(N);

View File

@ -102,6 +102,7 @@ is
is static; is static;
Point (me) returns POnC Point (me) returns POnC
---C++: return const &
---Purpose: Returns the point of the extremum distance. ---Purpose: Returns the point of the extremum distance.
raises NotDone from StdFail raises NotDone from StdFail
-- if IsDone(me)=False. -- if IsDone(me)=False.

View File

@ -167,7 +167,7 @@ Standard_Boolean Extrema_GenLocateExtPC::IsMin () const
//purpose : //purpose :
//======================================================================= //=======================================================================
POnC Extrema_GenLocateExtPC::Point () const const POnC & Extrema_GenLocateExtPC::Point () const
{ {
if (!myDone) { StdFail_NotDone::Raise(); } if (!myDone) { StdFail_NotDone::Raise(); }
return myF.Point(1); return myF.Point(1);

View File

@ -60,6 +60,7 @@ is
is static; is static;
Point (me) returns POnSurf Point (me) returns POnSurf
---C++: return const &
---Purpose: Returns the point of the extremum distance. ---Purpose: Returns the point of the extremum distance.
raises NotDone from StdFail raises NotDone from StdFail
-- if IsDone(me)=False. -- if IsDone(me)=False.

View File

@ -101,7 +101,7 @@ Standard_Real Extrema_GenLocateExtPS::SquareDistance () const
} }
//============================================================================= //=============================================================================
Extrema_POnSurf Extrema_GenLocateExtPS::Point () const const Extrema_POnSurf& Extrema_GenLocateExtPS::Point () const
{ {
if (!IsDone()) { StdFail_NotDone::Raise(); } if (!IsDone()) { StdFail_NotDone::Raise(); }
return myPoint; return myPoint;