diff --git a/src/BRepExtrema/BRepExtrema_DistShapeShape.hxx b/src/BRepExtrema/BRepExtrema_DistShapeShape.hxx index 119f81a9d0..7004352a84 100644 --- a/src/BRepExtrema/BRepExtrema_DistShapeShape.hxx +++ b/src/BRepExtrema/BRepExtrema_DistShapeShape.hxx @@ -25,6 +25,9 @@ #ifndef _Standard_HeaderFile #include #endif +#ifndef _Standard_DefineAlloc_HeaderFile +#include +#endif #ifndef _Standard_Macro_HeaderFile #include #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
Standard_EXPORT BRepExtrema_DistShapeShape(); diff --git a/src/BRepExtrema/BRepExtrema_DistanceSS.hxx b/src/BRepExtrema/BRepExtrema_DistanceSS.hxx index 522133baa2..183c7aa769 100644 --- a/src/BRepExtrema/BRepExtrema_DistanceSS.hxx +++ b/src/BRepExtrema/BRepExtrema_DistanceSS.hxx @@ -25,6 +25,9 @@ #ifndef _Standard_HeaderFile #include #endif +#ifndef _Standard_DefineAlloc_HeaderFile +#include +#endif #ifndef _Standard_Macro_HeaderFile #include #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).
Standard_EXPORT BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2, diff --git a/src/BRepExtrema/BRepExtrema_ExtCC.hxx b/src/BRepExtrema/BRepExtrema_ExtCC.hxx index a6e2fcd31c..6e42775241 100644 --- a/src/BRepExtrema/BRepExtrema_ExtCC.hxx +++ b/src/BRepExtrema/BRepExtrema_ExtCC.hxx @@ -9,6 +9,9 @@ #ifndef _Standard_HeaderFile #include #endif +#ifndef _Standard_DefineAlloc_HeaderFile +#include +#endif #ifndef _Standard_Macro_HeaderFile #include #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() { diff --git a/src/BRepExtrema/BRepExtrema_ExtCF.hxx b/src/BRepExtrema/BRepExtrema_ExtCF.hxx index 1fb6d62743..045e299f52 100644 --- a/src/BRepExtrema/BRepExtrema_ExtCF.hxx +++ b/src/BRepExtrema/BRepExtrema_ExtCF.hxx @@ -9,6 +9,9 @@ #ifndef _Standard_HeaderFile #include #endif +#ifndef _Standard_DefineAlloc_HeaderFile +#include +#endif #ifndef _Standard_Macro_HeaderFile #include #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() { diff --git a/src/BRepExtrema/BRepExtrema_ExtFF.hxx b/src/BRepExtrema/BRepExtrema_ExtFF.hxx index 9e2035e7d7..f754721bbe 100644 --- a/src/BRepExtrema/BRepExtrema_ExtFF.hxx +++ b/src/BRepExtrema/BRepExtrema_ExtFF.hxx @@ -9,6 +9,9 @@ #ifndef _Standard_HeaderFile #include #endif +#ifndef _Standard_DefineAlloc_HeaderFile +#include +#endif #ifndef _Standard_Macro_HeaderFile #include #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() { diff --git a/src/BRepExtrema/BRepExtrema_ExtPC.hxx b/src/BRepExtrema/BRepExtrema_ExtPC.hxx index 631d1ac39e..0d1608bb3b 100644 --- a/src/BRepExtrema/BRepExtrema_ExtPC.hxx +++ b/src/BRepExtrema/BRepExtrema_ExtPC.hxx @@ -9,6 +9,9 @@ #ifndef _Standard_HeaderFile #include #endif +#ifndef _Standard_DefineAlloc_HeaderFile +#include +#endif #ifndef _Standard_Macro_HeaderFile #include #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() { diff --git a/src/BRepExtrema/BRepExtrema_ExtPF.hxx b/src/BRepExtrema/BRepExtrema_ExtPF.hxx index 6e8ac30ccf..944b4be18f 100644 --- a/src/BRepExtrema/BRepExtrema_ExtPF.hxx +++ b/src/BRepExtrema/BRepExtrema_ExtPF.hxx @@ -25,6 +25,9 @@ #ifndef _Standard_HeaderFile #include #endif +#ifndef _Standard_DefineAlloc_HeaderFile +#include +#endif #ifndef _Standard_Macro_HeaderFile #include #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() {} diff --git a/src/BRepExtrema/BRepExtrema_SolutionElem.hxx b/src/BRepExtrema/BRepExtrema_SolutionElem.hxx index 1bf1a19738..8c8f035579 100644 --- a/src/BRepExtrema/BRepExtrema_SolutionElem.hxx +++ b/src/BRepExtrema/BRepExtrema_SolutionElem.hxx @@ -9,6 +9,9 @@ #ifndef _Standard_HeaderFile #include #endif +#ifndef _Standard_DefineAlloc_HeaderFile +#include +#endif #ifndef _Standard_Macro_HeaderFile #include #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.) { diff --git a/src/BRepPrim/BRepPrim_OneAxis.hxx b/src/BRepPrim/BRepPrim_OneAxis.hxx index 7fce27903e..2f4d6c0ef8 100755 --- a/src/BRepPrim/BRepPrim_OneAxis.hxx +++ b/src/BRepPrim/BRepPrim_OneAxis.hxx @@ -57,6 +57,9 @@ class gp_Pnt2d; #ifndef _Standard_HeaderFile #include #endif +#ifndef _Standard_DefineAlloc_HeaderFile +#include +#endif #ifndef _Standard_Macro_HeaderFile #include #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() ; diff --git a/src/BRepSweep/BRepSweep_NumLinearRegularSweep.hxx b/src/BRepSweep/BRepSweep_NumLinearRegularSweep.hxx index ca70cd197a..90d012e458 100755 --- a/src/BRepSweep/BRepSweep_NumLinearRegularSweep.hxx +++ b/src/BRepSweep/BRepSweep_NumLinearRegularSweep.hxx @@ -64,6 +64,9 @@ class BRepSweep_SequenceNodeOfSequenceOfShapesOfNumLinearRegularSweep; #ifndef _Standard_HeaderFile #include #endif +#ifndef _Standard_DefineAlloc_HeaderFile +#include +#endif #ifndef _Standard_Macro_HeaderFile #include #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() ; diff --git a/src/DBC/DBC_VArray.gxx b/src/DBC/DBC_VArray.gxx index 23958514ea..ce7e0348df 100755 --- a/src/DBC/DBC_VArray.gxx +++ b/src/DBC/DBC_VArray.gxx @@ -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; iDBC_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 diff --git a/src/InterfaceGraphic/InterfaceGraphic_degeneration.hxx b/src/InterfaceGraphic/InterfaceGraphic_degeneration.hxx index 7c9146088d..90457c047b 100755 --- a/src/InterfaceGraphic/InterfaceGraphic_degeneration.hxx +++ b/src/InterfaceGraphic/InterfaceGraphic_degeneration.hxx @@ -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; diff --git a/src/InterfaceGraphic/InterfaceGraphic_telem.hxx b/src/InterfaceGraphic/InterfaceGraphic_telem.hxx index b61c09f760..ba17f9e2da 100755 --- a/src/InterfaceGraphic/InterfaceGraphic_telem.hxx +++ b/src/InterfaceGraphic/InterfaceGraphic_telem.hxx @@ -14,45 +14,14 @@ for InterfaceGraphic_Parray.hxx definitions #define INTERFACEGRAPHIC_TELEM_H #include +#include #include #include -//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 ) */ diff --git a/src/LDOM/LDOM_BasicAttribute.cxx b/src/LDOM/LDOM_BasicAttribute.cxx index 8e8bc01349..2f76893f76 100755 --- a/src/LDOM/LDOM_BasicAttribute.cxx +++ b/src/LDOM/LDOM_BasicAttribute.cxx @@ -7,11 +7,6 @@ #include #include -#ifdef WNT -// Disable the warning: "operator new unmatched by delete" -#pragma warning (disable:4291) -#endif - //======================================================================= //function : LDOM_BasicAttribute //purpose : diff --git a/src/LDOM/LDOM_BasicAttribute.hxx b/src/LDOM/LDOM_BasicAttribute.hxx index f73efcb55a..49661cd491 100755 --- a/src/LDOM/LDOM_BasicAttribute.hxx +++ b/src/LDOM/LDOM_BasicAttribute.hxx @@ -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 diff --git a/src/LDOM/LDOM_BasicElement.cxx b/src/LDOM/LDOM_BasicElement.cxx index 8bc28f3aa7..dd943bd871 100755 --- a/src/LDOM/LDOM_BasicElement.cxx +++ b/src/LDOM/LDOM_BasicElement.cxx @@ -9,11 +9,6 @@ #include #include -#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 diff --git a/src/LDOM/LDOM_BasicElement.hxx b/src/LDOM/LDOM_BasicElement.hxx index 2032ce917a..f4d9d3360e 100755 --- a/src/LDOM/LDOM_BasicElement.hxx +++ b/src/LDOM/LDOM_BasicElement.hxx @@ -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 diff --git a/src/LDOM/LDOM_BasicNode.hxx b/src/LDOM/LDOM_BasicNode.hxx index f5ef3df7d6..a255244865 100755 --- a/src/LDOM/LDOM_BasicNode.hxx +++ b/src/LDOM/LDOM_BasicNode.hxx @@ -18,6 +18,9 @@ class LDOMParser; class LDOM_BasicNode { + public: + DEFINE_STANDARD_ALLOC + public: Standard_Boolean isNull () const {return myNodeType ==LDOM_Node::UNKNOWN;} diff --git a/src/LDOM/LDOM_BasicText.cxx b/src/LDOM/LDOM_BasicText.cxx index e045a0d117..c92f5278e0 100755 --- a/src/LDOM/LDOM_BasicText.cxx +++ b/src/LDOM/LDOM_BasicText.cxx @@ -8,11 +8,6 @@ #include #include -#ifdef WNT -// Disable the warning: "operator new unmatched by delete" -#pragma warning (disable:4291) -#endif - //======================================================================= //function : LDOM_BasicText() //purpose : Constructor diff --git a/src/LDOM/LDOM_BasicText.hxx b/src/LDOM/LDOM_BasicText.hxx index 841531059f..6c4cce0248 100755 --- a/src/LDOM/LDOM_BasicText.hxx +++ b/src/LDOM/LDOM_BasicText.hxx @@ -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 diff --git a/src/NCollection/FILES b/src/NCollection/FILES index 0fb54fe7f3..ab4bc9b454 100755 --- a/src/NCollection/FILES +++ b/src/NCollection/FILES @@ -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 diff --git a/src/NCollection/NCollection_Array1.hxx b/src/NCollection/NCollection_Array1.hxx index 6e3d1dbde8..98cf5e3457 100755 --- a/src/NCollection/NCollection_Array1.hxx +++ b/src/NCollection/NCollection_Array1.hxx @@ -15,12 +15,6 @@ #include -#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 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 NCollection_Array1 TheItemType* myData; //!< Pointer to '0'th array item }; -#ifdef WNT -#pragma warning (pop) -#endif - #endif diff --git a/src/NCollection/NCollection_Array2.hxx b/src/NCollection/NCollection_Array2.hxx index 0540209d66..bd7cbd63ff 100755 --- a/src/NCollection/NCollection_Array2.hxx +++ b/src/NCollection/NCollection_Array2.hxx @@ -15,11 +15,6 @@ #include -#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 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 NCollection_Array2 }; -#ifdef WNT -#pragma warning (default:4291) -#endif - #endif diff --git a/src/NCollection/NCollection_BaseCollection.hxx b/src/NCollection/NCollection_BaseCollection.hxx index 70a16c05de..504a26773d 100755 --- a/src/NCollection/NCollection_BaseCollection.hxx +++ b/src/NCollection/NCollection_BaseCollection.hxx @@ -7,6 +7,7 @@ #define NCollection_BaseCollection_HeaderFile #include +#include /** * Purpose: NCollection_BaseCollection is the base abstract class for @@ -45,6 +46,9 @@ template 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) {} diff --git a/src/NCollection/NCollection_BaseList.hxx b/src/NCollection/NCollection_BaseList.hxx index 0349cf1ddf..3bd0a442bc 100755 --- a/src/NCollection/NCollection_BaseList.hxx +++ b/src/NCollection/NCollection_BaseList.hxx @@ -20,11 +20,6 @@ #include #include -#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); diff --git a/src/NCollection/NCollection_BaseMap.hxx b/src/NCollection/NCollection_BaseMap.hxx index 6e5c423568..42d9acadc7 100755 --- a/src/NCollection/NCollection_BaseMap.hxx +++ b/src/NCollection/NCollection_BaseMap.hxx @@ -16,11 +16,6 @@ #include #include -//#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); diff --git a/src/NCollection/NCollection_CellFilter.hxx b/src/NCollection/NCollection_CellFilter.hxx index 8dee445f7b..c5273f82f2 100755 --- a/src/NCollection/NCollection_CellFilter.hxx +++ b/src/NCollection/NCollection_CellFilter.hxx @@ -11,12 +11,7 @@ #include #include #include - -// 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 //! Auxiliary enumeration serving as responce from method Inspect enum NCollection_CellFilter_Action @@ -109,8 +104,8 @@ template 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: diff --git a/src/NCollection/NCollection_DataMap.hxx b/src/NCollection/NCollection_DataMap.hxx index 97a051b387..2163c6c861 100755 --- a/src/NCollection/NCollection_DataMap.hxx +++ b/src/NCollection/NCollection_DataMap.hxx @@ -15,12 +15,6 @@ #include #include -#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 index 0000000000..22488c8953 --- /dev/null +++ b/src/NCollection/NCollection_DefineAlloc.hxx @@ -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 diff --git a/src/NCollection/NCollection_DefineArray1.hxx b/src/NCollection/NCollection_DefineArray1.hxx index e05110e2e1..29136a10b4 100755 --- a/src/NCollection/NCollection_DefineArray1.hxx +++ b/src/NCollection/NCollection_DefineArray1.hxx @@ -39,11 +39,6 @@ #include #include -#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) \ diff --git a/src/NCollection/NCollection_DefineArray2.hxx b/src/NCollection/NCollection_DefineArray2.hxx index 34a3f68f7b..2d311690cc 100755 --- a/src/NCollection/NCollection_DefineArray2.hxx +++ b/src/NCollection/NCollection_DefineArray2.hxx @@ -23,11 +23,6 @@ #include #include -#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) \ diff --git a/src/NCollection/NCollection_DefineDataMap.hxx b/src/NCollection/NCollection_DefineDataMap.hxx index 09a9ff26c7..9882cf4b3f 100755 --- a/src/NCollection/NCollection_DefineDataMap.hxx +++ b/src/NCollection/NCollection_DefineDataMap.hxx @@ -26,11 +26,6 @@ #include #include -#ifdef WNT -// Disable the warning "operator new unmatched by delete" -#pragma warning (disable:4291) -#endif - // *********************************************** Class DataMap ************* #define DEFINE_DATAMAP(_ClassName_, _BaseCollection_, TheKeyType, TheItemType) \ diff --git a/src/NCollection/NCollection_DefineDoubleMap.hxx b/src/NCollection/NCollection_DefineDoubleMap.hxx index a694939542..8ae067bccd 100755 --- a/src/NCollection/NCollection_DefineDoubleMap.hxx +++ b/src/NCollection/NCollection_DefineDoubleMap.hxx @@ -16,11 +16,6 @@ #include #include -#ifdef WNT -// Disable the warning "operator new unmatched by delete" -#pragma warning (disable:4291) -#endif - // *********************************************** Class DoubleMap ************ #define DEFINE_DOUBLEMAP(_ClassName_, _BaseCollection_, TheKey1Type, TheKey2Type) \ diff --git a/src/NCollection/NCollection_DefineIndexedDataMap.hxx b/src/NCollection/NCollection_DefineIndexedDataMap.hxx index aa8a604821..ae3a8b0a04 100755 --- a/src/NCollection/NCollection_DefineIndexedDataMap.hxx +++ b/src/NCollection/NCollection_DefineIndexedDataMap.hxx @@ -27,11 +27,6 @@ #include #include -#ifdef WNT -// Disable the warning "operator new unmatched by delete" -#pragma warning (disable:4291) -#endif - // *********************************************** Class IndexedDataMap ****** #define DEFINE_INDEXEDDATAMAP(_ClassName_, _BaseCollection_, TheKeyType, TheItemType) \ diff --git a/src/NCollection/NCollection_DefineIndexedMap.hxx b/src/NCollection/NCollection_DefineIndexedMap.hxx index bfeb3b05f1..e13a77d8d2 100755 --- a/src/NCollection/NCollection_DefineIndexedMap.hxx +++ b/src/NCollection/NCollection_DefineIndexedMap.hxx @@ -19,11 +19,6 @@ #include #include -#ifdef WNT -// Disable the warning "operator new unmatched by delete" -#pragma warning (disable:4291) -#endif - // *********************************************** Class IndexedMap *********** #define DEFINE_INDEXEDMAP(_ClassName_, _BaseCollection_, TheKeyType) \ diff --git a/src/NCollection/NCollection_DefineList.hxx b/src/NCollection/NCollection_DefineList.hxx index e01254c507..c2017c6bb6 100755 --- a/src/NCollection/NCollection_DefineList.hxx +++ b/src/NCollection/NCollection_DefineList.hxx @@ -16,11 +16,6 @@ #include -#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) \ diff --git a/src/NCollection/NCollection_DefineMap.hxx b/src/NCollection/NCollection_DefineMap.hxx index e229243798..98fceb9b60 100755 --- a/src/NCollection/NCollection_DefineMap.hxx +++ b/src/NCollection/NCollection_DefineMap.hxx @@ -36,11 +36,6 @@ #include #include -#ifdef WNT -// Disable the warning "operator new unmatched by delete" -#pragma warning (disable:4291) -#endif - // *********************************************** Class Map ***************** #define DEFINE_MAP(_ClassName_, _BaseCollection_, TheKeyType) \ diff --git a/src/NCollection/NCollection_DefineQueue.hxx b/src/NCollection/NCollection_DefineQueue.hxx index 5ddd0a0416..c04adf5c8c 100755 --- a/src/NCollection/NCollection_DefineQueue.hxx +++ b/src/NCollection/NCollection_DefineQueue.hxx @@ -18,11 +18,6 @@ #include -#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) \ diff --git a/src/NCollection/NCollection_DefineSList.hxx b/src/NCollection/NCollection_DefineSList.hxx index 7686a7213c..1e4ecbd721 100755 --- a/src/NCollection/NCollection_DefineSList.hxx +++ b/src/NCollection/NCollection_DefineSList.hxx @@ -43,11 +43,6 @@ #include #include -#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) \ diff --git a/src/NCollection/NCollection_DefineSequence.hxx b/src/NCollection/NCollection_DefineSequence.hxx index d83c391e6f..ca44be1c70 100755 --- a/src/NCollection/NCollection_DefineSequence.hxx +++ b/src/NCollection/NCollection_DefineSequence.hxx @@ -15,11 +15,6 @@ #include #include -#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) \ diff --git a/src/NCollection/NCollection_DefineSet.hxx b/src/NCollection/NCollection_DefineSet.hxx index def7443430..9bac2ac00b 100755 --- a/src/NCollection/NCollection_DefineSet.hxx +++ b/src/NCollection/NCollection_DefineSet.hxx @@ -18,11 +18,6 @@ #include #include -#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) \ diff --git a/src/NCollection/NCollection_DefineStack.hxx b/src/NCollection/NCollection_DefineStack.hxx index 8c5c6775ed..d7cef0baae 100755 --- a/src/NCollection/NCollection_DefineStack.hxx +++ b/src/NCollection/NCollection_DefineStack.hxx @@ -19,11 +19,6 @@ #include #include -#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) \ diff --git a/src/NCollection/NCollection_DefineTListIterator.hxx b/src/NCollection/NCollection_DefineTListIterator.hxx index 92b24414d4..147ff58e6a 100755 --- a/src/NCollection/NCollection_DefineTListIterator.hxx +++ b/src/NCollection/NCollection_DefineTListIterator.hxx @@ -14,11 +14,6 @@ #include #include -#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 _ClassName_; diff --git a/src/NCollection/NCollection_DefineTListNode.hxx b/src/NCollection/NCollection_DefineTListNode.hxx index 0ee8721396..73a2b51891 100755 --- a/src/NCollection/NCollection_DefineTListNode.hxx +++ b/src/NCollection/NCollection_DefineTListNode.hxx @@ -12,11 +12,6 @@ #include -#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 _ClassName_; diff --git a/src/NCollection/NCollection_DefineVector.hxx b/src/NCollection/NCollection_DefineVector.hxx index 4a653635b9..829190e48b 100755 --- a/src/NCollection/NCollection_DefineVector.hxx +++ b/src/NCollection/NCollection_DefineVector.hxx @@ -11,11 +11,6 @@ #include #include -#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 diff --git a/src/NCollection/NCollection_DoubleMap.hxx b/src/NCollection/NCollection_DoubleMap.hxx index 4b85c6f45a..4266e78379 100755 --- a/src/NCollection/NCollection_DoubleMap.hxx +++ b/src/NCollection/NCollection_DoubleMap.hxx @@ -17,12 +17,6 @@ #include -#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 diff --git a/src/NCollection/NCollection_IndexedDataMap.hxx b/src/NCollection/NCollection_IndexedDataMap.hxx index 0eb09ed769..8068fb7d0c 100755 --- a/src/NCollection/NCollection_IndexedDataMap.hxx +++ b/src/NCollection/NCollection_IndexedDataMap.hxx @@ -18,12 +18,6 @@ #include #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 diff --git a/src/NCollection/NCollection_IndexedMap.hxx b/src/NCollection/NCollection_IndexedMap.hxx index 1a53813b6a..79fd5c9716 100755 --- a/src/NCollection/NCollection_IndexedMap.hxx +++ b/src/NCollection/NCollection_IndexedMap.hxx @@ -18,12 +18,6 @@ #include #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 diff --git a/src/NCollection/NCollection_List.hxx b/src/NCollection/NCollection_List.hxx index 1a02ed648f..c6b38d85e0 100755 --- a/src/NCollection/NCollection_List.hxx +++ b/src/NCollection/NCollection_List.hxx @@ -13,12 +13,6 @@ #include #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 NCollection_List } }; -#ifdef WNT -#pragma warning (pop) -#endif - #endif diff --git a/src/NCollection/NCollection_ListNode.hxx b/src/NCollection/NCollection_ListNode.hxx index fd57bec06b..d27d93a617 100755 --- a/src/NCollection/NCollection_ListNode.hxx +++ b/src/NCollection/NCollection_ListNode.hxx @@ -8,11 +8,6 @@ #include -#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. diff --git a/src/NCollection/NCollection_Map.hxx b/src/NCollection/NCollection_Map.hxx index a7a3a076a7..91388e711e 100755 --- a/src/NCollection/NCollection_Map.hxx +++ b/src/NCollection/NCollection_Map.hxx @@ -18,12 +18,6 @@ #include #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 diff --git a/src/NCollection/NCollection_Queue.hxx b/src/NCollection/NCollection_Queue.hxx index 2e009c6a64..c50ae78a8e 100755 --- a/src/NCollection/NCollection_Queue.hxx +++ b/src/NCollection/NCollection_Queue.hxx @@ -13,11 +13,6 @@ #include #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 NCollection_Queue }; -#ifdef WNT -#pragma warning (default:4291) -#endif - #endif diff --git a/src/NCollection/NCollection_SList.hxx b/src/NCollection/NCollection_SList.hxx index 1954c0ed33..25b11948ac 100755 --- a/src/NCollection/NCollection_SList.hxx +++ b/src/NCollection/NCollection_SList.hxx @@ -12,11 +12,6 @@ #include #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 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 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 NCollection_SList friend class SListNode; }; -#ifdef WNT -#pragma warning (default:4291) -#endif - #endif diff --git a/src/NCollection/NCollection_Sequence.hxx b/src/NCollection/NCollection_Sequence.hxx index a26a58aeb1..3693ad2f25 100755 --- a/src/NCollection/NCollection_Sequence.hxx +++ b/src/NCollection/NCollection_Sequence.hxx @@ -14,12 +14,6 @@ #include #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 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 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 NCollection_Sequence }; -#ifdef WNT -#pragma warning (pop) -#endif - #endif diff --git a/src/NCollection/NCollection_Set.hxx b/src/NCollection/NCollection_Set.hxx index 100434f382..3ff557425d 100755 --- a/src/NCollection/NCollection_Set.hxx +++ b/src/NCollection/NCollection_Set.hxx @@ -12,11 +12,6 @@ #include #include -#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 NCollection_Set }; -#ifdef WNT -#pragma warning (default:4291) -#endif - #endif diff --git a/src/NCollection/NCollection_SparseArray.hxx b/src/NCollection/NCollection_SparseArray.hxx index 456481ba28..35640f0914 100755 --- a/src/NCollection/NCollection_SparseArray.hxx +++ b/src/NCollection/NCollection_SparseArray.hxx @@ -8,12 +8,6 @@ #include -#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 diff --git a/src/NCollection/NCollection_Stack.hxx b/src/NCollection/NCollection_Stack.hxx index 06e616d99f..a18fce23b6 100755 --- a/src/NCollection/NCollection_Stack.hxx +++ b/src/NCollection/NCollection_Stack.hxx @@ -15,11 +15,6 @@ #include #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 NCollection_Stack }; -#ifdef WNT -#pragma warning (default:4291) -#endif - #endif diff --git a/src/NCollection/NCollection_TListIterator.hxx b/src/NCollection/NCollection_TListIterator.hxx index e5b0964381..6e8de8925b 100755 --- a/src/NCollection/NCollection_TListIterator.hxx +++ b/src/NCollection/NCollection_TListIterator.hxx @@ -10,12 +10,6 @@ #include #include -#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 NCollection_TListIterator //! Variable Value access virtual TheItemType& ChangeValue (void) const { return ((NCollection_TListNode *)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 diff --git a/src/NCollection/NCollection_TListNode.hxx b/src/NCollection/NCollection_TListNode.hxx index ddaa93b6d3..05bfeb2578 100755 --- a/src/NCollection/NCollection_TListNode.hxx +++ b/src/NCollection/NCollection_TListNode.hxx @@ -8,12 +8,7 @@ #include #include - -#ifdef WNT -// Disable the warning "operator new unmatched by delete" -#pragma warning (push) -#pragma warning (disable:4291) -#endif +#include /** * Purpose: Abstract list node class. Used by BaseList @@ -32,9 +27,8 @@ template 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 NCollection_TListNode }; -#ifdef WNT -#pragma warning (pop) -#endif - #endif diff --git a/src/NCollection/NCollection_UBTree.hxx b/src/NCollection/NCollection_UBTree.hxx index f4e7545d2f..e959121b8b 100755 --- a/src/NCollection/NCollection_UBTree.hxx +++ b/src/NCollection/NCollection_UBTree.hxx @@ -7,12 +7,7 @@ #define NCollection_UBTree_HeaderFile #include - -#ifdef WNT -// Disable the warning: "operator new unmatched by delete" -#pragma warning (push) -#pragma warning (disable:4291) -#endif +#include /** * The algorithm of unbalanced binary tree of overlapped bounding boxes. @@ -116,6 +111,10 @@ template 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 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 diff --git a/src/NCollection/NCollection_Vector.hxx b/src/NCollection/NCollection_Vector.hxx index d18f669ab6..8cbbda4260 100755 --- a/src/NCollection/NCollection_Vector.hxx +++ b/src/NCollection/NCollection_Vector.hxx @@ -14,12 +14,6 @@ #include #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 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 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 NCollection_Vector friend class Iterator; }; -#ifdef WNT -#pragma warning (pop) -#endif - #endif diff --git a/src/NIS/NIS_Drawer.hxx b/src/NIS/NIS_Drawer.hxx index 81d8f18ae2..9f6e2af443 100755 --- a/src/NIS/NIS_Drawer.hxx +++ b/src/NIS/NIS_Drawer.hxx @@ -15,8 +15,8 @@ #include #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 diff --git a/src/NIS/NIS_Triangulated.hxx b/src/NIS/NIS_Triangulated.hxx index 02bc9b2975..c8be420a3a 100755 --- a/src/NIS/NIS_Triangulated.hxx +++ b/src/NIS/NIS_Triangulated.hxx @@ -10,12 +10,6 @@ #include #include -#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 diff --git a/src/OpenGl/OpenGl_AspectFace.hxx b/src/OpenGl/OpenGl_AspectFace.hxx index 3dae10ac97..736b32ba45 100644 --- a/src/OpenGl/OpenGl_AspectFace.hxx +++ b/src/OpenGl/OpenGl_AspectFace.hxx @@ -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 @@ -67,7 +67,7 @@ class OpenGl_AspectFace : public OpenGl_Element OpenGl_AspectLine myAspectEdge; public: - IMPLEMENT_MEMORY_OPERATORS + DEFINE_STANDARD_ALLOC }; #endif //_OpenGl_AspectFace_Header diff --git a/src/OpenGl/OpenGl_AspectLine.hxx b/src/OpenGl/OpenGl_AspectLine.hxx index 2e820ec8dc..7eac3eae50 100644 --- a/src/OpenGl/OpenGl_AspectLine.hxx +++ b/src/OpenGl/OpenGl_AspectLine.hxx @@ -34,7 +34,7 @@ class OpenGl_AspectLine : public OpenGl_Element float myWidth; public: - IMPLEMENT_MEMORY_OPERATORS + DEFINE_STANDARD_ALLOC }; #endif //_OpenGl_AspectLine_Header diff --git a/src/OpenGl/OpenGl_AspectMarker.hxx b/src/OpenGl/OpenGl_AspectMarker.hxx index 56136673ab..29cb534670 100644 --- a/src/OpenGl/OpenGl_AspectMarker.hxx +++ b/src/OpenGl/OpenGl_AspectMarker.hxx @@ -33,7 +33,7 @@ class OpenGl_AspectMarker : public OpenGl_Element float myScale; public: - IMPLEMENT_MEMORY_OPERATORS + DEFINE_STANDARD_ALLOC }; #endif //OpenGl_AspectMarker_Header diff --git a/src/OpenGl/OpenGl_AspectText.hxx b/src/OpenGl/OpenGl_AspectText.hxx index 516d27866d..a3e4d8aaa4 100644 --- a/src/OpenGl/OpenGl_AspectText.hxx +++ b/src/OpenGl/OpenGl_AspectText.hxx @@ -49,7 +49,7 @@ class OpenGl_AspectText : public OpenGl_Element TEL_COLOUR mySubtitleColor; public: - IMPLEMENT_MEMORY_OPERATORS + DEFINE_STANDARD_ALLOC }; #endif //OpenGl_AspectText_Header diff --git a/src/OpenGl/OpenGl_CView.hxx b/src/OpenGl/OpenGl_CView.hxx index 04c29a088f..a417d28543 100644 --- a/src/OpenGl/OpenGl_CView.hxx +++ b/src/OpenGl/OpenGl_CView.hxx @@ -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 diff --git a/src/OpenGl/OpenGl_Display.hxx b/src/OpenGl/OpenGl_Display.hxx index 81862837ec..131ea914d4 100644 --- a/src/OpenGl/OpenGl_Display.hxx +++ b/src/OpenGl/OpenGl_Display.hxx @@ -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 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; diff --git a/src/OpenGl/OpenGl_Element.hxx b/src/OpenGl/OpenGl_Element.hxx index e10510e085..763d2621c9 100644 --- a/src/OpenGl/OpenGl_Element.hxx +++ b/src/OpenGl/OpenGl_Element.hxx @@ -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 diff --git a/src/OpenGl/OpenGl_GraduatedTrihedron.hxx b/src/OpenGl/OpenGl_GraduatedTrihedron.hxx index 00dfbce1a9..b44ae1dd59 100644 --- a/src/OpenGl/OpenGl_GraduatedTrihedron.hxx +++ b/src/OpenGl/OpenGl_GraduatedTrihedron.hxx @@ -58,7 +58,7 @@ class OpenGl_GraduatedTrihedron : public MMgt_TShared void* myPtrVisual3dView; public: - IMPLEMENT_MEMORY_OPERATORS + DEFINE_STANDARD_ALLOC }; #endif //_OpenGl_GraduatedTrihedron_Header diff --git a/src/OpenGl/OpenGl_Group.hxx b/src/OpenGl/OpenGl_Group.hxx index 65b44833cb..5e0187dd50 100644 --- a/src/OpenGl/OpenGl_Group.hxx +++ b/src/OpenGl/OpenGl_Group.hxx @@ -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 diff --git a/src/OpenGl/OpenGl_Light.hxx b/src/OpenGl/OpenGl_Light.hxx index b4bec031e7..f264955a20 100644 --- a/src/OpenGl/OpenGl_Light.hxx +++ b/src/OpenGl/OpenGl_Light.hxx @@ -22,7 +22,7 @@ struct OpenGl_Light Tfloat shine; Tfloat atten[2]; Tfloat angle; - IMPLEMENT_MEMORY_OPERATORS + DEFINE_STANDARD_ALLOC }; typedef NCollection_List OpenGl_ListOfLight; diff --git a/src/OpenGl/OpenGl_Marker.hxx b/src/OpenGl/OpenGl_Marker.hxx index 036028e86f..242cb62968 100644 --- a/src/OpenGl/OpenGl_Marker.hxx +++ b/src/OpenGl/OpenGl_Marker.hxx @@ -24,7 +24,7 @@ class OpenGl_Marker : public OpenGl_Element TEL_POINT myPoint; public: - IMPLEMENT_MEMORY_OPERATORS + DEFINE_STANDARD_ALLOC }; #endif //OpenGl_Marker_Header diff --git a/src/OpenGl/OpenGl_MarkerSet.hxx b/src/OpenGl/OpenGl_MarkerSet.hxx index c7425dc1f2..8d03ba9d5a 100644 --- a/src/OpenGl/OpenGl_MarkerSet.hxx +++ b/src/OpenGl/OpenGl_MarkerSet.hxx @@ -27,7 +27,7 @@ class OpenGl_MarkerSet : public OpenGl_Element TEL_POINT *myPoints; public: - IMPLEMENT_MEMORY_OPERATORS + DEFINE_STANDARD_ALLOC }; #endif //OpenGl_MarkerSet_Header diff --git a/src/OpenGl/OpenGl_Matrix.hxx b/src/OpenGl/OpenGl_Matrix.hxx index 48caf79d0a..524f2fbf68 100644 --- a/src/OpenGl/OpenGl_Matrix.hxx +++ b/src/OpenGl/OpenGl_Matrix.hxx @@ -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); diff --git a/src/OpenGl/OpenGl_Mesh.hxx b/src/OpenGl/OpenGl_Mesh.hxx index 69157e2908..061deba990 100644 --- a/src/OpenGl/OpenGl_Mesh.hxx +++ b/src/OpenGl/OpenGl_Mesh.hxx @@ -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 diff --git a/src/OpenGl/OpenGl_Polygon.cxx b/src/OpenGl/OpenGl_Polygon.cxx index 2fce78863a..cfbaca3e84 100644 --- a/src/OpenGl/OpenGl_Polygon.cxx +++ b/src/OpenGl/OpenGl_Polygon.cxx @@ -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*)() ); diff --git a/src/OpenGl/OpenGl_Polygon.hxx b/src/OpenGl/OpenGl_Polygon.hxx index c5089a7758..7ece703a66 100644 --- a/src/OpenGl/OpenGl_Polygon.hxx +++ b/src/OpenGl/OpenGl_Polygon.hxx @@ -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 diff --git a/src/OpenGl/OpenGl_Polyline.hxx b/src/OpenGl/OpenGl_Polyline.hxx index 72b5f3f3d9..677c20f6fc 100644 --- a/src/OpenGl/OpenGl_Polyline.hxx +++ b/src/OpenGl/OpenGl_Polyline.hxx @@ -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 diff --git a/src/OpenGl/OpenGl_PrimitiveArray.hxx b/src/OpenGl/OpenGl_PrimitiveArray.hxx index 2fb036f925..25dcefdb09 100644 --- a/src/OpenGl/OpenGl_PrimitiveArray.hxx +++ b/src/OpenGl/OpenGl_PrimitiveArray.hxx @@ -79,7 +79,7 @@ protected: public: - IMPLEMENT_MEMORY_OPERATORS + DEFINE_STANDARD_ALLOC }; diff --git a/src/OpenGl/OpenGl_PriorityList.hxx b/src/OpenGl/OpenGl_PriorityList.hxx index 2928ea309e..a6e88e0898 100644 --- a/src/OpenGl/OpenGl_PriorityList.hxx +++ b/src/OpenGl/OpenGl_PriorityList.hxx @@ -49,7 +49,7 @@ class OpenGl_PriorityList Standard_Integer myNbStructures; public: - IMPLEMENT_MEMORY_OPERATORS + DEFINE_STANDARD_ALLOC }; #endif //_OpenGl_PriorityList_Header diff --git a/src/OpenGl/OpenGl_QuadrangleStrip.hxx b/src/OpenGl/OpenGl_QuadrangleStrip.hxx index 9c7d5b8a74..0dd058e85a 100644 --- a/src/OpenGl/OpenGl_QuadrangleStrip.hxx +++ b/src/OpenGl/OpenGl_QuadrangleStrip.hxx @@ -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 diff --git a/src/OpenGl/OpenGl_Structure.hxx b/src/OpenGl/OpenGl_Structure.hxx index c1f3228722..23d254e5ab 100644 --- a/src/OpenGl/OpenGl_Structure.hxx +++ b/src/OpenGl/OpenGl_Structure.hxx @@ -83,7 +83,7 @@ class OpenGl_Structure : public OpenGl_Element OpenGl_ListOfGroup myGroups; public: - IMPLEMENT_MEMORY_OPERATORS + DEFINE_STANDARD_ALLOC }; #endif //OpenGl_Structure_Header diff --git a/src/OpenGl/OpenGl_Text.hxx b/src/OpenGl/OpenGl_Text.hxx index 614d8beac1..4191b9867d 100644 --- a/src/OpenGl/OpenGl_Text.hxx +++ b/src/OpenGl/OpenGl_Text.hxx @@ -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 diff --git a/src/OpenGl/OpenGl_TextParam.hxx b/src/OpenGl/OpenGl_TextParam.hxx index 10e1e14dd6..ba99adcdc3 100644 --- a/src/OpenGl/OpenGl_TextParam.hxx +++ b/src/OpenGl/OpenGl_TextParam.hxx @@ -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 diff --git a/src/OpenGl/OpenGl_TextureBox.cxx b/src/OpenGl/OpenGl_TextureBox.cxx index e4493b56e5..d33264bc1c 100755 --- a/src/OpenGl/OpenGl_TextureBox.cxx +++ b/src/OpenGl/OpenGl_TextureBox.cxx @@ -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 }; diff --git a/src/OpenGl/OpenGl_TextureBox.hxx b/src/OpenGl/OpenGl_TextureBox.hxx index 2095783c90..8eb465c9f9 100755 --- a/src/OpenGl/OpenGl_TextureBox.hxx +++ b/src/OpenGl/OpenGl_TextureBox.hxx @@ -48,6 +48,7 @@ */ #include +#include #include @@ -76,7 +77,7 @@ struct _TextureData GLfloat scalex, scaley; GLfloat transx, transy; GLfloat angle; - IMPLEMENT_MEMORY_OPERATORS + DEFINE_STANDARD_ALLOC }; typedef _TextureData TextureData; diff --git a/src/OpenGl/OpenGl_TriangleStrip.hxx b/src/OpenGl/OpenGl_TriangleStrip.hxx index 78bede7bd2..7bf2df6f4a 100644 --- a/src/OpenGl/OpenGl_TriangleStrip.hxx +++ b/src/OpenGl/OpenGl_TriangleStrip.hxx @@ -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 diff --git a/src/OpenGl/OpenGl_Trihedron.hxx b/src/OpenGl/OpenGl_Trihedron.hxx index f1d6930ebe..cda9cd8178 100644 --- a/src/OpenGl/OpenGl_Trihedron.hxx +++ b/src/OpenGl/OpenGl_Trihedron.hxx @@ -49,7 +49,7 @@ class OpenGl_Trihedron : public MMgt_TShared OpenGl_AspectText myAspectText; public: - IMPLEMENT_MEMORY_OPERATORS + DEFINE_STANDARD_ALLOC }; #endif //_OpenGl_Trihedron_Header diff --git a/src/OpenGl/OpenGl_View.hxx b/src/OpenGl/OpenGl_View.hxx index ff86022c5c..37782e5639 100644 --- a/src/OpenGl/OpenGl_View.hxx +++ b/src/OpenGl/OpenGl_View.hxx @@ -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 diff --git a/src/OpenGl/OpenGl_View_2.cxx b/src/OpenGl/OpenGl_View_2.cxx index e90dc422b3..3a7022db11 100644 --- a/src/OpenGl/OpenGl_View_2.cxx +++ b/src/OpenGl/OpenGl_View_2.cxx @@ -59,7 +59,7 @@ struct OPENGL_CLIP_PLANE { GLboolean isEnabled; GLdouble Equation[4]; - IMPLEMENT_MEMORY_OPERATORS + DEFINE_STANDARD_ALLOC }; /*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_Window.hxx b/src/OpenGl/OpenGl_Window.hxx index 3e80d21695..c75d625285 100644 --- a/src/OpenGl/OpenGl_Window.hxx +++ b/src/OpenGl/OpenGl_Window.hxx @@ -99,7 +99,7 @@ protected: public: DEFINE_STANDARD_RTTI(OpenGl_Window) // Type definition - IMPLEMENT_MEMORY_OPERATORS + DEFINE_STANDARD_ALLOC }; diff --git a/src/OpenGl/OpenGl_Workspace.hxx b/src/OpenGl/OpenGl_Workspace.hxx index f346168938..fe2a4ed02b 100644 --- a/src/OpenGl/OpenGl_Workspace.hxx +++ b/src/OpenGl/OpenGl_Workspace.hxx @@ -217,7 +217,7 @@ protected: public: DEFINE_STANDARD_RTTI(OpenGl_Workspace) // Type definition - IMPLEMENT_MEMORY_OPERATORS + DEFINE_STANDARD_ALLOC }; diff --git a/src/Poly/Poly_CoherentNode.cxx b/src/Poly/Poly_CoherentNode.cxx index 3a4716976b..c9d7a7bd2b 100755 --- a/src/Poly/Poly_CoherentNode.cxx +++ b/src/Poly/Poly_CoherentNode.cxx @@ -8,7 +8,7 @@ #include #ifdef WNT -#pragma warning(disable:4291 4996) +#pragma warning(disable:4996) #endif //======================================================================= diff --git a/src/Poly/Poly_CoherentTriPtr.cxx b/src/Poly/Poly_CoherentTriPtr.cxx index 642e67ea47..d5d15d651f 100755 --- a/src/Poly/Poly_CoherentTriPtr.cxx +++ b/src/Poly/Poly_CoherentTriPtr.cxx @@ -6,10 +6,6 @@ #include -#ifdef WNT -#pragma warning(disable:4291) -#endif - //======================================================================= //function : Iterator::Next //purpose : diff --git a/src/Poly/Poly_CoherentTriPtr.hxx b/src/Poly/Poly_CoherentTriPtr.hxx index 69706ffc40..4be0f8636e 100755 --- a/src/Poly/Poly_CoherentTriPtr.hxx +++ b/src/Poly/Poly_CoherentTriPtr.hxx @@ -8,12 +8,13 @@ #define Poly_CoherentTriPtr_HeaderFile #include +#include 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. diff --git a/src/Poly/Poly_Connect.cxx b/src/Poly/Poly_Connect.cxx index 49999fa939..7d5267ca4a 100755 --- a/src/Poly/Poly_Connect.cxx +++ b/src/Poly/Poly_Connect.cxx @@ -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) : diff --git a/src/Standard/FILES b/src/Standard/FILES index 7ade12e486..e72a0ce7ae 100755 --- a/src/Standard/FILES +++ b/src/Standard/FILES @@ -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 diff --git a/src/Standard/Handle_Standard_Persistent.hxx b/src/Standard/Handle_Standard_Persistent.hxx index f826d61300..015ad8e17c 100755 --- a/src/Standard/Handle_Standard_Persistent.hxx +++ b/src/Standard/Handle_Standard_Persistent.hxx @@ -8,6 +8,9 @@ #ifndef _Handle_Standard_Persistent_HeaderFile #define _Handle_Standard_Persistent_HeaderFile +#ifndef _Standard_DefineAlloc_HeaderFile +#include +#endif #ifndef _Standard_Macro_HeaderFile #include #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)() { diff --git a/src/Standard/Handle_Standard_Transient.hxx b/src/Standard/Handle_Standard_Transient.hxx index 0500103583..2f950a4e2f 100755 --- a/src/Standard/Handle_Standard_Transient.hxx +++ b/src/Standard/Handle_Standard_Transient.hxx @@ -3,6 +3,9 @@ #ifndef _Standard_HeaderFile #include #endif +#ifndef _Standard_DefineAlloc_HeaderFile +#include +#endif #ifndef _Standard_Macro_HeaderFile #include #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 diff --git a/src/Standard/StandardCSFDB.cxx b/src/Standard/StandardCSFDB.cxx index 981daaaadd..e69de29bb2 100755 --- a/src/Standard/StandardCSFDB.cxx +++ b/src/Standard/StandardCSFDB.cxx @@ -1,64 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif -#include -#include -//#include -//#include -#include - -#ifdef HAVE_UNISTD_H -# include -#endif - -#ifdef HAVE_STRING_H -# include -#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 -# include -#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 index 0000000000..8d33bc3778 --- /dev/null +++ b/src/Standard/Standard_DefineAlloc.hxx @@ -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 diff --git a/src/Standard/Standard_Macro.hxx b/src/Standard/Standard_Macro.hxx index fce21502d2..259d30440a 100755 --- a/src/Standard/Standard_Macro.hxx +++ b/src/Standard/Standard_Macro.hxx @@ -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_() //====================================================== diff --git a/src/Standard/Standard_Persistent_proto.hxx b/src/Standard/Standard_Persistent_proto.hxx index cc8e687087..89ab6a0117 100755 --- a/src/Standard/Standard_Persistent_proto.hxx +++ b/src/Standard/Standard_Persistent_proto.hxx @@ -4,6 +4,9 @@ #ifndef _Standard_Macro_HeaderFile #include #endif +#ifndef _Standard_DefineAlloc_HeaderFile +#include +#endif #ifndef _Standard_PrimitiveTypes_HeaderFile #include #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); - } + + DEFINE_STANDARD_ALLOC - void operator delete (void* p) { - StandardCSFDB_Free(p); - } - - void* operator new(size_t,void* anAddress) { - return anAddress; - } - Standard_EXPORT virtual Handle_Standard_Persistent This() const; Standard_EXPORT virtual Handle_Standard_Persistent ShallowCopy () const; Standard_EXPORT virtual void Delete() const; diff --git a/src/Standard/Standard_Transient_proto.hxx b/src/Standard/Standard_Transient_proto.hxx index 37691716fb..685a5e0385 100755 --- a/src/Standard/Standard_Transient_proto.hxx +++ b/src/Standard/Standard_Transient_proto.hxx @@ -1,6 +1,9 @@ #ifndef _Standard_Transient_proto_HeaderFile #define _Standard_Transient_proto_HeaderFile +#ifndef _Standard_DefineAlloc_HeaderFile +#include +#endif #ifndef _Standard_Macro_HeaderFile #include #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) {} diff --git a/src/Standard/Standard_TypeDef.hxx b/src/Standard/Standard_TypeDef.hxx index 1a599e078c..b91fa24d23 100755 --- a/src/Standard/Standard_TypeDef.hxx +++ b/src/Standard/Standard_TypeDef.hxx @@ -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 diff --git a/src/Storage/Storage_BucketOfPersistent.hxx b/src/Storage/Storage_BucketOfPersistent.hxx index dfe9ef019b..1c38d29876 100755 --- a/src/Storage/Storage_BucketOfPersistent.hxx +++ b/src/Storage/Storage_BucketOfPersistent.hxx @@ -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(); diff --git a/src/Storage/Storage_Schema.cxx b/src/Storage/Storage_Schema.cxx index dccb60dfc0..116e729f49 100755 --- a/src/Storage/Storage_Schema.cxx +++ b/src/Storage/Storage_Schema.cxx @@ -52,16 +52,11 @@ typedef NCollection_DataMap 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; } diff --git a/src/TColStd/TColStd_PackedMapOfInteger.hxx b/src/TColStd/TColStd_PackedMapOfInteger.hxx index 5cd9c7f55d..a2df411c47 100755 --- a/src/TColStd/TColStd_PackedMapOfInteger.hxx +++ b/src/TColStd/TColStd_PackedMapOfInteger.hxx @@ -7,6 +7,7 @@ #ifndef TColStd_PackedMapOfInteger_HeaderFile #define TColStd_PackedMapOfInteger_HeaderFile +#include #include /** @@ -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 ---------- diff --git a/src/TDF/TDF_Data.cxx b/src/TDF/TDF_Data.cxx index 88fee662a5..5943d23275 100755 --- a/src/TDF/TDF_Data.cxx +++ b/src/TDF/TDF_Data.cxx @@ -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 ~. diff --git a/src/TDF/TDF_Label.cxx b/src/TDF/TDF_Label.cxx index b0075be2fa..8e7f7a25ae 100755 --- a/src/TDF/TDF_Label.cxx +++ b/src/TDF/TDF_Label.cxx @@ -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 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. diff --git a/src/TDF/TDF_LabelNode.hxx b/src/TDF/TDF_LabelNode.hxx index 5293a8ad04..581c834466 100755 --- a/src/TDF/TDF_LabelNode.hxx +++ b/src/TDF/TDF_LabelNode.hxx @@ -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 diff --git a/src/TNaming/TNaming_NamedShape.cxx b/src/TNaming/TNaming_NamedShape.cxx index d82752df0b..e4f002bd5e 100755 --- a/src/TNaming/TNaming_NamedShape.cxx +++ b/src/TNaming/TNaming_NamedShape.cxx @@ -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; diff --git a/src/VoxelClient/VoxelClient_VisDrawer.cxx b/src/VoxelClient/VoxelClient_VisDrawer.cxx index faafbbb8e6..a0a795d829 100755 --- a/src/VoxelClient/VoxelClient_VisDrawer.cxx +++ b/src/VoxelClient/VoxelClient_VisDrawer.cxx @@ -35,7 +35,7 @@ private: public: - IMPLEMENT_MEMORY_OPERATORS + DEFINE_STANDARD_ALLOC };