0024859: Replace SortTools by STL equivalents
authorabv <abv@opencascade.com>
Tue, 30 Jun 2015 07:47:45 +0000 (10:47 +0300)
committerabv <abv@opencascade.com>
Sat, 11 Jul 2015 09:01:56 +0000 (12:01 +0300)
Package SortTools and its derived classes are removed; STL sort algorithms are used instead.
Comparator objects are mostly reimplemented as local classes.

47 files changed:
adm/UDLIST
src/AppDef/AppDef_Variational.cxx
src/BRepMesh/BRepMesh_FastDiscret.cxx
src/BRepMesh/BRepMesh_FastDiscret.hxx
src/BRepMesh/BRepMesh_FastDiscretFace.cxx
src/Hermit/Hermit.cxx
src/IntTools/IntTools.cdl
src/IntTools/IntTools.cxx
src/IntTools/IntTools_Compare.cdl [deleted file]
src/IntTools/IntTools_Compare.cxx [deleted file]
src/IntTools/IntTools_CompareRange.cdl [deleted file]
src/IntTools/IntTools_CompareRange.cxx [deleted file]
src/IntTools/IntTools_EdgeFace.cxx
src/Resource/Resource.cdl
src/Resource/Resource_Manager.cxx
src/SelectMgr/FILES
src/SelectMgr/SelectMgr.cdl
src/SelectMgr/SelectMgr_CompareResults.hxx [deleted file]
src/SelectMgr/SelectMgr_ViewerSelector.cxx
src/SortTools/SortTools.cdl [deleted file]
src/SortTools/SortTools_HeapSort.cdl [deleted file]
src/SortTools/SortTools_HeapSort.gxx [deleted file]
src/SortTools/SortTools_QuickSort.cdl [deleted file]
src/SortTools/SortTools_QuickSort.gxx [deleted file]
src/SortTools/SortTools_ShellSort.cdl [deleted file]
src/SortTools/SortTools_ShellSort.gxx [deleted file]
src/SortTools/SortTools_StraightInsertionSort.cdl [deleted file]
src/SortTools/SortTools_StraightInsertionSort.gxx [deleted file]
src/TCollection/FILES
src/TCollection/TCollection.cdl
src/TCollection/TCollection_CMPLRS.edl [deleted file]
src/TCollection/TCollection_Compare.cdl [deleted file]
src/TCollection/TCollection_Compare.gxx [deleted file]
src/TCollection/TCollection_CompareOfInteger.cdl [deleted file]
src/TCollection/TCollection_CompareOfInteger.cxx [deleted file]
src/TCollection/TCollection_CompareOfReal.cdl [deleted file]
src/TCollection/TCollection_CompareOfReal.cxx [deleted file]
src/TKernel/PACKAGES
src/math/FILES
src/math/math.cdl
src/math/math_CompareOfValueAndWeight.cdl [deleted file]
src/math/math_CompareOfValueAndWeight.cxx [deleted file]
src/math/math_ComputeGaussPointsAndWeights.cxx
src/math/math_ComputeKronrodPointsAndWeights.cxx
src/math/math_ValueAndWeight.cdl [deleted file]
src/math/math_ValueAndWeight.cxx [deleted file]
src/math/math_ValueAndWeight.hxx [new file with mode: 0644]

index 82e95ac..7ae7410 100644 (file)
@@ -21,7 +21,6 @@ p Poly
 p Precision
 p Quantity
 p Resource
-p SortTools
 p Standard
 p StdFail
 p Storage
index 8962493..25a3184 100644 (file)
@@ -53,9 +53,6 @@
 #include <Precision.hxx>
 #include <AppDef_MyLineTool.hxx>
 
-#include <SortTools_StraightInsertionSortOfReal.hxx>
-#include <SortTools_ShellSortOfReal.hxx>
-#include <TCollection_CompareOfReal.hxx>
 #include <TColStd_HArray2OfInteger.hxx>
 #include <TColStd_Array2OfInteger.hxx>
 #include <TColStd_Array2OfReal.hxx>
@@ -69,6 +66,9 @@
 #include <PLib_HermitJacobi.hxx>
 #include <FEmTool_HAssemblyTable.hxx>
 
+// Add this line:
+#include <algorithm>
+
 #if defined(WNT)
 # include <stdio.h>
 # include <stdarg.h>
@@ -1152,8 +1152,6 @@ void AppDef_Variational::TheMotor(
 
   const Standard_Real BigValue = 1.e37, SmallValue = 1.e-6, SmallestValue = 1.e-9;
 
-  //  SortTools_StraightInsertionSortOfReal Sort;
-  TCollection_CompareOfReal CompReal;
   Handle(TColStd_HArray1OfReal) CurrentTi, NewTi, OldTi;  
   Handle(TColStd_HArray2OfInteger) Dependence;
   Standard_Boolean lestim, lconst, ToOptim, iscut;
@@ -1294,8 +1292,9 @@ void AppDef_Variational::TheMotor(
 
       if (lestim && isnear)  {
         //           (1.7) Optimization of ti by ACR.
-        //     Sort.Sort(CurrentTi->ChangeArray1(), CompReal);
-        SortTools_StraightInsertionSortOfReal::Sort(CurrentTi->ChangeArray1(), CompReal);
+
+        std::stable_sort (CurrentTi->begin(), CurrentTi->end());
+
         Standard_Integer Decima = 4;
 
         CCurrent->Length(0., 1., CBLONG);
@@ -1325,8 +1324,9 @@ void AppDef_Variational::TheMotor(
       OldTi->ChangeArray1() = CurrentTi->Array1();
 
       //     (2.2) Optimization des ti by ACR.
-      //      Sort.Sort(CurrentTi->ChangeArray1(), CompReal);
-      SortTools_StraightInsertionSortOfReal::Sort(CurrentTi->ChangeArray1(), CompReal);
+
+      std::stable_sort (CurrentTi->begin(), CurrentTi->end());
+
       Standard_Integer Decima = 4;
 
       CCurrent->Length(0., 1., CBLONG);
@@ -1412,8 +1412,8 @@ void AppDef_Variational::TheMotor(
 
       //       (3.2) On arrange les ti : Trie + recadrage sur (0,1)
       //         ---> On trie, afin d'assurer l'ordre par la suite.
-      //      Sort.Sort(CurrentTi->ChangeArray1(), CompReal);
-      SortTools_StraightInsertionSortOfReal::Sort(CurrentTi->ChangeArray1(), CompReal);
+
+      std::stable_sort (CurrentTi->begin(), CurrentTi->end());
 
       if ((CurrentTi->Value(1)!= 0.) || 
         (CurrentTi->Value(NbrPnt)!= 1.)) {
@@ -1912,11 +1912,7 @@ void AppDef_Variational::SplitCurve(const Handle(FEmTool_Curve)& InCurve,
     for(i = InKnots.Lower(); i <= InKnots.Upper(); i++) OutKnots(i) = InKnots(i);
     for(i = NbElmOld + 1; i <= NbElm; i++) OutKnots(i + i0) = NewKnots(i);
 
-    //    SortTools_ShellSortOfReal Sort;
-    TCollection_CompareOfReal CompReal;
-
-    //    Sort.Sort(OutKnots, CompReal);
-    SortTools_ShellSortOfReal::Sort(OutKnots, CompReal);
+    std::sort (OutKnots.begin(), OutKnots.end());
   }
   else
     iscut = Standard_False;
index b9391a1..f12c831 100644 (file)
@@ -50,8 +50,6 @@
 #include <TColStd_HArray1OfReal.hxx>
 #include <TColgp_Array1OfPnt2d.hxx>
 #include <TColGeom2d_SequenceOfCurve.hxx>
-#include <SortTools_ShellSortOfReal.hxx>
-#include <TCollection_CompareOfReal.hxx>
 
 #include <TopTools_SequenceOfShape.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
index 67e4b9b..22fc593 100644 (file)
@@ -48,8 +48,6 @@ class BRepMesh_Edge;
 class BRepMesh_Vertex;
 class gp_Pnt;
 class BRepMesh_FaceAttribute;
-class TopTools_DataMapOfShapeReal;
-
 
 //! Algorithm to mesh a shape with respect of the <br>
 //! frontier the deflection and by option the shared <br>
index 4f54272..4e44387 100644 (file)
@@ -37,8 +37,6 @@
 
 #include <Standard_ErrorHandler.hxx>
 #include <Standard_Failure.hxx>
-#include <SortTools_ShellSortOfReal.hxx>
-#include <TCollection_CompareOfReal.hxx>
 #include <TColStd_Array1OfReal.hxx>
 #include <TColStd_ListOfInteger.hxx>
 #include <TColStd_SequenceOfReal.hxx>
@@ -448,10 +446,9 @@ static void filterParameters(const BRepMesh::IMapOfReal& theParams,
   for (j = 1; j <= anInitLen; j++)
     aParamArray(j) = theParams(j);
 
-  TCollection_CompareOfReal aCompare;
-  SortTools_ShellSortOfReal::Sort(aParamArray, aCompare);
+  std::sort (aParamArray.begin(), aParamArray.end());
 
-  // mandadory pre-filtering using the first (minimal) filter value
+  // mandatory pre-filtering using the first (minimal) filter value
   Standard_Real aP1, aP2;
   aP1 = aParamArray(1);
   aParamTmp.Append(aP1);
index ea16073..4d82df2 100644 (file)
 #include <TColgp_Array1OfPnt2d.hxx>
 #include <Standard_DimensionError.hxx>
 #include <Standard_Real.hxx>
-#include <TCollection_CompareOfReal.hxx>
-#include <SortTools_QuickSortOfReal.hxx>
 #include <Precision.hxx>
 
+#include <algorithm>
+
 //=======================================================================
 //function : HermiteCoeff
 //purpose  : calculate  the Hermite coefficients of degree 3 from BS and
@@ -175,8 +175,6 @@ static void PolyTest(const TColStd_Array1OfReal&         Herm,
   Standard_Integer               cas=0,mark=0,dercas=0,  //loop marks
                                  min,max;                //Pole min and max indices
   Standard_Real                  Us1,Us2,a;              //bounderies value of the knots to be inserted
-//  gp_Pnt2d                       P ;
-  TCollection_CompareOfReal      Comp;
   
   U4=0.0;U5=1.0;                                         //default value
   if (Ux!=1.0){
@@ -215,7 +213,9 @@ static void PolyTest(const TColStd_Array1OfReal&         Herm,
 
   TColStd_Array1OfReal knots(1,Knots->Length());
   knots=Knots->ChangeArray1();
-  SortTools_QuickSortOfReal::Sort(knots,Comp);        //sort of the array of knots
+
+  //sort of the array of knots
+  std::sort (knots.begin(), knots.end());
 
   Polesinit(0).SetCoord(0.0,Herm(0));                 //poles of the Hermite polynome in the BSpline form
   Polesinit(1).SetCoord(0.0,Herm(0)+Herm(1)/3.0);
@@ -396,8 +396,6 @@ static void PolyTest(const TColStd_Array1OfReal&        Herm,
   Standard_Integer               cas=0,mark=0,dercas=0,  //loop marks
                                  min,max;                //Pole min and max indices
   Standard_Real                  Us1,Us2,a;              //bounderies value of the knots to be inserted
-//  gp_Pnt2d                       P ;
-  TCollection_CompareOfReal      Comp;
   
   U4=0.0;U5=1.0;                                         //default value
   if (Ux!=1.0){
@@ -439,7 +437,9 @@ static void PolyTest(const TColStd_Array1OfReal&        Herm,
 
   TColStd_Array1OfReal knots(1,Knots->Length());
   knots=Knots->ChangeArray1();
-  SortTools_QuickSortOfReal::Sort(knots,Comp);     //sort of the array of knots
+
+  //sort of the array of knots
+  std::sort (knots.begin(), knots.end());
 
   Polesinit(0).SetCoord(0.0,Herm(0));              //poles of the Hermite polynome in the BSpline form
   Polesinit(1).SetCoord(0.0,Herm(0)+Herm(1)/3.0);
index 10a805d..d6b0350 100644 (file)
@@ -25,7 +25,6 @@ uses
     TColStd, 
     BRepAdaptor, 
     BRepTopAdaptor,
-    SortTools, 
     TopTools, 
     math,
     gp, 
@@ -54,8 +53,6 @@ is
     class Range;         
     class CommonPrt; 
     class Root; 
-    class Compare; 
-    class CompareRange;     
 
     class  EdgeEdge;
 
@@ -115,18 +112,9 @@ is
      
     imported Array1OfRange; 
   
-    class  QuickSort         instantiates  
-     QuickSort from SortTools   (Root from IntTools, 
-                    Array1OfRoots from IntTools, 
-                    Compare from IntTools); 
-        
-    class  QuickSortRange    instantiates  
-     QuickSort from SortTools   (Range from IntTools, 
-                    Array1OfRange from IntTools, 
-                    CompareRange from IntTools); 
-    imported SequenceOfCommonPrts;        
-  
-    imported IndexedDataMapOfTransientAddress; 
+    imported SequenceOfCommonPrts;                         
+        
+    imported IndexedDataMapOfTransientAddress; 
     
 
     imported ListOfCurveRangeSample;
index 793e170..b6a60f9 100644 (file)
@@ -19,8 +19,6 @@
 #include <BRep_Tool.hxx>
 #include <IntTools_Root.hxx>
 #include <IntTools_Array1OfRoots.hxx>
-#include <IntTools_Compare.hxx>
-#include <IntTools_QuickSort.hxx>
 #include <IntTools_Root.hxx>
 
 #include <gce_MakeCirc.hxx>
@@ -32,9 +30,8 @@
 #include <TColStd_ListIteratorOfListOfReal.hxx>
 #include <gce_ErrorType.hxx>
 
-#ifdef WNT
-#pragma warning ( disable : 4101 )
-#endif
+#include <algorithm>
+
 //=======================================================================
 //function : IntTools::GetRadius
 //purpose  : 
   }
 }
 
+//=======================================================================
+
+namespace {
+  // Auxiliary: comparator function for sorting roots
+  bool IntTools_RootComparator (const IntTools_Root& theLeft, const IntTools_Root& theRight)
+  {
+    return theLeft.Root() < theRight.Root();
+  }
+};
+
 //=======================================================================
 //function : SortRoots
 //purpose  : 
 //=======================================================================
   void IntTools::SortRoots(IntTools_SequenceOfRoots& mySequenceOfRoots,
-                          const Standard_Real myEpsT)
+                          const Standard_Real /*myEpsT*/)
 {
   Standard_Integer j, aNbRoots;
 
   aNbRoots=mySequenceOfRoots.Length();
 
-  IntTools_Array1OfRoots anArray1OfRoots(1, aNbRoots);
-  IntTools_Compare aComparator(myEpsT);
-  
+  IntTools_Array1OfRoots anArray1OfRoots(1, aNbRoots);  
   for (j=1; j<=aNbRoots; j++) {
     anArray1OfRoots(j)=mySequenceOfRoots(j);
   }
   
-  IntTools_QuickSort aQS;
-  aQS.Sort(anArray1OfRoots, aComparator);
+  std::sort (anArray1OfRoots.begin(), anArray1OfRoots.end(), IntTools_RootComparator);
   
   mySequenceOfRoots.Clear();
   for (j=1; j<=aNbRoots; j++) {
diff --git a/src/IntTools/IntTools_Compare.cdl b/src/IntTools/IntTools_Compare.cdl
deleted file mode 100644 (file)
index efca7f5..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
--- Created on: 2000-05-22
--- Created by: Peter KURNEV
--- Copyright (c) 2000-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class Compare from IntTools 
-
-       ---Purpose: Auxiliary class to provide a sorting Roots.     
-
-uses
-    Root from IntTools
-
-is
-    Create   
-       returns Compare from IntTools;
-       ---Purpose:
-       --- Empty constructor
-       ---
-        
-    Create  (aTol:Real from Standard) 
-       returns Compare from IntTools;
-       ---Purpose:
-       --- Initializes me by tolerance
-       ---
-        
-    IsLower (me; Left, Right: Root from IntTools)
-       ---Purpose: 
-       --- Returns True if <Left> is lower than <Right>.
-       ---
-       returns Boolean from Standard;
-    
-    IsGreater (me; Left, Right: Root from IntTools)
-       ---Level: Public
-       ---Purpose: 
-       --- Returns True if <Left> is greater than <Right>.
-       ---
-       returns Boolean from Standard;
-
-    IsEqual(me; Left, Right: Root from IntTools)
-       ---Level: Public
-       ---Purpose: 
-       --- Returns True when <Right> and <Left> are equal.
-       ---
-       returns Boolean from Standard ;
-               
-
-fields
-    myTol: Real from Standard; 
-     
-end Compare;
diff --git a/src/IntTools/IntTools_Compare.cxx b/src/IntTools/IntTools_Compare.cxx
deleted file mode 100644 (file)
index 67d2e00..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-// Created on: 2000-05-22
-// Created by: Peter KURNEV
-// Copyright (c) 2000-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <IntTools_Compare.ixx>
-//=======================================================================
-//function :IntTools_Compare::IntTools_Compare
-//purpose  : 
-//=======================================================================
-IntTools_Compare::IntTools_Compare() :myTol(1.e-12) {}
-
-//=======================================================================
-//function :IntTools_Compare::IntTools_Compare
-//purpose  : 
-//=======================================================================
-  IntTools_Compare::IntTools_Compare(const Standard_Real aTol)
-{
-  myTol=aTol;
-}
-
-//=======================================================================
-//function :IsLower
-//purpose  : 
-//=======================================================================
-  Standard_Boolean IntTools_Compare::IsLower(const IntTools_Root& aLeft,
-                                            const IntTools_Root& aRight)const
-{
-  return aLeft.Root()<aRight.Root();
-}
-
-//=======================================================================
-//function :IsGreater
-//purpose  : 
-//=======================================================================
-  Standard_Boolean IntTools_Compare::IsGreater(const IntTools_Root& aLeft,
-                                              const IntTools_Root& aRight)const
-{
-  return !IsLower(aLeft,aRight);
-}
-
-//=======================================================================
-//function :IsEqual
-//purpose  : 
-//=======================================================================
-  Standard_Boolean IntTools_Compare::IsEqual(const IntTools_Root& aLeft,
-                                            const IntTools_Root& aRight)const
-{
-  Standard_Real a, b;
-  a=aLeft.Root();
-  b=aRight.Root();
-  return fabs(a-b) < myTol;
-}
-
-
-
-
-
-
diff --git a/src/IntTools/IntTools_CompareRange.cdl b/src/IntTools/IntTools_CompareRange.cdl
deleted file mode 100644 (file)
index 01730b0..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
--- Created on: 2000-10-24
--- Created by: Peter KURNEV
--- Copyright (c) 2000-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class CompareRange from IntTools 
-
-       ---Purpose: Auxiliary class to provide a sorting Ranges, 
-        --          taking  into  account a value of Left .   
-
-uses
-    Range from IntTools
---raises
-
-is
-    Create   
-       returns CompareRange from IntTools; 
-       ---Purpose:
-       --- Empty constructor
-       ---
-        
-    Create  (aTol:Real from Standard) 
-       returns CompareRange from IntTools;
-       ---Purpose:
-       --- Initializes me by tolerance
-       ---
-        
-    IsLower (me; Left, Right: Range from IntTools)
-       ---Purpose: 
-       --- Returns True if <Left> is lower than <Right>.
-       ---
-       returns Boolean from Standard;
-    
-    IsGreater (me; Left, Right: Range from IntTools)
-       ---Level: Public
-       ---Purpose: 
-       --- Returns True if <Left> is greater than <Right>.
-       ---
-       returns Boolean from Standard;
-
-    IsEqual(me; Left, Right: Range from IntTools)
-       ---Level: Public
-       ---Purpose: 
-       --- Returns True when <Right> and <Left> are equal.
-       ---
-       returns Boolean from Standard ;
-
-fields
-    myTol: Real from Standard; 
-
-end CompareRange;
diff --git a/src/IntTools/IntTools_CompareRange.cxx b/src/IntTools/IntTools_CompareRange.cxx
deleted file mode 100644 (file)
index 3147bd3..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-// Created on: 2000-10-24
-// Created by: Peter KURNEV
-// Copyright (c) 2000-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <IntTools_CompareRange.ixx>
-//=======================================================================
-//function :IntTools_CompareRange::IntTools_CompareRange
-//purpose  : 
-//=======================================================================
-IntTools_CompareRange::IntTools_CompareRange() :myTol(1.e-12) {}
-
-//=======================================================================
-//function :IntTools_CompareRange::IntTools_CompareRange
-//purpose  : 
-//=======================================================================
-  IntTools_CompareRange::IntTools_CompareRange(const Standard_Real aTol)
-{
-  myTol=aTol;
-}
-
-//=======================================================================
-//function :IsLower
-//purpose  : 
-//=======================================================================
-  Standard_Boolean IntTools_CompareRange::IsLower(const IntTools_Range& aLeft,
-                                                 const IntTools_Range& aRight)const
-{
-  return aLeft.First()<aRight.First();
-}
-
-//=======================================================================
-//function :IsGreater
-//purpose  : 
-//=======================================================================
-  Standard_Boolean IntTools_CompareRange::IsGreater(const IntTools_Range& aLeft,
-                                                   const IntTools_Range& aRight)const
-{
-  return !IsLower(aLeft,aRight);
-}
-
-//=======================================================================
-//function :IsEqual
-//purpose  : 
-//=======================================================================
-  Standard_Boolean IntTools_CompareRange::IsEqual(const IntTools_Range& aLeft,
-                                                 const IntTools_Range& aRight)const
-{
-  Standard_Real a, b;
-  a=aLeft.First();
-  b=aRight.First();
-  return fabs(a-b) < myTol;
-}
-
-
-
index 399e8b4..9fbe6f0 100644 (file)
@@ -23,8 +23,6 @@
 #include <IntTools_Range.hxx>
 #include <IntTools_Tools.hxx>
 #include <IntTools_Array1OfRange.hxx>
-#include <IntTools_QuickSortRange.hxx>
-#include <IntTools_CompareRange.hxx>
 #include <IntTools_CommonPrt.hxx>
 #include <IntTools_Root.hxx>
 #include <IntTools_BeanFaceIntersector.hxx>
@@ -64,9 +62,7 @@
 #include <GeomAdaptor_HSurface.hxx>
 #include <IntCurveSurface_IntersectionPoint.hxx>
 
-#ifdef WNT
-#pragma warning ( disable : 4101 )
-#endif
+#include <algorithm>
 
 static
   Standard_Boolean IsCoplanar (const BRepAdaptor_Curve&  ,
@@ -604,6 +600,17 @@ void IntTools_EdgeFace::PrepareArgsFuncArrays(const Standard_Real ta,
   AddDerivativePoints(anArgs, aFunc);
 
 }
+
+//=======================================================================
+
+namespace {
+  // Auxiliary: comparator function for sorting ranges
+  bool IntTools_RangeComparator (const IntTools_Range& theLeft, const IntTools_Range& theRight)
+  {
+    return theLeft.First() < theRight.First();
+  }
+}
+
 //=======================================================================
 //function : AddDerivativePoints
 //purpose  : 
@@ -719,9 +726,7 @@ void IntTools_EdgeFace::AddDerivativePoints
       anArray1OfRange(n+i).SetLast (aFSeq(i));
     }
     
-    IntTools_QuickSortRange aQuickSortRange;
-    IntTools_CompareRange aComparator;
-    aQuickSortRange.Sort (anArray1OfRange, aComparator);
+    std::sort (anArray1OfRange.begin(), anArray1OfRange.end(), IntTools_RangeComparator);
     
     // filling the  output arrays
     myArgsArray.Resize(k);
index 63d4aaf..7860f73 100644 (file)
@@ -23,7 +23,9 @@ package Resource
     --          initialize a variable.
 
 uses
-    TCollection,MMgt,SortTools,TColStd
+    TCollection,
+       MMgt,
+       TColStd
 is 
 
    enumeration FormatType is     
@@ -47,11 +49,6 @@ is
 
    imported DataMapIteratorOfDataMapOfAsciiStringExtendedString;
         
-   class QuickSortOfArray1 instantiates
-        QuickSort from SortTools(AsciiString from TCollection,
-                                 Array1OfAsciiString from TColStd,
-                                 LexicalCompare from Resource) ;
-                                 
 ---Class:
    class LexicalCompare ;
    
index d7142e4..6585761 100644 (file)
@@ -15,7 +15,6 @@
 #include <Resource_Manager.hxx>
 #include <Resource_Manager.ixx>
 #include <Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString.hxx>
-#include <Resource_QuickSortOfArray1.hxx>
 #include <Resource_LexicalCompare.hxx>
 
 #include <OSD_Path.hxx>
@@ -30,6 +29,8 @@
 
 #include <errno.h>
 
+#include <algorithm>
+
 #define END      0
 #define EMPTY    1
 #define COMMENT  2
@@ -286,8 +287,7 @@ Standard_Boolean Resource_Manager::Save() const
     for ( Index = 1; Iter.More(); Iter.Next())
       KeyArray(Index++)= Iter.Key();
 
-    Resource_LexicalCompare Comp;
-    Resource_QuickSortOfArray1::Sort(KeyArray, Comp);
+  std::sort (KeyArray.begin(), KeyArray.end());
 
     TCollection_AsciiString Line, Value;
     for (Index = 1 ; Index <= NbKey ; Index++) {
index c2321f7..3c9296b 100755 (executable)
@@ -1,4 +1,3 @@
-SelectMgr_CompareResults.hxx
 SelectMgr_FrustumBuilder.hxx
 SelectMgr_FrustumBuilder.cxx
 SelectMgr_IndexedMapOfOwner.hxx
index 53f9b37..a2b908e 100644 (file)
@@ -247,7 +247,6 @@ is
 
     pointer SOPtr to SelectableObject from SelectMgr;
 
-    imported CompareResults;
     imported transient class IndexedMapOfOwner;
     imported SelectableObjectSet;
     imported FrustumBuilder;
diff --git a/src/SelectMgr/SelectMgr_CompareResults.hxx b/src/SelectMgr/SelectMgr_CompareResults.hxx
deleted file mode 100644 (file)
index a3b67a8..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-// Created on: 2003-10-23
-// Created by: Alexander GRIGORIEV
-// Copyright (c) 2003-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <SelectMgr_IndexedDataMapOfOwnerCriterion.hxx>
-#include <SelectMgr_SortCriterion.hxx>
-#include <TCollection_CompareOfInteger.hxx>
-
-// Purpose: Redefine CompareOfInteger from TCollection, to be used
-// in method SortResult from class ViewerSelector
-
-class SelectMgr_CompareResults: public TCollection_CompareOfInteger
-{
- public:
-  SelectMgr_CompareResults
-        (const SelectMgr_IndexedDataMapOfOwnerCriterion& aMapOfCriterion)
-          : myMapOfCriterion (aMapOfCriterion) {}
-  Standard_Boolean      IsLower
-                (const Standard_Integer&, const Standard_Integer&) const;
-  Standard_Boolean      IsGreater
-                (const Standard_Integer&, const Standard_Integer&) const;
- private:
-  const SelectMgr_IndexedDataMapOfOwnerCriterion&  myMapOfCriterion;
-  void operator= (const SelectMgr_CompareResults& );
-};
-
-//=======================================================================
-//function : IsLower
-//purpose  : The sort order should be inverse (the greatest to come first)
-//=======================================================================
-
-inline Standard_Boolean SelectMgr_CompareResults::IsLower
-        (const Standard_Integer &Left,const Standard_Integer &Right) const
-{
-  return (myMapOfCriterion.FindFromIndex(Left) >
-          myMapOfCriterion.FindFromIndex(Right));
-}
-
-//=======================================================================
-//function : IsGreater
-//purpose  : The sort order should be inverse (the greatest to come first)
-//=======================================================================
-
-inline Standard_Boolean SelectMgr_CompareResults::IsGreater
-       (const Standard_Integer &Left,const Standard_Integer &Right) const
-{
-  return (myMapOfCriterion.FindFromIndex(Left) <
-          myMapOfCriterion.FindFromIndex(Right));
-}
index c8bb090..5b41ac7 100644 (file)
 #include <OSD_Environment.hxx>
 #include <Precision.hxx>
 #include <SelectMgr_ViewerSelector.hxx>
-#include <SelectMgr_CompareResults.hxx>
 #include <SelectBasics_EntityOwner.hxx>
 #include <SelectBasics_SensitiveEntity.hxx>
 #include <SelectBasics_PickResult.hxx>
 #include <SelectMgr_EntityOwner.hxx>
 #include <SelectMgr_SortCriterion.hxx>
 #include <SelectMgr_SensitiveEntitySet.hxx>
-#include <SortTools_QuickSortOfInteger.hxx>
 #include <TColStd_Array1OfInteger.hxx>
 #include <TCollection_AsciiString.hxx>
 #include <TColStd_HArray1OfInteger.hxx>
 #include <TColStd_ListOfInteger.hxx>
 
+#include <algorithm>
+
+namespace {
+  // Comparison operator for sorting selection results
+  class CompareResults
+  {
+  public:
+   
+    CompareResults (const SelectMgr_IndexedDataMapOfOwnerCriterion& aMapOfCriterion)
+      : myMapOfCriterion (aMapOfCriterion)
+    {
+    }
+
+    Standard_Boolean operator() (Standard_Integer theLeft, Standard_Integer theRight) const
+    {
+      return myMapOfCriterion.FindFromIndex(theLeft) > myMapOfCriterion.FindFromIndex(theRight);
+    }
+
+  private:
+    void operator = (const CompareResults&);
+
+  private:
+    const SelectMgr_IndexedDataMapOfOwnerCriterion&  myMapOfCriterion;
+  };
+}
 
 //=======================================================================
 // function: SelectMgr_ToleranceMap
@@ -687,8 +710,8 @@ void SelectMgr_ViewerSelector::SortResult()
   for (I=1; I <= anExtent; I++)
     thearr(I)=I;
 
-  SortTools_QuickSortOfInteger::Sort (thearr,
-    SelectMgr_CompareResults(mystored));
+  std::sort (thearr.begin(), thearr.end(), CompareResults (mystored));
+
 }
 
 //=======================================================================
diff --git a/src/SortTools/SortTools.cdl b/src/SortTools/SortTools.cdl
deleted file mode 100644 (file)
index a4fe88d..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
--- Created on: 1991-03-07
--- Created by: Herve Legrand
--- Copyright (c) 1991-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
--- Revised:    Fri Oct 30 1992 
--- By     :    Mireille MERCIEN
-
-
-package SortTools
-
-       ---Purpose: This package provides the basic sorting tools generally 
-       --          used.    
-
-uses TCollection,
-     TColStd
-
-is
-        generic class HeapSort;
-
-        generic class QuickSort;
-
-        generic class ShellSort;
-
-        generic class StraightInsertionSort;
-
-
-  -- The table below summarizes the most important characteristics that 
-  -- must be considered when selecting a particular sorting algorithm.
-  -- A sorting algorithm is known as stable if the initial order of items
-  -- with equals keys is preserved after the sorting operation.
-
-  ------------------------------------------------------------------------
-  --  Algorithm        Stable       Comparisons            Moves
-  --                             Min    Avg    Max    Min    Avg     Max     
-  ------------------------------------------------------------------------
-  --                                            2                     2
-  --  QuickSort          No     nlogn  nlogn   n      nlogn  nlogn   n
-  -- 
-  ------------------------------------------------------------------------
-  --
-  --  HeapSort           No     nlogn  nlogn  nlogn   nlogn  nlogn  nlogn
-  --
-  ------------------------------------------------------------------------
-  --                                    1.25                   1.25
-  --  ShellSort          No       -    n        -       -     n       -
-  --
-  ------------------------------------------------------------------------
-  --                                     2     2               2      2
-  --  StraightInsertion  Yes       n    n     n         n     n      n
-  --
-  -------------------------------------------------------------------------
-
-   --+ Heap sort exhibits an interesting time complexity, in that it runs 
-   -- on the order of nlogn for the best, average, and worst case.
-   --+ Quick sort is still faster on the average(its constant of proportiona-
-   -- lity is lower), but it does not guarantee such good worst-case perfor-
-   -- mance.
-   --+ Shell sort is not sensitive to the initial ordering and offers accepta-
-   -- ble running time even for moderately larges arrays (say, 1000 elements).
-   --+ Insertion sort is the method of choice for "almost sorted" arrays with
-   -- few inversions : for such cases, it will outperform even the more 
-   -- sophisticated method (quick sort, heap sort).
-
-
---                             Instantiations                         --
---                             **************                         --
-------------------------------------------------------------------------
-
---
---       Instantiations QuickSort (Integer,Real)
---       ***************************************
- class QuickSortOfInteger instantiates QuickSort(Integer,
-                                            Array1OfInteger from TColStd,
-                                            CompareOfInteger  from TCollection);
- class QuickSortOfReal instantiates QuickSort(Real,
-                                            Array1OfReal from TColStd,
-                                            CompareOfReal from TCollection );
-
---       Instantiations HeapSort (Integer,Real)
---       ***************************************
- class HeapSortOfInteger instantiates HeapSort(Integer,
-                                            Array1OfInteger from TColStd,
-                                            CompareOfInteger  from TCollection);
- class HeapSortOfReal instantiates HeapSort(Real,
-                                            Array1OfReal from TColStd,
-                                            CompareOfReal  from TCollection);
-
---       Instantiations ShellSort (Integer,Real)
---       ***************************************
- class ShellSortOfInteger instantiates ShellSort(Integer,
-                                            Array1OfInteger from TColStd,
-                                            CompareOfInteger  from TCollection);
- class ShellSortOfReal instantiates ShellSort(Real,
-                                            Array1OfReal from TColStd,
-                                            CompareOfReal from TCollection );
-
---       Instantiations StraightInsertionSort (Integer,Real)
---       ***************************************************
- class StraightInsertionSortOfInteger instantiates
-                           StraightInsertionSort(Integer,
-                                            Array1OfInteger from TColStd,
-                                            CompareOfInteger from TCollection);
- class StraightInsertionSortOfReal instantiates
-                           StraightInsertionSort(Real,
-                                            Array1OfReal from TColStd,
-                                            CompareOfReal from TCollection);
-
-end SortTools;
-
diff --git a/src/SortTools/SortTools_HeapSort.cdl b/src/SortTools/SortTools_HeapSort.cdl
deleted file mode 100644 (file)
index 5cf0620..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
--- Created on: 1991-03-05
--- Created by: Herve Legrand
--- Copyright (c) 1991-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-generic class HeapSort from SortTools (Item as any;
-                                       Array as Array1 from TCollection(Item);
-                                       Comparator as any)
-
-       ---Purpose: This class provides the HeapSort algorithm.
-
-is
-
-    Sort(myclass; TheArray : in out Array; Comp : Comparator);
-    ---Purpose: Sort an array using the HeapSort algorithm.
-    ---Level: Public
-end;
-
diff --git a/src/SortTools/SortTools_HeapSort.gxx b/src/SortTools/SortTools_HeapSort.gxx
deleted file mode 100644 (file)
index 82b6e2c..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-// SortTools_HeapSort.gxx
-// cree le 04/11/91 par ASI
-// Reference : Software Conponents with ADA, Grady Booch.
-
-void Shift(Array& TheArray, 
-          const Comparator& Comp, 
-          const Standard_Integer Left, const Standard_Integer Right)
-{
-  Item Temp = TheArray(Left);
-  Standard_Integer Front = Left;
-  Standard_Integer Back = Front * 2;
-  while (Back <= Right) {
-    if (Back < Right) {
-      if(Comp.IsLower(TheArray(Back), TheArray(Back + 1))) {
-       Back = Back + 1; 
-      }
-    }
-    if(!Comp.IsLower(Temp, TheArray(Back))) break;
-    TheArray(Front) = TheArray(Back);
-    Front = Back;
-    if(Front * 2 > TheArray.Upper()) break;
-    Back = Front * 2; 
-  }
-  TheArray(Front) = Temp;
-}
-
-void SortTools_HeapSort::Sort(Array& TheArray, 
-                             const Comparator& Comp)
-{
-  Item TempItem; 
-  Standard_Integer Left;
-  Standard_Integer Right;
-
-  Left = ((TheArray.Upper() - TheArray.Lower() + 1) / 2) + 1;
-  Right = TheArray.Upper();
-  while (Left > TheArray.Lower()) {
-    Left = Left - 1;
-    Shift(TheArray, Comp, Left, Right);
-  }
-  while (Right > TheArray.Lower()) {
-    TempItem = TheArray(TheArray.Lower());
-    TheArray(TheArray.Lower()) = TheArray(Right);
-    TheArray(Right) = TempItem;
-    Right = Right - 1;
-    Shift(TheArray, Comp, Left, Right);
-  }
-}
-
-
-
-
-
diff --git a/src/SortTools/SortTools_QuickSort.cdl b/src/SortTools/SortTools_QuickSort.cdl
deleted file mode 100644 (file)
index 0f4bd48..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
--- Created on: 1991-03-05
--- Created by: Herve Legrand, Mireille MERCIEN
--- Copyright (c) 1991-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-generic class QuickSort from SortTools (Item as any;
-                                        Array as Array1 from TCollection(Item);
-                                        Comparator as any)
-
-       ---Purpose: This class provides the QuickSort algorithm.
-
-is
-
-    Sort(myclass; TheArray : in out Array; Comp : Comparator);
-    ---Purpose: Sort an array using the QuickSort algorithm.
-    ---Level: Public
-
-end;
-
diff --git a/src/SortTools/SortTools_QuickSort.gxx b/src/SortTools/SortTools_QuickSort.gxx
deleted file mode 100644 (file)
index 8c1d927..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-// SortTools_QuickSort.gxx 
-// cree le 04/11/91 par ASI
-// Reference : Software Conponents with ADA, Grady Booch.
-
-inline void Exchange(Item& Left, Item& Right)
-{  
-  Item Temp = Left;
-  Left = Right;
-  Right = Temp;
-}
-
-static void SortRecursive(Array& TheArray,
-                         const Comparator& Comp,
-                         const Standard_Integer Left, 
-                         const Standard_Integer Right)
-{
-  Item Pivot;
-  Standard_Integer Front, Back, Middle;
-  
-  if(Left < Right) {
-    Middle = (Left + Right) / 2;
-    if(Comp.IsLower(TheArray(Middle), TheArray(Left))) {
-      Exchange(TheArray(Middle), TheArray(Left));
-    }
-    if(Comp.IsLower(TheArray(Right), TheArray(Left))) {
-      Exchange(TheArray(Right), TheArray(Left));
-    }
-    if(Comp.IsLower(TheArray(Right), TheArray(Middle))) {
-      Exchange(TheArray(Right), TheArray(Middle));
-    }
-    Pivot = TheArray(Middle);
-    Exchange(TheArray(Middle), TheArray(Right - 1));
-    Front = Left + 1;
-    Back = Right - 1;
-    if(Back != TheArray.Lower()) {
-      Back = Back - 1;
-    }
-    for(;;) {
-      while (Comp.IsLower(TheArray(Front), Pivot)) {
-       Front = Front + 1;
-      }
-      while (Comp.IsLower(Pivot, TheArray(Back))) {
-       Back = Back - 1;
-      }
-      if(Front <= Back) {
-       if(Front == TheArray.Upper()) return;
-       if(Back == TheArray.Lower()) return;  
-       Exchange(TheArray(Front), TheArray(Back));
-       Front = Front + 1;
-       Back = Back - 1;
-      }
-      if(Front > Back) break;
-    }
-    SortRecursive(TheArray, Comp, Left, Back);
-    SortRecursive(TheArray, Comp, Front, Right);
-  }
-}
-
-void SortTools_QuickSort::Sort(Array& TheArray, 
-                         const Comparator& Comp)
-{
-  SortRecursive(TheArray, Comp, TheArray.Lower(), TheArray.Upper()); 
-}
-
-
-
-
-
diff --git a/src/SortTools/SortTools_ShellSort.cdl b/src/SortTools/SortTools_ShellSort.cdl
deleted file mode 100644 (file)
index 14757a7..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
--- Created on: 1991-03-05
--- Created by: Herve Legrand,Mireille MERCIEN
--- Copyright (c) 1991-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-generic class ShellSort from SortTools (Item as any;
-                                        Array as Array1 from TCollection(Item);
-                                        Comparator as any)
-
-       ---Purpose: This class provides the ShellSort algorithm.
-
-is
-
-    Sort(myclass; TheArray : in out Array; Comp : Comparator);
-    ---Purpose: Sort an array using the ShellSort algorithm.
-    ---Level: Public
-
-end;
diff --git a/src/SortTools/SortTools_ShellSort.gxx b/src/SortTools/SortTools_ShellSort.gxx
deleted file mode 100644 (file)
index 2a20188..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-// SortTools_ShellSort.gxx
-// cree le 04/11/91 par ASI
-// Reference : Software Conponents with ADA, Grady Booch.
-
-void SortTools_ShellSort::Sort(Array& TheArray, 
-                                     const Comparator& Comp) 
-{
-
-  Item    TempItem;
-  Standard_Integer Outer;
-  Standard_Integer Inner;
-  Standard_Integer Inc = 1;
-
-  for(;;) {
-    if((9 * Inc) + 4 >= TheArray.Upper() - TheArray.Lower() + 1) break;
-    Inc = (Inc * 3) + 1;
-  }
-  for(;;) {
-    Outer = TheArray.Lower() + Inc;
-    for(;;) {
-      TempItem = TheArray(Outer);
-      Inner = Outer;
-      while (Comp.IsLower(TempItem, TheArray(Inner - Inc))) {
-       TheArray(Inner) = TheArray(Inner - Inc);
-       Inner = Inner - Inc;
-       if(Inner - Inc < TheArray.Lower()) break;
-      }
-      TheArray(Inner) = TempItem;
-      if(Outer + Inc > TheArray.Upper()) break;
-      Outer = Outer + Inc;
-    }
-    if(Inc == 1) break;
-    Inc = (Inc - 1) / 3;
-  }
-}
-
-
-
-
-
diff --git a/src/SortTools/SortTools_StraightInsertionSort.cdl b/src/SortTools/SortTools_StraightInsertionSort.cdl
deleted file mode 100644 (file)
index 2dec874..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
--- Created on: 1991-03-05
--- Created by: Herve Legrand, Mireille MERCIEN
--- Copyright (c) 1991-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-generic class StraightInsertionSort from SortTools (
-                       Item as any;
-                       Array as Array1 from TCollection(Item);
-                       Comparator as any)
-
-       ---Purpose: This class provides the StraightInsertionSort algorithm.
-
-is
-
-    Sort(myclass; TheArray : in out Array; Comp : Comparator);
-    ---Purpose: Sort an array using the StraightInsertionSort algorithm.
-    ---Level: Public
-
-end;
diff --git a/src/SortTools/SortTools_StraightInsertionSort.gxx b/src/SortTools/SortTools_StraightInsertionSort.gxx
deleted file mode 100644 (file)
index 306f95c..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-// SortTools_StraightInsertionSort.gxx
-// cree le 04/11/91 par ASI
-// Reference : Software Conponents with ADA, Grady Booch.
-
-void SortTools_StraightInsertionSort::Sort(Array& TheArray,
-                                          const Comparator& Comp) 
-{      
-  Item    TempItem;
-  Standard_Integer J;
-
-  for(Standard_Integer I = TheArray.Lower() + 1; I <= TheArray.Upper(); I++) {
-    TempItem = TheArray(I);
-    J = I;
-    while (Comp.IsLower(TempItem, TheArray(J - 1))) {
-      TheArray(J) = TheArray(J - 1);
-      J = J - 1;
-      if (J == TheArray.Lower()) break;
-    }
-    TheArray(J) = TempItem;
-  }
-}
-
-
-
-
-
index f9cd00c..b6ae69b 100755 (executable)
@@ -1,3 +1 @@
-TCollection_Compare.gxx
-TCollection_CMPLRS.edl
 TCollection_WOKSteps.edl
index cfb3b97..55d1d12 100644 (file)
@@ -79,19 +79,6 @@ is
 
     enumeration Side is Left , Right;
     
-    deferred generic class Compare ;
-
-    private deferred class PrivCompareOfInteger 
-            instantiates Compare from TCollection(Integer from Standard); 
-
-    private deferred class PrivCompareOfReal 
-            instantiates Compare from TCollection(Real from Standard); 
-
-    class CompareOfInteger;
-       
-    class CompareOfReal;
-    
-
     NextPrimeForMap(I : Integer) returns Integer;
        ---Purpose: Returns a  prime number greater than  <I> suitable
        -- to dimension a Map.  When  <I> becomes great there
diff --git a/src/TCollection/TCollection_CMPLRS.edl b/src/TCollection/TCollection_CMPLRS.edl
deleted file mode 100644 (file)
index 9c2234c..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
--- Created on: 1998-02-20
--- Created by: euclid
--- Copyright (c) 1998-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-@if ( %DebugMode == "False" ) then
-
-       @if ( %Station == "sun" ) then
-               @set  %CMPLRS_CXX_ModeOpt = " -O3 -DNo_Exception ";  
-       @endif;
-
-       @if ( %Station == "ao1" ) then
-               @string  %CMPLRS_CXX_ModeOpt += " -O3 -DNo_Exception ";  
-       @endif;
-
-       @if ( %Station == "sil" ) then
-               @set  %CMPLRS_CXX_ModeOpt = " -O2 -DNo_Exception ";  
-       @endif;
-
-       @if ( %Station == "hp" ) then
-               @set  %CMPLRS_CXX_ModeOpt = " +O3 -DNo_Exception ";  
-       @endif;
-
-@endif;
-
diff --git a/src/TCollection/TCollection_Compare.cdl b/src/TCollection/TCollection_Compare.cdl
deleted file mode 100644 (file)
index def3e20..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
--- Created on: 1991-05-14
--- Created by: Annick PANCHER
--- Copyright (c) 1991-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
--- Revised:     Mireille MERCIEN
-
-
-deferred generic class Compare from TCollection ( Item as any )
-
-       ---Purpose: Defines a comparison operator which can be used by
-       -- any ordered structure.   The  way to compare items
-       -- has  to be described  in  subclasses, which inherit
-       -- from instantiations of Compare.
-
-is
-
-    IsLower (me; Left, Right: Item)
-       ---Level: Public
-       ---Purpose: returns True if <Left> is lower than <Right>.
-    returns Boolean
-    is virtual;
-    
-    IsGreater (me; Left, Right: Item)
-       ---Level: Public
-       ---Purpose: returns True if <Left> is greater than <Right>.
-    returns Boolean
-    is virtual;
-
-    IsEqual(me; Left, Right: Item)
-       ---Level: Public
-       ---Purpose: returns True when <Right> and <Left> are equal.
-    returns Boolean
-    is virtual;
-       
-end;
-
-
diff --git a/src/TCollection/TCollection_Compare.gxx b/src/TCollection/TCollection_Compare.gxx
deleted file mode 100644 (file)
index f710f55..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-// Created on: 1992-08-27
-// Created by: Mireille MERCIEN
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Standard_NotImplemented.hxx>
-
-// -----------
-// IsLower :
-// -----------
-Standard_Boolean TCollection_Compare::IsLower (const Item& ,
-                                     const Item& ) const
-{
-  Standard_NotImplemented::Raise();
-  return Standard_False;
-}
-
-// -----------
-// IsGreater :
-// -----------
-Standard_Boolean TCollection_Compare::IsGreater (const Item& ,
-                                     const Item& ) const
-{
-  Standard_NotImplemented::Raise();
-  return Standard_False;
-}
-
-// -----------
-// IsEqual :
-// -----------
-Standard_Boolean TCollection_Compare::IsEqual (const Item& Left,
-                                     const Item& Right) const
-{
-   return (Left == Right) ;
-}
-
-
diff --git a/src/TCollection/TCollection_CompareOfInteger.cdl b/src/TCollection/TCollection_CompareOfInteger.cdl
deleted file mode 100644 (file)
index b31067e..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
--- Created on: 1992-08-27
--- Created by: Mireille MERCIEN
--- Copyright (c) 1992-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class CompareOfInteger from TCollection 
-  inherits 
-    PrivCompareOfInteger
-
-is
-
-    Create ;
-    
-    IsLower (me; Left, Right: Integer)
-       ---Level: Public
-       ---Purpose: Returns True if <Left> is lower than <Right>.
-       returns Boolean
-        is redefined;
-
-    IsGreater (me; Left, Right: Integer)
-       ---Level: Public
-       ---Purpose: Returns True if <Left> is greater than <Right>.
-       returns Boolean
-       is redefined;
-
-end;
diff --git a/src/TCollection/TCollection_CompareOfInteger.cxx b/src/TCollection/TCollection_CompareOfInteger.cxx
deleted file mode 100644 (file)
index b1e11b8..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-// Created on: 1992-08-27
-// Created by: Mireille MERCIEN
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <TCollection_CompareOfInteger.ixx>
-
-// -----------
-// Create :
-// -----------
-TCollection_CompareOfInteger::TCollection_CompareOfInteger()
-{
-}
-
-// -----------
-// IsLower :
-// -----------
-Standard_Boolean TCollection_CompareOfInteger::IsLower (
-       const Standard_Integer &Left,const Standard_Integer &Right) const
-{
-   return (Left < Right) ;
-}
-
-// -----------
-// IsGreater :
-// -----------
-Standard_Boolean TCollection_CompareOfInteger::IsGreater (
-       const Standard_Integer &Left,const Standard_Integer &Right) const
-{
-   return (Left > Right) ;
-}                                              
diff --git a/src/TCollection/TCollection_CompareOfReal.cdl b/src/TCollection/TCollection_CompareOfReal.cdl
deleted file mode 100644 (file)
index 0da832a..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
--- Created on: 1992-08-27
--- Created by: Mireille MERCIEN
--- Copyright (c) 1992-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class CompareOfReal from TCollection 
-  inherits 
-    PrivCompareOfReal
-
-is
-
-    Create;
-
-    IsLower (me; Left, Right: Real)
-       ---Level: Public
-       ---Purpose: Returns True if <Left> is lower than <Right>.
-       returns Boolean
-        is redefined;
-
-    IsGreater (me; Left, Right: Real)
-       ---Level: Public
-       ---Purpose: Returns True if <Left> is greater than <Right>.
-       returns Boolean
-       is redefined;
-
-end;
diff --git a/src/TCollection/TCollection_CompareOfReal.cxx b/src/TCollection/TCollection_CompareOfReal.cxx
deleted file mode 100644 (file)
index c2740e1..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-// Created on: 1992-08-27
-// Created by: Mireille MERCIEN
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <TCollection_CompareOfReal.ixx>
-
-// -----------
-// Create :
-// -----------
-TCollection_CompareOfReal::TCollection_CompareOfReal()
-{
-}
-
-// -----------
-// IsLower :
-// -----------
-Standard_Boolean TCollection_CompareOfReal::IsLower (
-       const Standard_Real &Left,const Standard_Real &Right) const
-{
-   return (Left < Right) ;
-}
-
-// -----------
-// IsGreater :
-// -----------
-Standard_Boolean TCollection_CompareOfReal::IsGreater (
-       const Standard_Real &Left,const Standard_Real &Right) const
-{
-   return (Left > Right) ;
-}                                              
-
-
-
-
-
index 0cb3325..501e8c4 100755 (executable)
@@ -4,7 +4,6 @@ OSD
 Plugin
 Quantity
 Resource
-SortTools
 Standard
 StdFail
 Storage
index 52cff0e..d688372 100755 (executable)
@@ -15,3 +15,4 @@ math_BullardGenerator.hxx
 math_PSOParticlesPool.hxx
 math_PSOParticlesPool.cxx
 math_Array1OfValueAndWeight.hxx
+math_ValueAndWeight.hxx
index 9586654..cddb4f0 100644 (file)
@@ -20,7 +20,7 @@
 
 package math
 
-uses StdFail, TColStd, TCollection, Standard,  SortTools
+uses StdFail, TColStd, TCollection, Standard
          
 is
 
@@ -86,13 +86,8 @@ is
     class EigenValuesSearcher;  -- for Kronrod method
     class ComputeGaussPointsAndWeights; 
     class ComputeKronrodPointsAndWeights; 
-    class ValueAndWeight; 
+    imported ValueAndWeight; 
     imported Array1OfValueAndWeight;
-    class CompareOfValueAndWeight; 
-    class QuickSortOfValueAndWeight
-       instantiates QuickSort from SortTools (ValueAndWeight from math, 
-                                              Array1OfValueAndWeight from math,
-                                              CompareOfValueAndWeight from math);
 
        class DoubleTab;
 
diff --git a/src/math/math_CompareOfValueAndWeight.cdl b/src/math/math_CompareOfValueAndWeight.cdl
deleted file mode 100644 (file)
index 6e0f07b..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
--- Created on: 2005-12-20
--- Created by: Julia GERASIMOVA
--- Copyright (c) 2005-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class CompareOfValueAndWeight from math 
-
-uses 
-
-    ValueAndWeight from math         
-
-is 
-    Create; 
-     
-    IsLower (me; Left, Right: ValueAndWeight)
-       ---Level: Public
-       ---Purpose: Returns True if <Left.Value()> is lower than <Right.Value()>.
-    returns Boolean from Standard;
-
-    IsGreater (me; Left, Right: ValueAndWeight)
-       ---Level: Public
-       ---Purpose: Returns True if <Left.Value()> is greater than <Right.Value()>.
-    returns Boolean from Standard;
-
-    IsEqual(me; Left, Right: ValueAndWeight)
-       ---Level: Public
-       ---Purpose: returns True when <Right> and <Left> are equal.
-    returns Boolean from Standard;
-
-end;
-    
diff --git a/src/math/math_CompareOfValueAndWeight.cxx b/src/math/math_CompareOfValueAndWeight.cxx
deleted file mode 100644 (file)
index 4c2836c..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-// Created on: 2005-12-20
-// Created by: Julia GERASIMOVA
-// Copyright (c) 2005-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <math_CompareOfValueAndWeight.ixx>
-
-// -----------
-// Create :
-// -----------
-math_CompareOfValueAndWeight::math_CompareOfValueAndWeight()
-{
-}
-
-// -----------
-// IsLower :
-// -----------
-Standard_Boolean math_CompareOfValueAndWeight::IsLower(const math_ValueAndWeight& Left,
-                                                      const math_ValueAndWeight& Right) const
-{
-  return (Left.Value() < Right.Value());
-}
-
-// -----------
-// IsGreater :
-// -----------
-Standard_Boolean math_CompareOfValueAndWeight::IsGreater(const math_ValueAndWeight& Left,
-                                                        const math_ValueAndWeight& Right) const
-{
-  return (Left.Value() > Right.Value());
-}
-
-// -----------
-// IsEqual :
-// -----------
-Standard_Boolean math_CompareOfValueAndWeight::IsEqual(const math_ValueAndWeight& Left,
-                                                      const math_ValueAndWeight& Right) const
-{
-  return (Left.Value() == Right.Value());
-}
index 8ee76c8..0744e6c 100644 (file)
 
 #include <math_EigenValuesSearcher.hxx>
 #include <math_Array1OfValueAndWeight.hxx>
-#include <math_CompareOfValueAndWeight.hxx>
-#include <math_QuickSortOfValueAndWeight.hxx>
 #include <Standard_ErrorHandler.hxx>
 
+#include <algorithm>
+
 math_ComputeGaussPointsAndWeights::math_ComputeGaussPointsAndWeights(const Standard_Integer Number)
 {
   myIsDone = Standard_False;
@@ -62,8 +62,7 @@ math_ComputeGaussPointsAndWeights::math_ComputeGaussPointsAndWeights(const Stand
        VWarray(i) = EVW;
       }
 
-      math_CompareOfValueAndWeight theComparator;
-      math_QuickSortOfValueAndWeight::Sort(VWarray, theComparator);
+      std::sort (VWarray.begin(), VWarray.end());
 
       for (i = 1; i <= Number; i++) {
        myPoints->ChangeValue(i)  = VWarray(i).Value();
index 4bd6af9..59d5af8 100644 (file)
 #include <math_ComputeKronrodPointsAndWeights.ixx>
 #include <math_EigenValuesSearcher.hxx>
 #include <math_Array1OfValueAndWeight.hxx>
-#include <math_CompareOfValueAndWeight.hxx>
-#include <math_QuickSortOfValueAndWeight.hxx>
 #include <Standard_ErrorHandler.hxx>
 
+#include <algorithm>
+
 math_ComputeKronrodPointsAndWeights::math_ComputeKronrodPointsAndWeights(const Standard_Integer Number)
 {
   myIsDone = Standard_False;
@@ -154,8 +154,7 @@ math_ComputeKronrodPointsAndWeights::math_ComputeKronrodPointsAndWeights(const S
        VWarray(i) = EVW;
       }
 
-      math_CompareOfValueAndWeight theComparator;
-      math_QuickSortOfValueAndWeight::Sort(VWarray, theComparator);
+      std::sort (VWarray.begin(), VWarray.end());
       
       for (i = 1; i <= a2NP1; i++) {
        myPoints->ChangeValue(i)  = VWarray(i).Value();
diff --git a/src/math/math_ValueAndWeight.cdl b/src/math/math_ValueAndWeight.cdl
deleted file mode 100644 (file)
index 0bd620f..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
--- Created on: 2005-12-20
--- Created by: Julia GERASIMOVA
--- Copyright (c) 2005-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class ValueAndWeight from math
-
-is  
-    Create
-    returns ValueAndWeight; 
-
-    Create(Value  : Real from Standard; 
-          Weight : Real from Standard) 
-    returns ValueAndWeight; 
-     
-    Value(me) 
-    returns Real from Standard; 
-     
-    Weight(me) 
-    returns Real from Standard; 
-     
-fields 
-    myValue  : Real from Standard; 
-    myWeight : Real from Standard;
-
-end ValueAndWeight;
diff --git a/src/math/math_ValueAndWeight.cxx b/src/math/math_ValueAndWeight.cxx
deleted file mode 100644 (file)
index f792013..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// Created on: 2005-12-20
-// Created by: Julia GERASIMOVA
-// Copyright (c) 2005-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <math_ValueAndWeight.ixx>
-
-math_ValueAndWeight::math_ValueAndWeight()
-{
-}
-
-math_ValueAndWeight::math_ValueAndWeight(const Standard_Real Value,
-                                        const Standard_Real Weight)
-     : myValue(Value),
-       myWeight(Weight)
-{
-}
-
-Standard_Real math_ValueAndWeight::Value() const
-{
-  return myValue;
-}
-
-Standard_Real math_ValueAndWeight::Weight() const
-{
-  return myWeight;
-}
diff --git a/src/math/math_ValueAndWeight.hxx b/src/math/math_ValueAndWeight.hxx
new file mode 100644 (file)
index 0000000..b2c2b45
--- /dev/null
@@ -0,0 +1,55 @@
+// Created on: 2005-12-20
+// Created by: Julia GERASIMOVA
+// Copyright (c) 2005-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _math_ValueAndWeight_HeaderFile
+#define _math_ValueAndWeight_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Macro.hxx>
+
+#include <Standard_Real.hxx>
+
+//! Simple container storing two reals: value and weight
+class math_ValueAndWeight 
+{
+public:
+
+  DEFINE_STANDARD_ALLOC
+  
+  math_ValueAndWeight () : myValue(0.), myWeight(0.) {}
+  
+  math_ValueAndWeight (Standard_Real theValue, Standard_Real theWeight)
+  : myValue(theValue), myWeight(theWeight)
+  {}
+  
+  Standard_Real Value() const { return myValue; }
+  
+  Standard_Real Weight() const { return myWeight; }
+
+
+private:
+  Standard_Real myValue;
+  Standard_Real myWeight;
+};
+
+//! Comparison operator for math_ValueAndWeight, needed for sorting algorithms
+inline bool operator < (const math_ValueAndWeight& theLeft, 
+                        const math_ValueAndWeight& theRight)
+{
+  return theLeft.Value() < theRight.Value();
+}
+
+#endif // _math_ValueAndWeight_HeaderFile