]> OCCT Git - occt-copy.git/commitdiff
0022815: Missing delete operator for placement new
authordbv <dbv@opencascade.com>
Tue, 6 Mar 2012 08:32:06 +0000 (12:32 +0400)
committerbugmaster <bugmaster@opencascade.com>
Tue, 6 Mar 2012 13:25:00 +0000 (17:25 +0400)
115 files changed:
src/BRepExtrema/BRepExtrema_DistShapeShape.hxx
src/BRepExtrema/BRepExtrema_DistanceSS.hxx
src/BRepExtrema/BRepExtrema_ExtCC.hxx
src/BRepExtrema/BRepExtrema_ExtCF.hxx
src/BRepExtrema/BRepExtrema_ExtFF.hxx
src/BRepExtrema/BRepExtrema_ExtPC.hxx
src/BRepExtrema/BRepExtrema_ExtPF.hxx
src/BRepExtrema/BRepExtrema_SolutionElem.hxx
src/BRepPrim/BRepPrim_OneAxis.hxx
src/BRepSweep/BRepSweep_NumLinearRegularSweep.hxx
src/DBC/DBC_VArray.gxx
src/InterfaceGraphic/InterfaceGraphic_degeneration.hxx
src/InterfaceGraphic/InterfaceGraphic_telem.hxx
src/LDOM/LDOM_BasicAttribute.cxx
src/LDOM/LDOM_BasicAttribute.hxx
src/LDOM/LDOM_BasicElement.cxx
src/LDOM/LDOM_BasicElement.hxx
src/LDOM/LDOM_BasicNode.hxx
src/LDOM/LDOM_BasicText.cxx
src/LDOM/LDOM_BasicText.hxx
src/NCollection/FILES
src/NCollection/NCollection_Array1.hxx
src/NCollection/NCollection_Array2.hxx
src/NCollection/NCollection_BaseCollection.hxx
src/NCollection/NCollection_BaseList.hxx
src/NCollection/NCollection_BaseMap.hxx
src/NCollection/NCollection_CellFilter.hxx
src/NCollection/NCollection_DataMap.hxx
src/NCollection/NCollection_DefineAlloc.hxx [new file with mode: 0644]
src/NCollection/NCollection_DefineArray1.hxx
src/NCollection/NCollection_DefineArray2.hxx
src/NCollection/NCollection_DefineDataMap.hxx
src/NCollection/NCollection_DefineDoubleMap.hxx
src/NCollection/NCollection_DefineIndexedDataMap.hxx
src/NCollection/NCollection_DefineIndexedMap.hxx
src/NCollection/NCollection_DefineList.hxx
src/NCollection/NCollection_DefineMap.hxx
src/NCollection/NCollection_DefineQueue.hxx
src/NCollection/NCollection_DefineSList.hxx
src/NCollection/NCollection_DefineSequence.hxx
src/NCollection/NCollection_DefineSet.hxx
src/NCollection/NCollection_DefineStack.hxx
src/NCollection/NCollection_DefineTListIterator.hxx
src/NCollection/NCollection_DefineTListNode.hxx
src/NCollection/NCollection_DefineVector.hxx
src/NCollection/NCollection_DoubleMap.hxx
src/NCollection/NCollection_IndexedDataMap.hxx
src/NCollection/NCollection_IndexedMap.hxx
src/NCollection/NCollection_List.hxx
src/NCollection/NCollection_ListNode.hxx
src/NCollection/NCollection_Map.hxx
src/NCollection/NCollection_Queue.hxx
src/NCollection/NCollection_SList.hxx
src/NCollection/NCollection_Sequence.hxx
src/NCollection/NCollection_Set.hxx
src/NCollection/NCollection_SparseArray.hxx
src/NCollection/NCollection_Stack.hxx
src/NCollection/NCollection_TListIterator.hxx
src/NCollection/NCollection_TListNode.hxx
src/NCollection/NCollection_UBTree.hxx
src/NCollection/NCollection_Vector.hxx
src/NIS/NIS_Drawer.hxx
src/NIS/NIS_Triangulated.hxx
src/OpenGl/OpenGl_AspectFace.hxx
src/OpenGl/OpenGl_AspectLine.hxx
src/OpenGl/OpenGl_AspectMarker.hxx
src/OpenGl/OpenGl_AspectText.hxx
src/OpenGl/OpenGl_CView.hxx
src/OpenGl/OpenGl_Display.hxx
src/OpenGl/OpenGl_Element.hxx
src/OpenGl/OpenGl_GraduatedTrihedron.hxx
src/OpenGl/OpenGl_Group.hxx
src/OpenGl/OpenGl_Light.hxx
src/OpenGl/OpenGl_Marker.hxx
src/OpenGl/OpenGl_MarkerSet.hxx
src/OpenGl/OpenGl_Matrix.hxx
src/OpenGl/OpenGl_Mesh.hxx
src/OpenGl/OpenGl_Polygon.cxx
src/OpenGl/OpenGl_Polygon.hxx
src/OpenGl/OpenGl_Polyline.hxx
src/OpenGl/OpenGl_PrimitiveArray.hxx
src/OpenGl/OpenGl_PriorityList.hxx
src/OpenGl/OpenGl_QuadrangleStrip.hxx
src/OpenGl/OpenGl_Structure.hxx
src/OpenGl/OpenGl_Text.hxx
src/OpenGl/OpenGl_TextParam.hxx
src/OpenGl/OpenGl_TextureBox.cxx
src/OpenGl/OpenGl_TextureBox.hxx
src/OpenGl/OpenGl_TriangleStrip.hxx
src/OpenGl/OpenGl_Trihedron.hxx
src/OpenGl/OpenGl_View.hxx
src/OpenGl/OpenGl_View_2.cxx
src/OpenGl/OpenGl_Window.hxx
src/OpenGl/OpenGl_Workspace.hxx
src/Poly/Poly_CoherentNode.cxx
src/Poly/Poly_CoherentTriPtr.cxx
src/Poly/Poly_CoherentTriPtr.hxx
src/Poly/Poly_Connect.cxx
src/Standard/FILES
src/Standard/Handle_Standard_Persistent.hxx
src/Standard/Handle_Standard_Transient.hxx
src/Standard/StandardCSFDB.cxx
src/Standard/Standard_DefineAlloc.hxx [new file with mode: 0644]
src/Standard/Standard_Macro.hxx
src/Standard/Standard_Persistent_proto.hxx
src/Standard/Standard_Transient_proto.hxx
src/Standard/Standard_TypeDef.hxx
src/Storage/Storage_BucketOfPersistent.hxx
src/Storage/Storage_Schema.cxx
src/TColStd/TColStd_PackedMapOfInteger.hxx
src/TDF/TDF_Data.cxx
src/TDF/TDF_Label.cxx
src/TDF/TDF_LabelNode.hxx
src/TNaming/TNaming_NamedShape.cxx
src/VoxelClient/VoxelClient_VisDrawer.cxx

index 119f81a9d0c6045c1f6ee56d08dda9cfdcf8b632..7004352a840a4a2e72a10aeaf09aebffce2eacd3 100644 (file)
@@ -25,6 +25,9 @@
 #ifndef _Standard_HeaderFile
 #include <Standard.hxx>
 #endif
+#ifndef _Standard_DefineAlloc_HeaderFile
+#include <Standard_DefineAlloc.hxx>
+#endif
 #ifndef _Standard_Macro_HeaderFile
 #include <Standard_Macro.hxx>
 #endif
@@ -76,18 +79,7 @@ class BRepExtrema_DistShapeShape
 {
  public:
 
-  void* operator new(size_t,void* anAddress) 
-  {
-    return anAddress;
-  }
-  void* operator new(size_t size) 
-  {
-    return Standard::Allocate(size); 
-  }
-  void  operator delete(void *anAddress) 
-  {
-    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
-  }
+  DEFINE_STANDARD_ALLOC
 
   //! create empty tool <br>
   Standard_EXPORT BRepExtrema_DistShapeShape();
index 522133baa2dead7f6044edcaef165f1d0104d1a2..183c7aa769bc1d0264c1583ca167b7355c19c435 100644 (file)
@@ -25,6 +25,9 @@
 #ifndef _Standard_HeaderFile
 #include <Standard.hxx>
 #endif
+#ifndef _Standard_DefineAlloc_HeaderFile
+#include <Standard_DefineAlloc.hxx>
+#endif
 #ifndef _Standard_Macro_HeaderFile
 #include <Standard_Macro.hxx>
 #endif
@@ -60,18 +63,7 @@ class BRepExtrema_DistanceSS
 {
  public:
 
-  void* operator new(size_t,void* anAddress) 
-  {
-    return anAddress;
-  }
-  void* operator new(size_t size) 
-  {
-    return Standard::Allocate(size); 
-  }
-  void  operator delete(void *anAddress) 
-  {
-    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
-  }
+  DEFINE_STANDARD_ALLOC
 
   //! computes the distance between two Shapes ( face edge vertex). <br>
   Standard_EXPORT BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2,
index a6e2fcd31c3f18da56c71a4f39f21f6346125b49..6e4277524147f1c1d6e3185b16965995dc3ac995 100644 (file)
@@ -9,6 +9,9 @@
 #ifndef _Standard_HeaderFile
 #include <Standard.hxx>
 #endif
+#ifndef _Standard_DefineAlloc_HeaderFile
+#include <Standard_DefineAlloc.hxx>
+#endif
 #ifndef _Standard_Macro_HeaderFile
 #include <Standard_Macro.hxx>
 #endif
@@ -37,18 +40,7 @@ class BRepExtrema_ExtCC
 {
  public:
 
-  void* operator new(size_t,void* anAddress) 
-  {
-    return anAddress;
-  }
-  void* operator new(size_t size) 
-  {
-    return Standard::Allocate(size); 
-  }
-  void  operator delete(void *anAddress) 
-  {
-    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
-  }
+  DEFINE_STANDARD_ALLOC
   
   Standard_EXPORT BRepExtrema_ExtCC()
   {
index 1fb6d6274321303d359bc04c88d9f423a3fb6dae..045e299f52dc923fcf7a59f049ab49d2c0672677 100644 (file)
@@ -9,6 +9,9 @@
 #ifndef _Standard_HeaderFile
 #include <Standard.hxx>
 #endif
+#ifndef _Standard_DefineAlloc_HeaderFile
+#include <Standard_DefineAlloc.hxx>
+#endif
 #ifndef _Standard_Macro_HeaderFile
 #include <Standard_Macro.hxx>
 #endif
@@ -53,18 +56,7 @@ class BRepExtrema_ExtCF
 {
  public:
 
-  void* operator new(size_t,void* anAddress) 
-  {
-    return anAddress;
-  }
-  void* operator new(size_t size) 
-  {
-    return Standard::Allocate(size); 
-  }
-  void  operator delete(void *anAddress) 
-  {
-    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
-  }
+  DEFINE_STANDARD_ALLOC
 
   Standard_EXPORT BRepExtrema_ExtCF()
   {
index 9e2035e7d76f8f47e421d3f0f1128e5013ec5dc6..f754721bbedd8bdb51caa4eee6f9c090464b8a2e 100644 (file)
@@ -9,6 +9,9 @@
 #ifndef _Standard_HeaderFile
 #include <Standard.hxx>
 #endif
+#ifndef _Standard_DefineAlloc_HeaderFile
+#include <Standard_DefineAlloc.hxx>
+#endif
 #ifndef _Standard_Macro_HeaderFile
 #include <Standard_Macro.hxx>
 #endif
@@ -47,19 +50,7 @@ class BRepExtrema_ExtFF
 {
  public:
 
-  void* operator new(size_t,void* anAddress) 
-  {
-    return anAddress;
-  }
-  void* operator new(size_t size) 
-  {
-    return Standard::Allocate(size); 
-  }
-  void  operator delete(void *anAddress) 
-  {
-    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
-  }
-
+  DEFINE_STANDARD_ALLOC
   
   Standard_EXPORT BRepExtrema_ExtFF()
   {
index 631d1ac39ec4ea7cd8793b13ff32023789bd4a91..0d1608bb3b8449628350a489c0b0ebce6fdfadfc 100644 (file)
@@ -9,6 +9,9 @@
 #ifndef _Standard_HeaderFile
 #include <Standard.hxx>
 #endif
+#ifndef _Standard_DefineAlloc_HeaderFile
+#include <Standard_DefineAlloc.hxx>
+#endif
 #ifndef _Standard_Macro_HeaderFile
 #include <Standard_Macro.hxx>
 #endif
@@ -38,19 +41,7 @@ class BRepExtrema_ExtPC
 {
  public:
 
-  void* operator new(size_t,void* anAddress) 
-  {
-    return anAddress;
-  }
-  void* operator new(size_t size) 
-  {
-    return Standard::Allocate(size); 
-  }
-  void  operator delete(void *anAddress) 
-  {
-    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
-  }
-
+  DEFINE_STANDARD_ALLOC
   
   Standard_EXPORT BRepExtrema_ExtPC()
   {
index 6e8ac30ccf1da5dabda708e0a4fd337c5ce8ae6d..944b4be18f5303bf761e591c900b612223d630ae 100644 (file)
@@ -25,6 +25,9 @@
 #ifndef _Standard_HeaderFile
 #include <Standard.hxx>
 #endif
+#ifndef _Standard_DefineAlloc_HeaderFile
+#include <Standard_DefineAlloc.hxx>
+#endif
 #ifndef _Standard_Macro_HeaderFile
 #include <Standard_Macro.hxx>
 #endif
@@ -65,18 +68,7 @@ class BRepExtrema_ExtPF
 {
  public:
 
-  void* operator new(size_t,void* anAddress) 
-  {
-    return anAddress;
-  }
-  void* operator new(size_t size) 
-  {
-    return Standard::Allocate(size); 
-  }
-  void  operator delete(void *anAddress) 
-  {
-    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
-  }
+  DEFINE_STANDARD_ALLOC
 
   Standard_EXPORT BRepExtrema_ExtPF()
   {}
index 1bf1a1973819e04ab922d74e1331e826f5df2212..8c8f0355794ed1742ba5902af16ce32953f08fa2 100644 (file)
@@ -9,6 +9,9 @@
 #ifndef _Standard_HeaderFile
 #include <Standard.hxx>
 #endif
+#ifndef _Standard_DefineAlloc_HeaderFile
+#include <Standard_DefineAlloc.hxx>
+#endif
 #ifndef _Standard_Macro_HeaderFile
 #include <Standard_Macro.hxx>
 #endif
@@ -43,20 +46,8 @@ class BRepExtrema_SolutionElem
 {
  public:
 
-  void* operator new(size_t,void* anAddress) 
-  {
-    return anAddress;
-  }
-  void* operator new(size_t size) 
-  {
-    return Standard::Allocate(size); 
-  }
-  void  operator delete(void *anAddress) 
-  {
-    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
-  }
+  DEFINE_STANDARD_ALLOC
 
-  
   Standard_EXPORT BRepExtrema_SolutionElem()
   : myDist(0.), myPoint(0.,0.,0.), mySupType(BRepExtrema_IsVertex), myPar1(0.), myPar2(0.)
   {
index 7fce27903e2476e0f3d0d55b921cb1aaf7b545d5..2f4d6c0ef849dcd20424759ffeec9e27277b656d 100755 (executable)
@@ -57,6 +57,9 @@ class gp_Pnt2d;
 #ifndef _Standard_HeaderFile
 #include <Standard.hxx>
 #endif
+#ifndef _Standard_DefineAlloc_HeaderFile
+#include <Standard_DefineAlloc.hxx>
+#endif
 #ifndef _Standard_Macro_HeaderFile
 #include <Standard_Macro.hxx>
 #endif
@@ -65,18 +68,8 @@ class BRepPrim_OneAxis  {
 
 public:
 
-    void* operator new(size_t,void* anAddress) 
-      {
-        return anAddress;
-      }
-    void* operator new(size_t size) 
-      { 
-        return Standard::Allocate(size); 
-      }
-    void  operator delete(void *anAddress) 
-      { 
-        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
-      }
+  DEFINE_STANDARD_ALLOC
+
  // Methods PUBLIC
  // 
 Standard_EXPORT virtual  void Delete() ;
index ca70cd197a7c70d659bb868dbcdd3982b6c4eab7..90d012e458cd509e68644f9a1e34d77a14fbc1a3 100755 (executable)
@@ -64,6 +64,9 @@ class BRepSweep_SequenceNodeOfSequenceOfShapesOfNumLinearRegularSweep;
 #ifndef _Standard_HeaderFile
 #include <Standard.hxx>
 #endif
+#ifndef _Standard_DefineAlloc_HeaderFile
+#include <Standard_DefineAlloc.hxx>
+#endif
 #ifndef _Standard_Macro_HeaderFile
 #include <Standard_Macro.hxx>
 #endif
@@ -72,18 +75,8 @@ class BRepSweep_NumLinearRegularSweep  {
 
 public:
 
-    void* operator new(size_t,void* anAddress) 
-      {
-        return anAddress;
-      }
-    void* operator new(size_t size) 
-      { 
-        return Standard::Allocate(size); 
-      }
-    void  operator delete(void *anAddress) 
-      { 
-        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
-      }
+  DEFINE_STANDARD_ALLOC
+
  // Methods PUBLIC
  // 
 Standard_EXPORT virtual  void Delete() ;
index 23958514ea7abb32a2ca83139acb1f8bae02e5aa..ce7e0348dff472a0947380ee88320acbc9973e64 100755 (executable)
@@ -38,7 +38,7 @@ DBC_VArray::DBC_VArray(const Standard_Integer Size) : DBC_BaseArray(Size)
   if(Size > 0) {
 #endif  
 #ifdef CSFDB
-    myData = (DBC_VArrayTNode*)StandardCSFDB_Allocate(Size * sizeof(DBC_VArrayTNode));
+    myData = (DBC_VArrayTNode*)Standard::Allocate(Size * sizeof(DBC_VArrayTNode));
     DBC_VArrayTNode* ptrtmp = (DBC_VArrayTNode*)myData;
     for (int i = 0; i < Size; i++) {
       ptrtmp = new((Standard_Address)ptrtmp) DBC_VArrayTNode();
@@ -69,7 +69,7 @@ DBC_VArray::DBC_VArray(const DBC_VArray& Varray) : DBC_BaseArray(Varray)
 #ifdef CSFDB
   //myData = new DBC_VArrayTNode[mySize];
 
-  myData = (DBC_VArrayTNode*)StandardCSFDB_Allocate(mySize * sizeof(DBC_VArrayTNode));
+  myData = (DBC_VArrayTNode*)Standard::Allocate(mySize * sizeof(DBC_VArrayTNode));
   DBC_VArrayTNode* ptrtmp = (DBC_VArrayTNode*)myData;
 
   for(Standard_Integer i=0; i<mySize; i++) {
@@ -143,7 +143,7 @@ void DBC_VArray::Resize (const Standard_Integer NewSize)
 
     DBC_VArrayTNode* ptr = 0L;
     if(NewSize) {
-      ptr = (DBC_VArrayTNode*)StandardCSFDB_Allocate(NewSize * sizeof(DBC_VArrayTNode));
+      ptr = (DBC_VArrayTNode*)Standard::Allocate(NewSize * sizeof(DBC_VArrayTNode));
     }
 
     DBC_VArrayTNode* ptrtmp = ptr;
@@ -162,8 +162,7 @@ void DBC_VArray::Resize (const Standard_Integer NewSize)
        ptrtmp->DBC_VArrayTNode::~DBC_VArrayTNode();
        ptrtmp++;
       }
-//      StandardCSFDB_Free((Standard_Address&)myData,mySize * sizeof(DBC_VArrayTNode));
-      StandardCSFDB_Free((Standard_Address&)myData);
+      Standard::Free((Standard_Address&)myData);
     } else {
       for(i = 0; i < NewSize; i++) {
        ptrtmp = new((Standard_Address)ptrtmp) DBC_VArrayTNode();
@@ -278,8 +277,7 @@ void DBC_VArray::Destroy()
       ptrtmp->DBC_VArrayTNode::~DBC_VArrayTNode();
       ptrtmp++;
     }
-//    StandardCSFDB_Free((Standard_Address&)myData,mySize * sizeof(DBC_VArrayTNode));
-    StandardCSFDB_Free((Standard_Address&)myData);
+    Standard::Free((Standard_Address&)myData);
     myData = 0L;
   }
 #endif 
index 7c9146088d3968313e49608d4e64acd133ab491d..90457c047b81d00c65317b1fdf43402398b9ef6c 100755 (executable)
@@ -14,7 +14,7 @@ struct _degeneration
 {
   int   mode;
   float skipRatio;
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 typedef _degeneration  DEGENERATION;
 typedef _degeneration* PDEGENERATION;
@@ -28,7 +28,7 @@ struct _ds_internal
   int                 model;
   float               skipRatio;
   unsigned char*      bDraw;
-  IMPLEMENT_MEMORY_OPERATORS  
+  DEFINE_STANDARD_ALLOC
 };
 typedef _ds_internal  DS_INTERNAL;
 typedef _ds_internal* PDS_INTERNAL;
index b61c09f76082b03c4422d1bbce203e5fec4e5b36..ba17f9e2da2bd60506100ae1c236426790224124 100755 (executable)
@@ -14,45 +14,14 @@ for InterfaceGraphic_Parray.hxx definitions
 #define  INTERFACEGRAPHIC_TELEM_H
 
 #include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
 #include <InterfaceGraphic_tgl_all.hxx>
 #include <stdlib.h>
 
-//if SUN compiler
-#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) && ! defined(typename)
-#define IMPLEMENT_MEMORY_OPERATORS \
-  void* operator new (size_t size) {\
-  void* p = malloc( size );\
-  memset(p, 0, size);\
-  return p;\
-  }\
-  void operator delete(void* p) {\
-  free( p );\
-  }
-#else
-//if other
-#define IMPLEMENT_MEMORY_OPERATORS \
-  void* operator new (size_t size) {\
-  void* p = malloc( size );\
-  memset(p, 0, size);\
-  return p;\
-  }\
-  void* operator new[] (size_t size) {\
-  void* p = malloc( size );\
-  memset(p, 0, size);\
-  return p;\
-  }\
-  void operator delete(void* p) { \
-  free( p );\
-  }\
-  void operator delete[](void* p) {\
-  free( p );\
-  }
-#endif
-
 struct TEL_TEXTURE_COORD
 {
   float xy[2];
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 typedef TEL_TEXTURE_COORD* tel_texture_coord;
@@ -60,23 +29,7 @@ typedef TEL_TEXTURE_COORD* tel_texture_coord;
 struct TEL_POINT
 {
   float  xyz[3];
-  IMPLEMENT_MEMORY_OPERATORS
-    /*void* operator new (size_t size) {
-    void* p = malloc( size );
-    memset(p, 0, size);
-    return p;
-    }
-    void* operator new[] (size_t size) {
-    void* p = malloc( size );
-    memset(p, 0, size);
-    return p;
-    }
-    void operator delete(void* p) {
-    free( p );
-    }
-    void operator delete[](void* p) {
-    free( p );
-    }*/
+  DEFINE_STANDARD_ALLOC
 };
 typedef TEL_POINT* tel_point;
 
@@ -84,7 +37,7 @@ struct TEL_COLOUR
 {
   /* OCC8854: san -- number of color components increased to include alpha value */
   float    rgb[4];
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 typedef TEL_COLOUR* tel_colour;
 
@@ -92,7 +45,7 @@ struct TEL_POINT_DATA
 {
   int      num;
   TEL_POINT* data;
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 typedef TEL_POINT_DATA* tel_point_data;
 
@@ -100,7 +53,7 @@ struct TEL_TINT_DATA
 {
   int   num;
   int*  data;
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 typedef TEL_TINT_DATA* tel_tint_data;
 
@@ -108,7 +61,7 @@ struct TEL_MATRIX3_DATA
 {
   TComposeType  mode;
   Tmatrix3      mat;
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 typedef TEL_MATRIX3_DATA* tel_matrix3_data;
 
@@ -116,7 +69,7 @@ struct TEL_ALIGN_DATA
 {
   Tint Hmode;
   Tint Vmode;
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 typedef TEL_ALIGN_DATA* tel_align_data;
 
@@ -149,7 +102,7 @@ struct  TEL_SURF_PROP
   int       isamb, isdiff, isspec, isemsv;
   int       isphysic; 
   TEL_COLOUR speccol, difcol, ambcol, emscol, matcol;
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 typedef TEL_SURF_PROP* tel_surf_prop;
 
@@ -304,7 +257,7 @@ struct  TEL_POFFSET_PARAM
   int   mode;
   float factor;
   float units;
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 typedef TEL_POFFSET_PARAM* tel_poffset_param;
 /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */
@@ -316,7 +269,7 @@ struct TEL_TRANSFORM_PERSISTENCE
   float     pointX;
   float     pointY;
   float     pointZ;
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 typedef TEL_TRANSFORM_PERSISTENCE* tel_transform_persistence;
 /* ABD 29/10/04  Transform Persistence of Presentation( pan, zoom, rotate ) */
index 8e8bc013498a3c489dd9d4fe148fbc8afb264673..2f76893f76a699a7a677f6c85edeca14ca7ea72d 100755 (executable)
@@ -7,11 +7,6 @@
 #include <LDOM_BasicAttribute.hxx>
 #include <LDOM_MemManager.hxx>
 
-#ifdef WNT
-// Disable the warning: "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 //=======================================================================
 //function : LDOM_BasicAttribute
 //purpose  : 
index f73efcb55ace237bf91e919a0e5abcb9320ba035..49661cd4919173728f813c9b17e5958219e75531 100755 (executable)
@@ -15,20 +15,12 @@ class LDOM_Element;
 class LDOM_Attr;
 class LDOM_Node;
 
-#ifdef WNT
-// Disable the warning: "operator new unmatched by delete"
-#pragma warning (push)
-#pragma warning (disable:4291)
-#endif
-
 //  Class LDOM_BasicAttribute
 //
 
 class LDOM_BasicAttribute : public LDOM_BasicNode
 {
  public:
-  void * operator new (size_t, void * anAddress) { return anAddress; }
   // ---------- PUBLIC METHODS ----------
 
   LDOM_BasicAttribute () : LDOM_BasicNode (LDOM_Node::UNKNOWN) {}
@@ -72,8 +64,4 @@ class LDOM_BasicAttribute : public LDOM_BasicNode
   LDOMBasicString       myValue;
 };
 
-#ifdef WNT
-#pragma warning (pop)
-#endif
-
 #endif
index 8bc28f3aa757fdf9b13ae4544f252d85e1be74c4..dd943bd871f4c95c76b280399a512315ff07e734 100755 (executable)
@@ -9,11 +9,6 @@
 #include <LDOM_BasicText.hxx>
 #include <LDOM_MemManager.hxx>
 
-#ifdef WNT
-// Disable the warning: "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 //=======================================================================
 //function : Create
 //purpose  : construction in the Document's data pool
index 2032ce917a1abdc0cbf7ba3e9fe2105d219b525d..f4d9d3360eafae625ec145d9b422b97d1cc69a0e 100755 (executable)
@@ -17,19 +17,12 @@ class LDOM_NodeList;
 class LDOM_Element;
 class LDOM_BasicAttribute;
 
-#ifdef WNT
-// Disable the warning: "operator new unmatched by delete"
-#pragma warning (push)
-#pragma warning (disable:4291)
-#endif
-
 //  Class LDOM_BasicElement
 //
 
 class LDOM_BasicElement : public LDOM_BasicNode
 {
  public:
-  void * operator new (size_t, void * anAddress) { return anAddress; }
  
   // ---------- PUBLIC METHODS ----------
 
@@ -128,8 +121,4 @@ class LDOM_BasicElement : public LDOM_BasicNode
   LDOM_BasicNode        * myFirstChild;
 };
 
-#ifdef WNT
-#pragma warning (pop)
-#endif
-
 #endif
index f5ef3df7d6cc313ebbfddee28325a73e7f2a31ef..a2552448659283e222d1d626a9ff486e4c667791 100755 (executable)
@@ -18,6 +18,9 @@ class LDOMParser;
 
 class LDOM_BasicNode 
 {
+ public:
+  DEFINE_STANDARD_ALLOC
+
  public:
 
   Standard_Boolean  isNull    () const {return myNodeType ==LDOM_Node::UNKNOWN;}
index e045a0d11719f84f824adc5c6fc2eae712ae4773..c92f5278e05ce3ec7918b457fe15e4ae1b8832cc 100755 (executable)
@@ -8,11 +8,6 @@
 #include <LDOM_BasicText.hxx>
 #include <LDOM_MemManager.hxx>
 
-#ifdef WNT
-// Disable the warning: "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 //=======================================================================
 //function : LDOM_BasicText()
 //purpose  : Constructor
index 841531059f7cc3c92f554aa09a2621b1060843bd..6c4cce024825f9bc0ec1e299435303d63d9c6192 100755 (executable)
@@ -15,19 +15,12 @@ class LDOM_CharacterData;
 class LDOMParser;
 class LDOM_BasicElement;
 
-#ifdef WNT
-// Disable the warning: "operator new unmatched by delete"
-#pragma warning (push)
-#pragma warning (disable:4291)
-#endif
-
 //  Class LDOM_BasicText
 //
 
 class LDOM_BasicText : public LDOM_BasicNode
 {
  public:
-  void * operator new (size_t, void * anAddress) { return anAddress; }
 
   // ---------- PUBLIC METHODS ----------
 
@@ -69,8 +62,4 @@ class LDOM_BasicText : public LDOM_BasicNode
   LDOMBasicString       myValue;
 };
 
-#ifdef WNT
-#pragma warning (pop)
-#endif
-
 #endif
index 0fb54fe7f3c01db08d2a2d00f1b83e80721ae4b2..ab4bc9b45441853577f8095d33f82b544468e776 100755 (executable)
@@ -79,6 +79,6 @@ NCollection_Comparator.hxx
 NCollection_QuickSort.hxx
 
 NCollection_Haft.h
+NCollection_DefaultHasher.hxx
+NCollection_DefineAlloc.hxx
 
-
-NCollection_DefaultHasher.hxx
\ No newline at end of file
index 6e3d1dbde806dd6ad155294ef88223f1ea48cc64..98cf5e3457cf7515a7b945ead35c937148b32912 100755 (executable)
 
 #include <NCollection_BaseCollection.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (push)
-#pragma warning (disable:4291)
-#endif
-
 // *********************************************** Template for Array1 class
 
 /**
@@ -86,10 +80,6 @@ template <class TheItemType> class NCollection_Array1
     //! Variable value access
     virtual TheItemType& ChangeValue (void) const 
     { return myArray->ChangeValue(myCurrent); }
-    //! Operator new for allocating iterators
-    void* operator new(size_t theSize,
-                       const Handle(NCollection_BaseAllocator)& theAllocator) 
-    { return theAllocator->Allocate(theSize); }
   private:
     Standard_Integer    myCurrent; //!< Index of the current item
     NCollection_Array1* myArray;   //!< Pointer to the array being iterated
@@ -277,8 +267,4 @@ template <class TheItemType> class NCollection_Array1
   TheItemType*         myData;      //!< Pointer to '0'th array item
 };
 
-#ifdef WNT
-#pragma warning (pop)
-#endif
-
 #endif
index 0540209d6689728780193f6c71f1635b36d0e877..bd7cbd63ffb71c46ec210f9d2499d47eaec7dbc0 100755 (executable)
 
 #include <NCollection_BaseCollection.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 // *********************************************** Template for Array2 class
 /**
 * Purpose:   The class Array2 represents bi-dimensional arrays 
@@ -70,10 +65,6 @@ template <class TheItemType> class NCollection_Array2
     //! Variable value access
     virtual TheItemType& ChangeValue (void) const
     { return myArray->myStart[myCurrent]; }
-    //! Operator new for allocating iterators
-    void* operator new(size_t theSize,
-                       const Handle(NCollection_BaseAllocator)& theAllocator) 
-    { return theAllocator->Allocate(theSize); }
   private:
     Standard_Integer    myCurrent;  //!< Index of the current item
     Standard_Integer    mySize;     //!< Total amount of items
@@ -316,8 +307,4 @@ template <class TheItemType> class NCollection_Array2
 
 };
 
-#ifdef WNT
-#pragma warning (default:4291)
-#endif
-
 #endif
index 70a16c05de690f36278ecfb67bface6ddf0ee222..504a26773dae5f2ba967c7fab3d27da2d32d7d41 100755 (executable)
@@ -7,6 +7,7 @@
 #define NCollection_BaseCollection_HeaderFile
 
 #include <NCollection_IncAllocator.hxx>
+#include <NCollection_DefineAlloc.hxx>
 
 /**
 * Purpose:     NCollection_BaseCollection  is the base  abstract  class for 
@@ -45,6 +46,9 @@ template<class TheItemType> class NCollection_BaseCollection
     virtual const TheItemType& Value(void) const=0;
     //! Value change access
     virtual TheItemType& ChangeValue(void) const=0;
+  public:
+    DEFINE_STANDARD_ALLOC
+    DEFINE_NCOLLECTION_ALLOC
   protected:
     //! Empty constructor
     Iterator (void) {}
index 0349cf1ddf99b5b063c9731bdf394cc4a00abaa4..3bd0a442bc662b51093027f58ac173d1af7ec522 100755 (executable)
 #include <Standard_NoSuchObject.hxx>
 #include <NCollection_ListNode.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 typedef void (* NCollection_DelListNode) 
      (NCollection_ListNode*, Handle(NCollection_BaseAllocator)& theAl);
 
index 6e5c423568280c0526f356e9df5b2f6bf02274ee..42d9acadc777bb9b3a2f6338ecc82d56618b4802 100755 (executable)
 #include <NCollection_BaseAllocator.hxx>
 #include <NCollection_ListNode.hxx>
 
-//#ifdef WNT
-//// Disable the warning "operator new unmatched by delete"
-//#pragma warning (disable:4291)
-//#endif
-
 typedef void (* NCollection_DelMapNode) 
      (NCollection_ListNode*, Handle(NCollection_BaseAllocator)& theAl);
 
index 8dee445f7b458bde06c2c692a061d96c735f012b..c5273f82f2b8ac5d6ced8875b7c9e6c77572e325 100755 (executable)
 #include <NCollection_Map.hxx>
 #include <NCollection_DataMap.hxx>
 #include <NCollection_BaseAllocator.hxx>
-
-// work-around for obsolete SUN WorkShop 5.3 compiler 
-// which does not recognize typename keyword
-#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) && ! defined(typename)
-#define typename
-#endif
+#include <NCollection_TypeDef.hxx>
 
 //! Auxiliary enumeration serving as responce from method Inspect
 enum NCollection_CellFilter_Action 
@@ -109,8 +104,8 @@ template <class Inspector>
 class NCollection_CellFilter
 {  
 public:
-  typedef typename Inspector::Target Target;
-  typedef typename Inspector::Point  Point;
+  typedef TYPENAME Inspector::Target Target;
+  typedef TYPENAME Inspector::Point  Point;
 
 public:
 
index 97a051b38764250ae6917ef8afe0c8c32eb5cc2f..2163c6c861ee8918611a143d74c2a0ec91b409ed 100755 (executable)
 #include <Standard_TypeMismatch.hxx>
 #include <Standard_NoSuchObject.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (push)
-#pragma warning (disable:4291)
-#endif
-
 /**
 * Purpose:     The DataMap is a Map to store keys with associated
 *              Items. See Map  from NCollection for  a discussion
@@ -119,10 +113,6 @@ template < class TheKeyType,
 #endif
       return ((DataMapNode *) myNode)->Key();
     }
-    //! Operator new for allocating iterators
-    void* operator new(size_t theSize,
-                       const Handle(NCollection_BaseAllocator)& theAllocator) 
-    { return theAllocator->Allocate(theSize); }
   };
 
  public:
@@ -342,9 +332,5 @@ template < class TheKeyType,
 
 };
 
-#ifdef WNT
-#pragma warning (pop)
-#endif
-
 #endif
 
diff --git a/src/NCollection/NCollection_DefineAlloc.hxx b/src/NCollection/NCollection_DefineAlloc.hxx
new file mode 100644 (file)
index 0000000..22488c8
--- /dev/null
@@ -0,0 +1,33 @@
+// File:        Standard_DefineAlloc.hxx
+// Created:     Jan 19 14:15:16 2012
+// Author:      Dmitry BOBYLEV 
+// Copyright:   Open CASCADE SAS 2012
+
+#ifndef _NCollection_DefineAlloc_HeaderFile
+# define _NCollection_DefineAlloc_HeaderFile
+
+// Macro to overload placement new and delete operators for NCollection allocators.
+// For Borland C and old SUN compilers do not define placement delete
+// as it is not supported.
+# if defined(__BORLANDC__) || (defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530))
+#  define DEFINE_NCOLLECTION_ALLOC                                               \
+   void* operator new (size_t theSize,                                           \
+                       const Handle(NCollection_BaseAllocator)& theAllocator)    \
+   {                                                                             \
+     return theAllocator->Allocate(theSize);                                     \
+   }
+# else
+#  define DEFINE_NCOLLECTION_ALLOC                                               \
+   void* operator new (size_t theSize,                                           \
+                       const Handle(NCollection_BaseAllocator)& theAllocator)    \
+   {                                                                             \
+     return theAllocator->Allocate(theSize);                                     \
+   }                                                                             \
+   void  operator delete (void* theAddress,                                      \
+                          const Handle(NCollection_BaseAllocator)& theAllocator) \
+   {                                                                             \
+     theAllocator->Free(theAddress);                                             \
+   }
+# endif
+
+#endif
\ No newline at end of file
index e05110e2e13fb97cb20d0228d719e3c3130ebbbf..29136a10b4874965be5d4555f8c58eb63fbc4f3c 100755 (executable)
 #include <NCollection_DefineBaseCollection.hxx>
 #include <NCollection_Array1.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 // *********************************************** Template for Array1 class
 
 #define DEFINE_ARRAY1(_ClassName_, _BaseCollection_, TheItemType)              \
index 34a3f68f7b17e1dce63828c7dea53366763bcfa8..2d311690cc8c290bdb3396503d2d102c1f2c4356 100755 (executable)
 #include <NCollection_DefineBaseCollection.hxx>
 #include <NCollection_Array2.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 // *********************************************** Template for Array2 class
 
 #define DEFINE_ARRAY2(_ClassName_, _BaseCollection_, TheItemType)              \
index 09a9ff26c78afa83ed537d4c4efeed7509d0c4ee..9882cf4b3f7eb1dcd7e304962270d8b1bd623c26 100755 (executable)
 #include <NCollection_DefineBaseCollection.hxx>
 #include <NCollection_DataMap.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 // *********************************************** Class DataMap *************
 
 #define DEFINE_DATAMAP(_ClassName_, _BaseCollection_, TheKeyType, TheItemType) \
index a6949395428cd823775967f88e6a687b78dc4d94..8ae067bccd1ff650e0b0d038762dcafc2d52e9b4 100755 (executable)
 #include <NCollection_DefineBaseCollection.hxx>
 #include <NCollection_DoubleMap.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 // *********************************************** Class DoubleMap ************
 
 #define DEFINE_DOUBLEMAP(_ClassName_, _BaseCollection_, TheKey1Type, TheKey2Type) \
index aa8a6048211a409fc728bc6ba625b404dededa88..ae3a8b0a04380b65b45513a055b7c9ff155c2216 100755 (executable)
 #include <NCollection_DefineBaseCollection.hxx>
 #include <NCollection_IndexedDataMap.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 // *********************************************** Class IndexedDataMap ******
 
 #define DEFINE_INDEXEDDATAMAP(_ClassName_, _BaseCollection_, TheKeyType, TheItemType) \
index bfeb3b05f1585801310b5d0e1be27591af8d0cad..e13a77d8d29bf3e8746d62151c657620c2ffa94a 100755 (executable)
 #include <NCollection_DefineBaseCollection.hxx>
 #include <NCollection_IndexedMap.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 // *********************************************** Class IndexedMap ***********
 
 #define DEFINE_INDEXEDMAP(_ClassName_, _BaseCollection_, TheKeyType)           \
index e01254c5076b45b8047054db9a61acaa692446ef..c2017c6bb64db54929e5f9086aeabb4bca3a4c63 100755 (executable)
 
 #include <NCollection_List.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 // **************************************** Template for  List   class ********
 
 #define DEFINE_LIST(_ClassName_, _BaseCollection_, TheItemType)                \
index e229243798384e8bdbe770f259cab0a7f1a23ee0..98fceb9b60cbe49481342aaa1b766caf91ee82e5 100755 (executable)
 #include <NCollection_DefineBaseCollection.hxx>
 #include <NCollection_Map.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 // *********************************************** Class Map *****************
 
 #define DEFINE_MAP(_ClassName_, _BaseCollection_, TheKeyType)                  \
index 5ddd0a0416ba083b7cba4a78c09b3ed23b8ea002..c04adf5c8ce0bbd1af4f1d5147b8fab51604dad8 100755 (executable)
 
 #include <NCollection_Queue.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 // **************************************** Template for  Queue  class ********
 
 #define DEFINE_QUEUE(_ClassName_, _BaseCollection_, TheItemType)               \
index 7686a7213c727f8fd3aebd441dbc65f6938e9725..1e4ecbd72147f53acc98d284f04abd60486ea54f 100755 (executable)
 #include <NCollection_DefineBaseCollection.hxx>
 #include <NCollection_SList.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 // **************************************** Template for  SList  class ********
 
 #define DEFINE_SLIST(_ClassName_, _BaseCollection_, TheItemType)               \
index d83c391e6f30f6b905ebd62c9eb060ca5fefbb72..ca44be1c70b495cd9c0fb8ec9ed89cb370d32afe 100755 (executable)
 #include <NCollection_DefineBaseCollection.hxx>
 #include <NCollection_Sequence.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 // **************************************** Template for Sequence class ********
 
 #define DEFINE_SEQUENCE(_ClassName_, _BaseCollection_, TheItemType)            \
index def74434305e20527cf28ba38b3aab367ba84e0b..9bac2ac00b9111052f8edff6cc93fc461b9eaee1 100755 (executable)
 #include <NCollection_DefineBaseCollection.hxx>
 #include <NCollection_Set.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 // **************************************** Template for   Set   class ********
 
 #define DEFINE_SET(_ClassName_, _BaseCollection_, TheItemType)                 \
index 8c5c6775edf1b2d20190cbdaff8a02ccc0420ad1..d7cef0baaed6d6d2cea28afa7023ad026cf49066 100755 (executable)
 #include <NCollection_DefineBaseCollection.hxx>
 #include <NCollection_Stack.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 // **************************************** Template for  Stack  class ********
 
 #define DEFINE_STACK(_ClassName_, _BaseCollection_, TheItemType)               \
index 92b24414d4ec3f9615e7b3f087f7558485ebfb53..147ff58e6a7fa51547101796cc4c7dec5336be66 100755 (executable)
 #include <NCollection_DefineBaseCollection.hxx>
 #include <NCollection_TListIterator.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 // ********************************** Implementation of the Iterator interface
 #define DEFINE_TLISTITERATOR(_ClassName_, _BaseCollection_, TheItemType)       \
         typedef NCollection_TListIterator<TheItemType > _ClassName_;
index 0ee8721396e10f0d406a726a5a895b15c7b5197a..73a2b518919df6db86f5b68f59c52eb2941d9bc4 100755 (executable)
 
 #include <NCollection_TListNode.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 // ******************************* Class defining list node - for internal use
 #define DEFINE_TLISTNODE(_ClassName_, _BaseCollection_, TheItemType)           \
         typedef NCollection_TListNode<TheItemType > _ClassName_;
index 4a653635b99bb7ff1e74eef0d5e303f9892bf5bd..829190e48b22b36c464b411eeede757f16f38d7c 100755 (executable)
 #include <NCollection_DefineBaseCollection.hxx>
 #include <NCollection_Vector.hxx>
 
-#ifdef WNT
-// Disable the warning: "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 //  Class NCollection_Vector (dynamic array of objects)
 //
 // This class is similar to NCollection_Array1  though the indices always start
index 4b85c6f45ac2a20488fceebf35cec3e00d925cf7..4266e78379492e497a7e48452a4e1fd747c51198 100755 (executable)
 
 #include <NCollection_DefaultHasher.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (push)
-#pragma warning (disable:4291)
-#endif
-
 /**
 * Purpose:     The DoubleMap  is used to  bind  pairs (Key1,Key2)
 *              and retrieve them in linear time.
@@ -128,10 +122,6 @@ template < class TheKey1Type,
       Standard_ImmutableObject::Raise("NCollection_DoubleMap::Iterator::ChangeValue");
       return * (TheKey2Type *) NULL; // For compiler
     }
-    //! Operator new for allocating iterators
-    void* operator new(size_t theSize,
-                       const Handle(NCollection_BaseAllocator)& theAllocator) 
-    { return theAllocator->Allocate(theSize); }
   };
 
  public:
@@ -476,8 +466,4 @@ template < class TheKey1Type,
 
 };
 
-#ifdef WNT
-#pragma warning (pop)
-#endif
-
 #endif
index 0eb09ed7696d3e299c4623262417bbe2fae3e16f..8068fb7d0c74584e4753998818f290bd064ee41b 100755 (executable)
 #include <Standard_OutOfRange.hxx>
 #endif
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (push)
-#pragma warning (disable:4291)
-#endif
-
 /**
  * Purpose:     An indexed map is used  to store keys and to  bind
  *              an index to them.  Each  new key stored in the map
@@ -127,10 +121,6 @@ template < class TheKeyType,
 #endif
       return myMap->ChangeFromIndex(myIndex);
     }
-    //! Operator new for allocating iterators
-    void* operator new(size_t theSize,
-                       const Handle(NCollection_BaseAllocator)& theAllocator) 
-    { return theAllocator->Allocate(theSize); }
     
   private:
     NCollection_IndexedDataMap * myMap;   //!< Pointer to the map being iterated
@@ -505,8 +495,4 @@ template < class TheKeyType,
 
 };
 
-#ifdef WNT
-#pragma warning (pop)
-#endif
-
 #endif
index 1a53813b6ac8c86786d79d9dcb4f17d6562a0bc3..79fd5c9716e23c30fb208116b64e71c01722aff7 100755 (executable)
 #include <Standard_OutOfRange.hxx>
 #endif
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (push)
-#pragma warning (disable:4291)
-#endif
-
 /**
  * Purpose:     An indexed map is used to  store  keys and to bind
  *              an index to them.  Each new key stored in  the map
@@ -115,11 +109,6 @@ template < class TheKeyType,
       return * (TheKeyType *) NULL; // This for compiler
     }
     
-    //! Operator new for allocating iterators
-    void* operator new(size_t theSize,
-                       const Handle(NCollection_BaseAllocator)& theAllocator) 
-    { return theAllocator->Allocate(theSize); }
-    
   private:
     NCollection_IndexedMap * myMap;   // Pointer to the map being iterated
     Standard_Integer         myIndex; // Current index
@@ -417,8 +406,4 @@ template < class TheKeyType,
 
 };
 
-#ifdef WNT
-#pragma warning (pop)
-#endif
-
 #endif
index 1a02ed648f31f8f972e40a7cbf7e273b78ff0fae..c6b38d85e0905b840201bd5a7322251964ffb752 100755 (executable)
 #include <Standard_NoSuchObject.hxx>
 #endif
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (push)
-#pragma warning (disable:4291)
-#endif
-
 /**
  * Purpose:      Simple list to link  items together keeping the first 
  *               and the last one.
@@ -291,8 +285,4 @@ template <class TheItemType> class NCollection_List
   }
 };
 
-#ifdef WNT
-#pragma warning (pop)
-#endif
-
 #endif
index fd57bec06bf20f4faaaa2e1968b159eda86e6aca..d27d93a6177b361fd14b790f3875d0f45b0d7ef6 100755 (executable)
@@ -8,11 +8,6 @@
 
 #include <NCollection_BaseAllocator.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 /**
  * Purpose:     This class is used to  represent a node  in the BaseList and
  *              BaseMap. 
index a7a3a076a7eb5b99c272122024a1cdf7b77f938e..91388e711e1942d5f16dbfb3a42e8d2f6acccfc5 100755 (executable)
 #include <Standard_NoSuchObject.hxx>
 #endif
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (push)
-#pragma warning (disable:4291)
-#endif
-
 /**
  * Purpose:     Single hashed Map. This  Map is used  to store and
  *              retrieve keys in linear time.
@@ -116,10 +110,6 @@ template < class TheKeyType,
 #endif
       return ((MapNode *) myNode)->Value();
     }
-    //! Operator new for allocating iterators
-    void* operator new(size_t theSize,
-                       const Handle(NCollection_BaseAllocator)& theAllocator)
-    { return theAllocator->Allocate(theSize); }
   };
 
  public:
@@ -318,8 +308,4 @@ template < class TheKeyType,
 
 };
 
-#ifdef WNT
-#pragma warning (pop)
-#endif
-
 #endif
index 2e009c6a64bdf23841727a49be3e2df17d6017ff..c50ae78a8e7eae69ca06718e643dba15ce478582 100755 (executable)
 #include <Standard_NoSuchObject.hxx>
 #endif
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 /**
  * Purpose:      A queue is  a structure where Items are  added  at
  *               the end  and removed from   the  front. The  first
@@ -135,8 +130,4 @@ template <class TheItemType> class NCollection_Queue
 
 };
 
-#ifdef WNT
-#pragma warning (default:4291)
-#endif
-
 #endif
index 1954c0ed3365b1993d5e276793725c7b4992e1f3..25b11948ace128e53bc58181d985a84cf5902b56 100755 (executable)
 #include <Standard_NoSuchObject.hxx>
 #endif
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 /**
  * Purpose:     An SList is a LISP like list of Items.
  *              An SList is :
@@ -76,15 +71,10 @@ template <class TheItemType> class NCollection_SList
       myTail->Clear();
       myTail->myAllocator->Free(myTail);
     }
-    //! Operator new for allocating nodes
-    void* operator new(size_t theSize,
-                       const Handle(NCollection_BaseAllocator)& theAllocator) 
-    { return theAllocator->Allocate(theSize); }
-    //! news to avoid warnings on hiding  - not for use
-    void* operator new(size_t theSize) 
-    { return Standard::Allocate(theSize); }
-    void* operator new(size_t /*theSize*/, void* theAddress) 
-    { return theAddress; }
+
+    DEFINE_STANDARD_ALLOC
+    DEFINE_NCOLLECTION_ALLOC
+
   private:
     // ---------- PRIVATE FIELDS ------------
     Standard_Integer    myCount; //!< Reference count
@@ -118,11 +108,6 @@ template <class TheItemType> class NCollection_SList
       myNode->myCount++;
   }
 
-  //! Operator new for creating 'iterator'
-  void* operator new(size_t theSize,
-                     const Handle(NCollection_BaseAllocator)& theAllocator) 
-  { return theAllocator->Allocate(theSize); }
-
   //! Clear the items out
   void Clear (void)
   {
@@ -287,8 +272,4 @@ template <class TheItemType> class NCollection_SList
   friend class SListNode;
 };
 
-#ifdef WNT
-#pragma warning (default:4291)
-#endif
-
 #endif
index a26a58aeb1a4312568993096c19b239330aee0e2..3693ad2f25fece436fdac46af91ed2611ec0e9a8 100755 (executable)
 #include <Standard_NoSuchObject.hxx>
 #endif
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (push)
-#pragma warning (disable:4291)
-#endif
-
 /**
  * Purpose:     Definition of a sequence of elements indexed by
  *              an Integer in range of 1..n
@@ -43,9 +37,8 @@ template <class TheItemType> class NCollection_Sequence
     //! Variable value access
     TheItemType&       ChangeValue () { return myValue; }
     //! Memory allocation
-    void* operator new(size_t theSize,
-                       const Handle(NCollection_BaseAllocator)& theAllocator) 
-    { return theAllocator->Allocate(theSize); }
+    DEFINE_STANDARD_ALLOC
+    DEFINE_NCOLLECTION_ALLOC
 
   private:
     TheItemType    myValue;
@@ -82,10 +75,6 @@ template <class TheItemType> class NCollection_Sequence
     //! Variable value access
     virtual TheItemType& ChangeValue (void) const
     { return ((Node *)myCurrent)->ChangeValue(); }
-    //! Operator new for allocating iterators
-    void* operator new(size_t theSize,
-                       const Handle(NCollection_BaseAllocator)& theAllocator) 
-    { return theAllocator->Allocate(theSize); }
   }; // End of nested class Iterator
 
  public:
@@ -315,8 +304,4 @@ template <class TheItemType> class NCollection_Sequence
 
 };
 
-#ifdef WNT
-#pragma warning (pop)
-#endif
-
 #endif
index 100434f382a5fc9193507325ca7ed69a48c5c9d7..3ff557425dac244fc481d9b297f2e811470e284e 100755 (executable)
 #include <NCollection_TListNode.hxx>
 #include <NCollection_TListIterator.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 /**
  * Purpose:      A set is an  unordered  collection  of items without
  *               duplications. To test for duplications the operators == and !=
@@ -220,8 +215,4 @@ template <class TheItemType> class NCollection_Set
 
 };
 
-#ifdef WNT
-#pragma warning (default:4291)
-#endif
-
 #endif
index 456481ba28f47e9268376f744df2172d67c7f60f..35640f0914a9cfb99720321a395e61186beddf8c 100755 (executable)
@@ -8,12 +8,6 @@
 
 #include <NCollection_SparseArrayBase.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (push)
-#pragma warning (disable:4291)
-#endif
-
 /**
 * Dynamically resizable sparse array of objects
 *
@@ -266,9 +260,5 @@ private:
 
 };
 
-#ifdef WNT
-#pragma warning (pop)
-#endif
-
 #endif
 
index 06e616d99f35c2b27fe31f76239408923baf9c7a..a18fce23b656c2ca1402d74bb823c0b57c4825f9 100755 (executable)
 #include <Standard_NoSuchObject.hxx>
 #endif
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 /**
  * Purpose:      A stack is a structure where item can be added and
  *               removed from the top. Like a stack of plates  in a
@@ -135,8 +130,4 @@ template <class TheItemType> class NCollection_Stack
 
 };
 
-#ifdef WNT
-#pragma warning (default:4291)
-#endif
-
 #endif
index e5b0964381b852e4c8a39c1dcae4e544aac639f0..6e8de8925b0dc82b6c25c3262bc54afa3d0632c2 100755 (executable)
 #include <NCollection_BaseList.hxx>
 #include <NCollection_TListNode.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (push)
-#pragma warning (disable:4291)
-#endif
-
 /**
  * Purpose:     This Iterator class iterates on BaseList of TListNode and is 
  *              instantiated in List/Set/Queue/Stack
@@ -54,14 +48,6 @@ template <class TheItemType> class NCollection_TListIterator
   //! Variable Value access
   virtual TheItemType& ChangeValue (void) const
   { return ((NCollection_TListNode<TheItemType> *)myCurrent)->ChangeValue(); }
-  //! Operator new for allocating iterators
-  void* operator new(size_t theSize,
-                     const Handle(NCollection_BaseAllocator)& theAllocator) 
-  { return theAllocator->Allocate(theSize); }
 };
 
-#ifdef WNT
-#pragma warning (pop)
-#endif
-
 #endif
index ddaa93b6d3442fa6eb1c9a5881647e3ac0bfeacb..05bfeb257844b006cc4dd5d505063b0bbb24e243 100755 (executable)
@@ -8,12 +8,7 @@
 
 #include <NCollection_ListNode.hxx>
 #include <NCollection_BaseAllocator.hxx>
-
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (push)
-#pragma warning (disable:4291)
-#endif
+#include <NCollection_DefineAlloc.hxx>
 
 /**
  * Purpose:     Abstract list node class. Used by BaseList
@@ -32,9 +27,8 @@ template <class TheItemType> class NCollection_TListNode
   //! Variable value access
   TheItemType& ChangeValue () { return myValue; }
   //! Memory allocation
-  void* operator new(size_t theSize,
-                     const Handle(NCollection_BaseAllocator)& theAllocator) 
-  { return theAllocator->Allocate(theSize); }
+  DEFINE_STANDARD_ALLOC
+  DEFINE_NCOLLECTION_ALLOC
   //! Static deleter to be passed to BaseList
   static void delNode (NCollection_ListNode * theNode, 
                        Handle(NCollection_BaseAllocator)& theAl)
@@ -49,8 +43,4 @@ template <class TheItemType> class NCollection_TListNode
   
 };
 
-#ifdef WNT
-#pragma warning (pop)
-#endif
-
 #endif
index f4e7545d2f340fff172b270f35c3806fcec5b4df..e959121b8b1f979cf439580c50ddb2899c4378df 100755 (executable)
@@ -7,12 +7,7 @@
 #define NCollection_UBTree_HeaderFile
 
 #include <NCollection_BaseAllocator.hxx>
-
-#ifdef WNT
-// Disable the warning: "operator new unmatched by delete"
-#pragma warning (push)
-#pragma warning (disable:4291)
-#endif
+#include <NCollection_DefineAlloc.hxx>
 
 /**
  * The algorithm of unbalanced binary tree of overlapped bounding boxes.
@@ -116,6 +111,10 @@ template <class TheObjType, class TheBndType> class NCollection_UBTree
    */
   class TreeNode
   {
+  public:
+    DEFINE_STANDARD_ALLOC
+    DEFINE_NCOLLECTION_ALLOC
+
   public:
     TreeNode (const TheObjType& theObj, const TheBndType& theBnd)
       : myBnd(theBnd), myObject(theObj), myChildren(0), myParent(0) {}
@@ -195,20 +194,6 @@ template <class TheObjType, class TheBndType> class NCollection_UBTree
 //  ~TreeNode () { if (myChildren) delete [] myChildren; }
     ~TreeNode () { myChildren = 0L; }
 
-    /**
-     * Allocator of a tree node.
-     */
-    void * operator new (size_t theSize,
-                         const Handle(NCollection_BaseAllocator)& theAllocator) 
-    { return theAllocator->Allocate(theSize); }
-
-    /**
-     * Allocator of a tree node.
-     */
-    void * operator new (size_t,
-                         void * theMem) 
-    { return theMem; }
-
     /**
      * Deleter of tree node. The whole hierarchy of its children also deleted.
      * This method should be used instead of operator delete.
@@ -500,8 +485,4 @@ DEFINE_STANDARD_HANDLE (_HUBTREE, _HPARENT)
 IMPLEMENT_STANDARD_HANDLE (_HUBTREE, _HPARENT)                          \
 IMPLEMENT_STANDARD_RTTIEXT(_HUBTREE, _HPARENT)
 
-#ifdef WNT
-#pragma warning (pop)
-#endif
-
 #endif
index d18f669ab622adceaee04d24faca49a1e9a9ccc3..8cbbda4260c06d567f8a7cb989d26001943d25e6 100755 (executable)
 #include <Standard_OutOfRange.hxx>
 #endif
 
-#ifdef WNT
-// Disable the warning: "operator new unmatched by delete"
-#pragma warning (push)
-#pragma warning (disable:4291)
-#endif
-
 /**
 * Class NCollection_Vector (dynamic array of objects)
 *
@@ -54,8 +48,9 @@ template <class TheItemType> class NCollection_Vector
   //! Nested class MemBlock
   class MemBlock : public NCollection_BaseVector::MemBlock
   {
-  public:
-    void * operator new (size_t, void * theAddress) { return theAddress; }
+   public:
+    DEFINE_STANDARD_ALLOC
+
     //! Empty constructor
     MemBlock (NCollection_BaseAllocator* theAlloc)
       : NCollection_BaseVector::MemBlock(0,0,theAlloc)
@@ -156,10 +151,6 @@ template <class TheItemType> class NCollection_Vector
     //! Variable value access
     virtual TheItemType& ChangeValue (void) const       {
       return ((MemBlock *) CurBlockV()) -> ChangeValue(myCurIndex); }
-    //! Operator new for allocating iterators
-    void* operator new(size_t theSize,
-                       const Handle(NCollection_BaseAllocator)& theAllocator) 
-    { return theAllocator->Allocate(theSize); }
   }; // End of the nested class Iterator
 
   // ----------------------------------------------------------------------
@@ -306,8 +297,4 @@ template <class TheItemType> class NCollection_Vector
   friend class Iterator;
 };
 
-#ifdef WNT
-#pragma warning (pop)
-#endif
-
 #endif
index 81d8f18ae28dd4992e0c7529f382a9628a7652b1..9f6e2af443d3b1732e78bd8920a457f2a4281ee4 100755 (executable)
@@ -15,8 +15,8 @@
 #include <Bnd_B3f.hxx>
 
 #ifdef WNT
-// Disable the warning "operator new unmatched by delete"
 #pragma warning (push)
+// Disable warning 4480: nonstandard extension used: specifying underlying type for enum 'enum'
 #pragma warning (disable:4480)
 #endif
 
index 02bc9b29752a0c1af64d42d02b7990c6a0f995fa..c8be420a3a8243df9509bb780f1ee2a5a04cf462 100755 (executable)
 #include <NIS_InteractiveObject.hxx>
 #include <Quantity_Color.hxx>
 
-#ifdef WNT
-// Disable the warning "operator new unmatched by delete"
-#pragma warning (push)
-#pragma warning (disable:4291)
-#endif
-
 class Handle_NIS_TriangulatedDrawer;
 class NCollection_BaseAllocator;
 class Handle_NCollection_BaseAllocator;
@@ -465,24 +459,13 @@ class NIS_Triangulated : public NIS_InteractiveObject
    */
   Standard_EXPORT virtual void Delete () const; 
 
-  /**
-   * Operator new for memory allocation uses Open CASCADE memory manager
-   */
-  void* operator new    (size_t size)
-  {
-    return Standard::Allocate(size);
-  }
-
  protected:
 
   /**
    * Allocator-based operator new for dynamic allocations in method Clone()
    */
-  void* operator new    (Standard_Size theSz,
-                         const Handle(NCollection_BaseAllocator)& theAllocator)
-  {
-    return theAllocator->Allocate(theSz);
-  }
+  DEFINE_STANDARD_ALLOC
+  DEFINE_NCOLLECTION_ALLOC
 
   /**
    * Create a 3D bounding box of the object.
@@ -536,8 +519,4 @@ DEFINE_STANDARD_RTTI (NIS_Triangulated)
 // Definition of HANDLE object using Standard_DefineHandle.hxx
 DEFINE_STANDARD_HANDLE (NIS_Triangulated, NIS_InteractiveObject)
 
-#ifdef WNT
-#pragma warning (pop)
-#endif
-
 #endif
index 3dae10ac9787864eaca20a6493bfcc1c30ef6a15..736b32ba459e7c4bac4a5797873556d63324fcd6 100644 (file)
@@ -24,7 +24,7 @@ struct OPENGL_SURF_PROP
   int          isphysic;
   unsigned int color_mask;
   TEL_COLOUR speccol, difcol, ambcol, emscol, matcol;
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 struct TEL_CONTEXT_FACE
@@ -39,7 +39,7 @@ struct TEL_CONTEXT_FACE
   int                  doTextureMap;
   int                  TexId;
   TEL_POFFSET_PARAM PolygonOffset;
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #include <OpenGl_Element.hxx>
@@ -67,7 +67,7 @@ class OpenGl_AspectFace : public OpenGl_Element
   OpenGl_AspectLine  myAspectEdge;
 
  public:
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #endif //_OpenGl_AspectFace_Header
index 2e820ec8dcb3d1309cc0918f94a3f03e71f8b926..7eac3eae5056cf24c1d3839cf36ffa2521d8825a 100644 (file)
@@ -34,7 +34,7 @@ class OpenGl_AspectLine : public OpenGl_Element
   float             myWidth;
 
  public:
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #endif //_OpenGl_AspectLine_Header
index 56136673ab71d4fae029fae4a421ac63855c5cbf..29cb53467050f8a8fbf22d5ad777031014ca372c 100644 (file)
@@ -33,7 +33,7 @@ class OpenGl_AspectMarker : public OpenGl_Element
   float               myScale;
 
  public:
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #endif //OpenGl_AspectMarker_Header
index 516d27866d1e5540b1733d5bf2892a0046ccbc98..a3e4d8aaa4573a3995e13499f48d2c2f01f4a9e9 100644 (file)
@@ -49,7 +49,7 @@ class OpenGl_AspectText : public OpenGl_Element
   TEL_COLOUR               mySubtitleColor;
 
  public:
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #endif //OpenGl_AspectText_Header
index 04c29a088f3f8a466cbaa5532668060ff0cf431b..a417d2854373487c4d894b35f974942bbcb8488d 100644 (file)
@@ -15,7 +15,7 @@ struct OpenGl_CView
 {
   Handle_OpenGl_Workspace WS;
   Handle_OpenGl_View      View;
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #endif //OpenGl_CView_Header
index 81862837ec443d11a6b5328ed280c1c22d5552cb..131ea914d4181eba74cce791f07d4791bb7a0080 100644 (file)
@@ -40,7 +40,7 @@ struct OPENGL_MARKER_DATA
   unsigned int Width;
   unsigned int Height;
   unsigned char* Array;
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 typedef NCollection_DataMap<int,OPENGL_MARKER_DATA> OpenGl_MapOfUserMarker;
@@ -150,7 +150,7 @@ class OpenGl_Display : public MMgt_TShared
   Standard_Integer myFontSize;
 
  public:
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 extern Handle(OpenGl_Display) openglDisplay;
index e10510e0855c885d7646a15212cf004277bf6bac..763d2621c9d13fb0b3f32bc8fab4093aa099b930 100644 (file)
@@ -17,7 +17,7 @@ class OpenGl_Element
   virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const = 0;
 
  public:
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #endif //OpenGl_Element_Header
index 00dfbce1a9c1b136df7ba834c12b9d567e496241..b44ae1dd59eb37adfcc904b98ececf8556073fd3 100644 (file)
@@ -58,7 +58,7 @@ class OpenGl_GraduatedTrihedron : public MMgt_TShared
   void* myPtrVisual3dView;
 
  public:
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #endif //_OpenGl_GraduatedTrihedron_Header
index 65b44833cb10663b65553105d8105404e7cbadbc..5e0187dd503d8c0703c310ec7739af39736dae61 100644 (file)
@@ -22,7 +22,7 @@ struct OpenGl_ElementNode
   TelType type;
   OpenGl_Element *elem;
   OpenGl_ElementNode *next;
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 class OpenGl_Group : public OpenGl_Element
@@ -53,7 +53,7 @@ class OpenGl_Group : public OpenGl_Element
   OpenGl_ElementNode *myFirst, *myLast;
 
  public:
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #endif //_OpenGl_Group_Header
index b4bec031e7f53835098e0f4093c4d487d7e6a464..f264955a2088c7e9083c7553dd6871bba085ed6e 100644 (file)
@@ -22,7 +22,7 @@ struct OpenGl_Light
   Tfloat      shine;
   Tfloat      atten[2];
   Tfloat      angle;
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 typedef NCollection_List<OpenGl_Light> OpenGl_ListOfLight;
index 036028e86f226b2ff11fa8500d2ee1276d16554c..242cb62968eaf7f9742afa9d6f4dca62689323ce 100644 (file)
@@ -24,7 +24,7 @@ class OpenGl_Marker : public OpenGl_Element
   TEL_POINT myPoint;
 
  public:
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #endif //OpenGl_Marker_Header
index c7425dc1f2a6e1795d457def72451cae14eb5bc3..8d03ba9d5a4db45c57f3c7741286b350f16de049 100644 (file)
@@ -27,7 +27,7 @@ class OpenGl_MarkerSet : public OpenGl_Element
   TEL_POINT *myPoints;
 
  public:
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #endif //OpenGl_MarkerSet_Header
index 48caf79d0a125a7d2a64baf547c9819608a1c3aa..524f2fbf68ceef98a9a30f5d67fcbc6a15ee8bdc 100644 (file)
@@ -11,7 +11,7 @@
 struct OpenGl_Matrix
 {
   float mat[4][4];
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 Standard_EXPORT void OpenGl_Multiplymat3 (OpenGl_Matrix *c, const OpenGl_Matrix *a, const OpenGl_Matrix *b);
index 69157e2908888afef83fa69003ceedb13fbbf778..061deba990c2dad751fafe3230a129d6a6e73f06 100644 (file)
@@ -33,7 +33,7 @@ struct TEL_INDEXPOLY_DATA
   tel_colour vcolours;       /* Vertex colour values */
   tel_point  vnormals;       /* Vertex normals */
   tel_texture_coord vtexturecoord; /* Texture Coordinates */
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 class OpenGl_Mesh : public OpenGl_Element
@@ -72,7 +72,7 @@ class OpenGl_Mesh : public OpenGl_Element
   DS_INTERNAL *myDS;
 
  public:
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #endif //OpenGl_Mesh_Header
index 2fce78863a7d04120a2dc8d3a46a96ec76e35340..cfbaca3e84adf931d59b551037f3cc1026dba325 100644 (file)
@@ -27,7 +27,7 @@ struct EXTRA_VERTEX
 {
   GLfloat vert[3];
   int ind;
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 typedef EXTRA_VERTEX* extra_vertex;
 
@@ -36,7 +36,7 @@ struct SEQ_
   Tint ts_num, ts_alloc;
   void **tmesh_sequence;
   GLenum triangle_type; /* FSXXX OPTI */
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 struct OPENGL_DISPLAY_PGN
@@ -44,7 +44,7 @@ struct OPENGL_DISPLAY_PGN
   Tint num_of_seq;
   Tint num_alloc;
   SEQ_ *seq;
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 static void bgntriangulate( const TEL_POLYGON_DATA *, void (APIENTRY*)() );
index c5089a7758bfc07f8bca37c9f9a537e6b0100bf2..7ece703a666dc699025cb9ac7750357a815f9914 100644 (file)
@@ -30,7 +30,7 @@ struct TEL_POLYGON_DATA
   tel_point  vnormals;    /* Vertex normals */
   tel_texture_coord vtexturecoord; /* Texture Coordinates */
   OPENGL_DISPLAY_PGN *dsply;
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 class OpenGl_Polygon : public OpenGl_Element
@@ -56,7 +56,7 @@ class OpenGl_Polygon : public OpenGl_Element
   TEL_POLYGON_DATA myData;
 
  public:
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #endif //OpenGl_Polygon_Header
index 72b5f3f3d95af70e927350f7eb4f2fb92d20aa9a..677c20f6fcc17a7b4d4dc59d2c3465ae8465db62 100644 (file)
@@ -32,7 +32,7 @@ class OpenGl_Polyline : public OpenGl_Element
   tel_colour myColors;        // Vertex color values for each vertex
 
  public:
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #endif //OpenGl_Polyline_Header
index 2fb036f9252cbc552db24d91b226daa2f5e53c5b..25dcefdb09b9db902687384df7a0221760265437 100644 (file)
@@ -79,7 +79,7 @@ protected:
 
 public:
 
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 
 };
 
index 2928ea309e59c2f52d39fb4b7ab92982e23a1126..a6e88e08983acc3208e81c5e0954ab694241dd01 100644 (file)
@@ -49,7 +49,7 @@ class OpenGl_PriorityList
   Standard_Integer        myNbStructures;
 
  public:
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #endif //_OpenGl_PriorityList_Header
index 9c7d5b8a741a354852b980da691a5eca7ca1fd92..0dd058e85a6730d0230ca67d377af9d0ec4e3e0d 100644 (file)
@@ -27,7 +27,7 @@ struct OPENGL_QSTRIP_DATA
   tel_colour vcolours;    /* Vertex colour values */
   tel_point  vnormals;    /* Vertex normals */
   tel_texture_coord vtexturecoord; /* Texture coordinates */
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 class OpenGl_QuadrangleStrip : public OpenGl_Element
@@ -60,7 +60,7 @@ class OpenGl_QuadrangleStrip : public OpenGl_Element
   DS_INTERNAL *myDS;
 
  public:
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #endif //OpenGl_QuadrangleStrip_Header
index c1f32287224de7043b9cd495b8a197deac268e76..23d254e5abb7e302f0cd84c8c5d199a6163188f4 100644 (file)
@@ -83,7 +83,7 @@ class OpenGl_Structure : public OpenGl_Element
   OpenGl_ListOfGroup myGroups;
 
  public:
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #endif //OpenGl_Structure_Header
index 614d8beac12fbca86108b81499f4369568ef7f9f..4191b9867d67414fac34eb57e75e132a5c0c88e6 100644 (file)
@@ -35,7 +35,7 @@ class OpenGl_Text : public OpenGl_Element
   const wchar_t  *myString;
 
  public:
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #endif //OpenGl_Text_Header
index 10e1e14dd6b5d5a90a64b92ae2aa83410d369b0f..ba99adcdc367f16b1a37b05aa7f11cffdfb38d63 100644 (file)
@@ -15,7 +15,7 @@ struct OpenGl_TextParam
   int                               Height;
   Graphic3d_HorizontalTextAlignment HAlign;
   Graphic3d_VerticalTextAlignment   VAlign;
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #endif //_OpenGl_TextParam_Header
index e4493b56e556fcd04626755d8660b03455271c43..d33264bc1cc2bf38546bad6cd722d5e355a36e26 100755 (executable)
@@ -85,7 +85,7 @@ struct texData
   texDataStatus status;
   GLint type;
   int share_count;
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };  
 
 
@@ -110,7 +110,7 @@ struct texDraw
   GLfloat transx, transy;
   GLfloat angle;
 
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 
index 2095783c9057d37af6a19ede487de961aeed14a5..8eb465c9f9c42ce715d5fd007daf3af314211833 100755 (executable)
@@ -48,6 +48,7 @@
 */
 
 #include <OpenGl_tgl_all.hxx>
+#include <Standard_DefineAlloc.hxx>
 
 #include <GL/gl.h>
 
@@ -76,7 +77,7 @@ struct _TextureData
   GLfloat scalex,  scaley;
   GLfloat transx, transy;
   GLfloat angle;
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 typedef _TextureData TextureData;
 
index 78bede7bd2d4b6046b310721b045363cad2f9cb8..7bf2df6f4a6079d9b1de4d48dddc062ce89af2a2 100644 (file)
@@ -25,7 +25,7 @@ struct TEL_TMESH_DATA
   tel_colour vcolours;   /* length = num_facets + 2 */
   tel_point  vnormals;   /* length = num_facets + 2 */
   tel_texture_coord vtexturecoord; /* Texture coordinates */
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 class OpenGl_TriangleStrip : public OpenGl_Element
@@ -58,7 +58,7 @@ class OpenGl_TriangleStrip : public OpenGl_Element
   DS_INTERNAL *myDS;
 
  public:
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #endif //OpenGl_TriangleStrip_Header
index f1d6930ebe705e93b8e06934c7e7ac825e2d956b..cda9cd81782c88372df75da3c6e39a6dee814b03 100644 (file)
@@ -49,7 +49,7 @@ class OpenGl_Trihedron : public MMgt_TShared
   OpenGl_AspectText myAspectText;
 
  public:
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #endif //_OpenGl_Trihedron_Header
index ff86022c5cd389e75e323ba0c6cfdc3df0693242..37782e5639966cfca83a5310b56af240040deea4 100644 (file)
@@ -61,7 +61,7 @@ struct OPENGL_EXTRA_REP
 struct OPENGL_CLIP_REP
 {
   Standard_Real equation[4];
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 struct OPENGL_ZCLIP
@@ -226,7 +226,7 @@ class OpenGl_View : public MMgt_TShared
   Standard_Boolean myResetFLIST;
 
  public:
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 #endif //_OpenGl_View_Header
index e90dc422b33404395b2157d190fdf88e4650b82b..3a7022db117a9f904022b632061100bf50e241ab 100644 (file)
@@ -59,7 +59,7 @@ struct OPENGL_CLIP_PLANE
 {
   GLboolean isEnabled;
   GLdouble Equation[4];
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 };
 
 /*----------------------------------------------------------------------*/
index 3e80d2169588f859c6289fc98684250631ab8ba2..c75d6252850d9999190d2f304df6dcc6612641d6 100644 (file)
@@ -99,7 +99,7 @@ protected:
 public:
 
   DEFINE_STANDARD_RTTI(OpenGl_Window) // Type definition
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 
 };
 
index f3461689387b65f358c72eab4174b49c6436114d..fe2a4ed02b74447210c1925cb166830a44561e46 100644 (file)
@@ -217,7 +217,7 @@ protected:
 public:
 
   DEFINE_STANDARD_RTTI(OpenGl_Workspace) // Type definition
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 
 };
 
index 3a4716976b10eb30d9108ec3f047abcfa6b8ab38..c9d7a7bd2be829382fcfbbfa4f38030f611b39a4 100755 (executable)
@@ -8,7 +8,7 @@
 #include <Poly_CoherentTriangle.hxx>
 
 #ifdef WNT
-#pragma warning(disable:4291 4996)
+#pragma warning(disable:4996)
 #endif
 
 //=======================================================================
index 642e67ea4789e76f953650f9f17ced37ea0f267c..d5d15d651fdbc86154fc980a5982ab8d9f32c1fd 100755 (executable)
@@ -6,10 +6,6 @@
 
 #include <Poly_CoherentTriPtr.hxx>
 
-#ifdef WNT
-#pragma warning(disable:4291)
-#endif
-
 //=======================================================================
 //function : Iterator::Next
 //purpose  :
index 69706ffc40ad511dbbdae47270bf85682a714d5d..4be0f8636e49f11db0698587748dd4186ba07ebe 100755 (executable)
@@ -8,12 +8,13 @@
 #define Poly_CoherentTriPtr_HeaderFile
 
 #include <NCollection_BaseAllocator.hxx>
+#include <NCollection_DefineAlloc.hxx>
 
 class Poly_CoherentTriangle;
 
 #ifdef WNT
 #pragma warning (push)
-#pragma warning(disable:4355 4291) //'this' : used in base member initializer list
+#pragma warning(disable:4355) //'this' : used in base member initializer list
 #endif
 
 /**
@@ -78,11 +79,7 @@ class Poly_CoherentTriPtr
   /**
    * Operator new for dynamic allocations
    */
-  void* operator new    (Standard_Size theSize,
-                         const Handle(NCollection_BaseAllocator)& theAllocator)
-  {
-    return theAllocator->Allocate(theSize);
-  }
+  DEFINE_NCOLLECTION_ALLOC
 
   /**
    * Query the stored pointer to Triangle.
index 49999fa9390d4d4f11ce9919d24cf3043693dfd5..7d5267ca4a30013461697811d7dace0d95b521d5 100755 (executable)
@@ -22,13 +22,7 @@ struct polyedge {
     Standard_Integer nd;    // the second node of the edge
     Standard_Integer nt[2]; // the two adjacent triangles
     Standard_Integer nn[2]; // the two adjacent nodes
-    void* operator new(size_t aSize) 
-      {return (void*)(Standard::Allocate(aSize));}
-//    void  operator delete(void* aNode, size_t aSize) {
-    void  operator delete(void* aNode) {
-      Standard_Address anAdress = (Standard_Address)aNode;
-      Standard::Free(anAdress);
-    }
+    DEFINE_STANDARD_ALLOC
   };
 
 Poly_Connect::Poly_Connect(const Handle(Poly_Triangulation)& T) :
index 7ade12e48633fa22ff367261e10ae257ddefad68..e72a0ce7aefefbccbeb93622b7bf4b557c1659a2 100755 (executable)
@@ -62,7 +62,6 @@ Standard_values.h
 Standard_DefineHandle.hxx
 Standard_UUID.cxx
 Standard_UUID.hxx
-StandardCSFDB.cxx
 Standard_Version.hxx
 Standard_Mutex.hxx
 Standard_Mutex.cxx
@@ -73,3 +72,4 @@ Standard_DefineException.hxx
 Standard_MMgrTBBalloc.cxx
 Standard_MMgrTBBalloc.hxx
 Standard_Assert.hxx
+Standard_DefineAlloc.hxx
index f826d61300129f96035caf17ff7c85cd79fc5310..015ad8e17c8343bdc63f00ef577ebdc6c62f21a5 100755 (executable)
@@ -8,6 +8,9 @@
 #ifndef _Handle_Standard_Persistent_HeaderFile
 #define _Handle_Standard_Persistent_HeaderFile
 
+#ifndef _Standard_DefineAlloc_HeaderFile
+#include <Standard_DefineAlloc.hxx>
+#endif
 #ifndef _Standard_Macro_HeaderFile
 #include <Standard_Macro.hxx>
 #endif
@@ -38,8 +41,6 @@ class Handle_Standard_Persistent;
 
 Standard_EXPORT Standard_Integer HashCode(const Handle(Standard_Persistent)& ,
                                           const Standard_Integer);
-Standard_EXPORT Standard_Address StandardCSFDB_Allocate(const Standard_Size);
-Standard_EXPORT void StandardCSFDB_Free(Standard_Address&);
 
 class Handle(Standard_Persistent)
  {
@@ -69,18 +70,7 @@ class Handle(Standard_Persistent)
 
    public:
 
-    void* operator new(size_t,void* anAddress) 
-      {
-        return anAddress;
-      }
-    void* operator new(size_t size) 
-      { 
-        return StandardCSFDB_Allocate(size); 
-      }
-    void  operator delete(void *anAddress) 
-      { 
-        if (anAddress) StandardCSFDB_Free(anAddress); 
-      }
+    DEFINE_STANDARD_ALLOC
 
     Handle(Standard_Persistent)()
       {
index 05001035832b3b20881570be45175941d1e03f56..2f950a4e2fb23bd30692f8ecff02e8b4196c7f42 100755 (executable)
@@ -3,6 +3,9 @@
 #ifndef _Standard_HeaderFile
 #include <Standard.hxx>
 #endif
+#ifndef _Standard_DefineAlloc_HeaderFile
+#include <Standard_DefineAlloc.hxx>
+#endif
 #ifndef _Standard_Macro_HeaderFile
 #include <Standard_Macro.hxx>
 #endif
@@ -207,21 +210,8 @@ private:
   Standard_EXPORT void EndScope();
 
 public:
-  // Redefined operators new and delete ensure that handles are 
-  // allocated using OCC memory manager
 
-  void* operator new(size_t,void* anAddress) 
-  {
-    return anAddress;
-  }
-  void* operator new(size_t size) 
-  { 
-    return Standard::Allocate(size); 
-  }
-  void  operator delete(void *anAddress, size_t ) 
-  { 
-    if (anAddress) Standard::Free(anAddress); 
-  }
+  DEFINE_STANDARD_ALLOC
 
 private:
   // Field
index 981daaaadd3c5f70f02569194bc7de1a30b0032d..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100755 (executable)
@@ -1,64 +0,0 @@
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-#include <Standard_PrimitiveTypes.hxx>
-#include <Standard_Persistent.hxx>
-//#include <Standard_Type.hxx>
-//#include <Standard_Stream.hxx>
-#include <Standard.hxx>
-
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#ifdef HAVE_STRING_H
-# include <string.h>
-#endif
-
-//class Handle(Standard_Type);
-
-//extern const Handle(Standard_Transient)  Standard_TransientNullHandle;
-//extern const Handle(Standard_Persistent) Standard_PersistentNullHandle;
-//const Handle(Standard_Transient)  Standard_TransientNullHandle;
-//const Handle(Standard_Persistent) Standard_PersistentNullHandle;
-
-//---------------------------------------------------
-
-#ifdef WNT
-# include <windows.h>
-# include <winbase.h>
-#endif
-
-//=======================================================================
-//function : CSFDB_Allocate
-//purpose  : 
-//=======================================================================
-
-Standard_Address StandardCSFDB_Allocate(const Standard_Size aSize)
-{
-  return Standard::Allocate( aSize );
-}
-
-
-//=======================================================================
-//function : Free
-//purpose  : 
-//=======================================================================
-
-void StandardCSFDB_Free(Standard_Address& aStorage )
-{
-  Standard::Free( aStorage );
-}
-
-//=======================================================================
-//function : Reallocate
-//purpose  : 
-//=======================================================================
-
-Standard_EXPORT Standard_Address StandardCSFDB_Reallocate
-                                        (Standard_Address&   aStorage,
-                                         const Standard_Size ,
-                                         const Standard_Size newSize)
-{
-  return Standard::Reallocate( aStorage, newSize );
-}
diff --git a/src/Standard/Standard_DefineAlloc.hxx b/src/Standard/Standard_DefineAlloc.hxx
new file mode 100644 (file)
index 0000000..8d33bc3
--- /dev/null
@@ -0,0 +1,69 @@
+// File:        Standard_DefineAlloc.hxx
+// Created:     Jan 19 10:33:16 2012
+// Author:      Dmitry BOBYLEV 
+// Copyright:   Open CASCADE SAS 2012
+
+#ifndef _Standard_DefineAlloc_HeaderFile
+# define _Standard_DefineAlloc_HeaderFile
+
+// Macro to override new and delete operators for arrays.
+// Defined to empty for old SUN compiler
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)
+#  define DEFINE_STANDARD_ALLOC_ARRAY
+# else
+#  define DEFINE_STANDARD_ALLOC_ARRAY                                  \
+   void* operator new[] (size_t theSize)                               \
+   {                                                                   \
+     return Standard::Allocate (theSize);                              \
+   }                                                                   \
+   void  operator delete[] (void* theAddress)                          \
+   {                                                                   \
+     Standard::Free (theAddress);                                      \
+   }
+# endif
+
+// Macro to override placement new and placement delete operators. 
+// For Borland C and old SUN compilers do not define placement delete
+// as it is not supported.
+# if defined(__BORLANDC__) || (defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530))
+#  define DEFINE_STANDARD_ALLOC_PLACEMENT                              \
+   void* operator new (size_t, void* theAddress)                       \
+   {                                                                   \
+     return theAddress;                                                \
+   }
+# else 
+#  define DEFINE_STANDARD_ALLOC_PLACEMENT                              \
+   void* operator new (size_t, void* theAddress)                       \
+   {                                                                   \
+     return theAddress;                                                \
+   }                                                                   \
+   void operator delete (void*, void*)                                 \
+   {                                                                   \
+   }
+# endif
+
+// Macro to override operators new and delete to use OCC memory manager
+# define DEFINE_STANDARD_ALLOC                                         \
+  void* operator new (size_t theSize)                                  \
+  {                                                                    \
+    return Standard::Allocate (theSize);                               \
+  }                                                                    \
+  void  operator delete (void* theAddress)                             \
+  {                                                                    \
+    Standard::Free ((Standard_Address&)theAddress);                    \
+  }                                                                    \
+  DEFINE_STANDARD_ALLOC_ARRAY                                          \
+  DEFINE_STANDARD_ALLOC_PLACEMENT
+
+// Declare operator new in global scope for old sun compiler
+#ifndef WORKAROUND_SUNPRO_NEW_PLACEMENT
+#define WORKAROUND_SUNPRO_NEW_PLACEMENT
+#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x420)
+inline void* operator new(size_t,void* anAddress) 
+{
+  return anAddress;
+}
+#endif
+#endif
+
+#endif
\ No newline at end of file
index fce21502d2c7cdd947a2fe74fe0c8bfda217014c..259d30440a4718d44247d9f02ed4d2ff987b4737 100755 (executable)
@@ -12,7 +12,7 @@
 #endif /* HAVE_CONFIG_H */
 
 // Standard OCC macros: Handle(), STANDARD_TYPE()
-# define   Handle(ClassName)  Handle_##ClassName
+# define   Handle(ClassName)      Handle_##ClassName
 # define   STANDARD_TYPE(aType)   aType##_Type_()
 
 //======================================================
index cc8e68708793253f94e4528992b71e7f62584456..89ab6a0117691550d23b81d1d0818c92e938ba06 100755 (executable)
@@ -4,6 +4,9 @@
 #ifndef _Standard_Macro_HeaderFile
 #include <Standard_Macro.hxx>
 #endif
+#ifndef _Standard_DefineAlloc_HeaderFile
+#include <Standard_DefineAlloc.hxx>
+#endif
 #ifndef _Standard_PrimitiveTypes_HeaderFile
 #include <Standard_PrimitiveTypes.hxx>
 #endif
@@ -17,8 +20,6 @@ class Handle_Standard_Type;
 class Standard_Type;
 
 class Storage_stCONSTclCOM;
-Standard_EXPORT Standard_Address StandardCSFDB_Allocate(const Standard_Size);
-Standard_EXPORT void StandardCSFDB_Free(Standard_Address&);
 Standard_EXPORT const Handle_Standard_Type& Standard_Persistent_Type_();
 
 class Standard_Persistent
@@ -31,20 +32,9 @@ private:
   Standard_Integer _typenum;
   Standard_Integer _refnum;
 public:
-  // MEMORY MANAGER
-  //
-  void*   operator new (size_t s) {
-    return StandardCSFDB_Allocate(s);
-  }
-
-  void    operator delete (void* p) {
-    StandardCSFDB_Free(p);
-  }
-
-  void* operator new(size_t,void* anAddress) {
-    return anAddress;
-  }
+  
+  DEFINE_STANDARD_ALLOC
+
   Standard_EXPORT virtual Handle_Standard_Persistent This() const;
   Standard_EXPORT virtual Handle_Standard_Persistent ShallowCopy () const;
   Standard_EXPORT virtual void Delete() const;
index 37691716fb847be1ef1597bdab6e0f4b0060e523..685a5e0385808f0f5b7004ee7ef26a0977dbf889 100755 (executable)
@@ -1,6 +1,9 @@
 #ifndef _Standard_Transient_proto_HeaderFile
 #define _Standard_Transient_proto_HeaderFile
 
+#ifndef _Standard_DefineAlloc_HeaderFile
+#include <Standard_DefineAlloc.hxx>
+#endif
 #ifndef _Standard_Macro_HeaderFile
 #include <Standard_Macro.hxx>
 #endif
@@ -21,21 +24,8 @@ class Standard_Transient
     friend class Handle(Standard_Transient);
 
  public:
-    //! Operator new for placement in pre-allocated memory
-    void* operator new(size_t,void* anAddress) 
-      {
-        return anAddress;
-      }
-    //! Operator new for memory allocation uses Open CASCADE memory manager
-    void* operator new(size_t size) 
-      { 
-        return Standard::Allocate(size); 
-      }
-    //! Operator delete symmetric to operator new
-    void  operator delete(void *anAddress) 
-      { 
-        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
-      }
+    
+    DEFINE_STANDARD_ALLOC
 
     //! Empty constructor
     Standard_Transient() : count(0) {}
index 1a599e078cba89c80eabe4af6b97d3b983d780c5..b91fa24d23ae0ca5c0f23a3788163e0650e94b02 100755 (executable)
@@ -26,16 +26,5 @@ typedef size_t Standard_Size;
 typedef const char*  Standard_CString;
 typedef const short* Standard_ExtString;
 
-// declare operator new in global scope for old sun compiler
-#ifndef WORKAROUND_SUNPRO_NEW_PLACEMENT
-#define WORKAROUND_SUNPRO_NEW_PLACEMENT
-#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x420)
-inline void* operator new(size_t,void* anAddress) 
-{
-  return anAddress;
-}
-#endif
-#endif
-
 #endif
 
index dfe9ef019b9bc9866650cdb636cfe8fd9a3c2549..1c38d2987697146808b963edf33e605ec0e3b471 100755 (executable)
@@ -25,12 +25,12 @@ class Storage_Bucket {
 public:
   Storage_Bucket() : mySpace(0L), mySpaceSize(200000), myCurrentSpace(-1)
     {
-      mySpace = (Standard_Persistent**)StandardCSFDB_Allocate(sizeof(Standard_Persistent*) * mySpaceSize);
+      mySpace = (Standard_Persistent**)Standard::Allocate(sizeof(Standard_Persistent*) * mySpaceSize);
     }
 
   Storage_Bucket(const Standard_Integer theSpaceSize) :  mySpace(0L), mySpaceSize(theSpaceSize), myCurrentSpace(-1)
     {
-      mySpace = (Standard_Persistent**)StandardCSFDB_Allocate(sizeof(Standard_Persistent*) * mySpaceSize);
+      mySpace = (Standard_Persistent**)Standard::Allocate(sizeof(Standard_Persistent*) * mySpaceSize);
     }
 
   void Clear();
index dccb60dfc0df55181a262a63cb39a55ca9ffbb19..116e729f4981e4a92cde9533c38a47dea11d0003 100755 (executable)
@@ -52,16 +52,11 @@ typedef NCollection_DataMap <TCollection_AsciiString,
 
 #endif
 
-extern Standard_Address StandardCSFDB_Reallocate
-                         (Standard_Address&,
-                          const Standard_Size,
-                          const Standard_Size);
-
 // IMPLEMENTATION BucketOfPersistent
 //
 Storage_Bucket::~Storage_Bucket()
 {
-  StandardCSFDB_Free((Standard_Address&)mySpace);
+  Standard::Free((Standard_Address&)mySpace);
   mySpace = 0L;
   mySpaceSize = 0;
   Clear();
@@ -110,7 +105,7 @@ Storage_BucketOfPersistent::Storage_BucketOfPersistent
 : myNumberOfBucket(1),myNumberOfBucketAllocated(theBucketNumber),myBucketSize
                          (theBucketSize)
 {
-  myBuckets =  (Storage_Bucket**)StandardCSFDB_Allocate
+  myBuckets =  (Storage_Bucket**)Standard::Allocate
                          (sizeof(Storage_Bucket*) * theBucketNumber);
   myBuckets[0] = new Storage_Bucket(myBucketSize);
   myCurrentBucket = myBuckets[0];
@@ -141,7 +136,7 @@ Storage_BucketOfPersistent::~Storage_BucketOfPersistent()
 {
   Clear();
   delete myBuckets[0];
-  StandardCSFDB_Free((Standard_Address&)myBuckets);
+  Standard::Free((Standard_Address&)myBuckets);
   myBuckets = 0L;
 }
 
@@ -182,7 +177,7 @@ void Storage_BucketOfPersistent::Append(const Handle(Standard_Persistent)& sp)
 
   if (myNumberOfBucket > myNumberOfBucketAllocated) {
     Standard_Size e = sizeof(Storage_Bucket*) * myNumberOfBucketAllocated;
-    myBuckets =  (Storage_Bucket**)StandardCSFDB_Reallocate((Standard_Address&)myBuckets,e,e * 2);
+    myBuckets =  (Storage_Bucket**)Standard::Reallocate((Standard_Address&)myBuckets, e * 2);
     myNumberOfBucketAllocated *= 2;
   }
 
index 5cd9c7f55da6af9bf63470f04614bc8c5b4ed2ac..a2df411c470b7001d79fd248b2e793fcf04d15b3 100755 (executable)
@@ -7,6 +7,7 @@
 #ifndef TColStd_PackedMapOfInteger_HeaderFile
 #define TColStd_PackedMapOfInteger_HeaderFile
 
+#include <Standard_DefineAlloc.hxx>
 #include <TCollection_BasicMap.hxx>
 
 /**
@@ -19,10 +20,7 @@ class TColStd_PackedMapOfInteger : private TCollection_BasicMap
  public:
   // operators new and delete must be defined explicitly 
   // since inherited ones are not accessible
-  void* operator new(size_t size) 
-  { return TCollection_BasicMap::operator new(size); }
-  void  operator delete(void *anAddress) 
-  { TCollection_BasicMap::operator delete (anAddress); }
+  DEFINE_STANDARD_ALLOC
   
  public:
   // ---------- PUBLIC METHODS ----------
index 88fee662a562aed3058b457d2799dc953fd930dd..5943d23275d89635c699eedae06139f8d8b738a8 100755 (executable)
@@ -75,11 +75,6 @@ if (withDelta) { \
   aDelta->AddAttributeDelta(DELTACREATION); \
 }
 
-#ifdef WNT
-// Disable the warning: "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 //=======================================================================
 //function : TDF_Data
 //purpose  : empty constructor
@@ -98,10 +93,6 @@ myAllowModification     (Standard_True)
   myRoot = new (anIncAllocator) TDF_LabelNode (this);
 }
 
-#ifdef WNT
-#pragma warning (default:4291)
-#endif
-
 //=======================================================================
 //function : Destroy
 //purpose  : Used to implement the destructor ~.
index b0075be2fa3cb3496576838ec5b52d635f8c215d..8e7f7a25ae51c15f6631fda6b99890ff64f34295 100755 (executable)
@@ -308,11 +308,6 @@ void TDF_Label::EntryDump(Standard_OStream& anOS) const
   }
 }
 
-#ifdef WNT
-// Disable the warning: "operator new unmatched by delete"
-#pragma warning (disable:4291)
-#endif
-
 //=======================================================================
 //function : FindOrAddChild
 //purpose  : Finds or adds a label child having <aTag> as tag.
@@ -373,10 +368,6 @@ TDF_LabelNode* TDF_Label::FindOrAddChild
   return childLabelNode;
 }
 
-#ifdef WNT
-#pragma warning (default:4291)
-#endif
-
 //=======================================================================
 //function : InternalDump
 //purpose  : Private method.
index 5293a8ad048d54408c2ef99041b8a0ba43d06b93..581c834466a0ce36fafaa2ec8e1471c48a66b9d2 100755 (executable)
@@ -109,6 +109,12 @@ class TDF_LabelNode {
   void * operator new (size_t aSize,
                        const Handle(NCollection_IncAllocator)& anAlloc)
         { return anAlloc -> Allocate (aSize); }
+#if !defined(__BORLANDC__) && (!defined(__SUNPRO_CC) || (__SUNPRO_CC > 0x530))
+  void  operator delete (void* theAddress,
+                         const Handle(NCollection_IncAllocator)& anAlloc)
+  {
+  }
+#endif 
   void  operator delete(void *) { }
         // nothing to do in operator delete since IncAllocator does not need it
   // Public Friends
@@ -175,4 +181,4 @@ class TDF_LabelNode {
 #endif
 };
 
-#endif
+#endif
\ No newline at end of file
index d82752df0b8f627675eb628309c3f39ce3ea5f70..e4f002bd5ed372be210433ee1db369fdf0a5d449 100755 (executable)
@@ -77,23 +77,7 @@ public:
   Standard_Boolean IsValidInTrans(Standard_Integer Trans);
 
   // Memory management
-  void* operator new(size_t aSize) {
-    return Standard::Allocate(aSize);
-  }
-
-/* attempt to eliminate compiler warning  
-  void* operator new(size_t, void* aNode) {
-    return aNode;
-  }
-  
-  void  operator delete(void* aNode) {
-    Standard::Free(aNode);
-  }
-*/
-  
-  void  operator delete(void* aNode, size_t aSize) {
-    Standard::Free(aNode);
-  }
+  DEFINE_STANDARD_ALLOC
   
   TNaming_PtrRefShape  myOld;
   TNaming_PtrRefShape  myNew;
index faafbbb8e653490f461fcd33863bff442c81dd28..a0a795d82905494a9d802e201f69191f4b6e0e4f 100755 (executable)
@@ -35,7 +35,7 @@ private:
 
 public:
 
-  IMPLEMENT_MEMORY_OPERATORS
+  DEFINE_STANDARD_ALLOC
 
 };