mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0022815: Missing delete operator for placement new
This commit is contained in:
@@ -79,6 +79,6 @@ NCollection_Comparator.hxx
|
||||
NCollection_QuickSort.hxx
|
||||
|
||||
NCollection_Haft.h
|
||||
NCollection_DefaultHasher.hxx
|
||||
NCollection_DefineAlloc.hxx
|
||||
|
||||
|
||||
NCollection_DefaultHasher.hxx
|
@@ -15,12 +15,6 @@
|
||||
|
||||
#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
|
||||
|
@@ -15,11 +15,6 @@
|
||||
|
||||
#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
|
||||
|
@@ -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) {}
|
||||
|
@@ -20,11 +20,6 @@
|
||||
#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);
|
||||
|
||||
|
@@ -16,11 +16,6 @@
|
||||
#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);
|
||||
|
||||
|
@@ -11,12 +11,7 @@
|
||||
#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:
|
||||
|
||||
|
@@ -15,12 +15,6 @@
|
||||
#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
|
||||
|
||||
|
33
src/NCollection/NCollection_DefineAlloc.hxx
Normal file
33
src/NCollection/NCollection_DefineAlloc.hxx
Normal file
@@ -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
|
@@ -39,11 +39,6 @@
|
||||
#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) \
|
||||
|
@@ -23,11 +23,6 @@
|
||||
#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) \
|
||||
|
@@ -26,11 +26,6 @@
|
||||
#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) \
|
||||
|
@@ -16,11 +16,6 @@
|
||||
#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) \
|
||||
|
@@ -27,11 +27,6 @@
|
||||
#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) \
|
||||
|
@@ -19,11 +19,6 @@
|
||||
#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) \
|
||||
|
@@ -16,11 +16,6 @@
|
||||
|
||||
#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) \
|
||||
|
@@ -36,11 +36,6 @@
|
||||
#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) \
|
||||
|
@@ -18,11 +18,6 @@
|
||||
|
||||
#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) \
|
||||
|
@@ -43,11 +43,6 @@
|
||||
#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) \
|
||||
|
@@ -15,11 +15,6 @@
|
||||
#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) \
|
||||
|
@@ -18,11 +18,6 @@
|
||||
#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) \
|
||||
|
@@ -19,11 +19,6 @@
|
||||
#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) \
|
||||
|
@@ -14,11 +14,6 @@
|
||||
#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_;
|
||||
|
@@ -12,11 +12,6 @@
|
||||
|
||||
#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_;
|
||||
|
@@ -11,11 +11,6 @@
|
||||
#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
|
||||
|
@@ -17,12 +17,6 @@
|
||||
|
||||
#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
|
||||
|
@@ -18,12 +18,6 @@
|
||||
#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
|
||||
|
@@ -18,12 +18,6 @@
|
||||
#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
|
||||
|
@@ -13,12 +13,6 @@
|
||||
#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
|
||||
|
@@ -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.
|
||||
|
@@ -18,12 +18,6 @@
|
||||
#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
|
||||
|
@@ -13,11 +13,6 @@
|
||||
#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
|
||||
|
@@ -12,11 +12,6 @@
|
||||
#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
|
||||
|
@@ -14,12 +14,6 @@
|
||||
#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
|
||||
|
@@ -12,11 +12,6 @@
|
||||
#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
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -15,11 +15,6 @@
|
||||
#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
|
||||
|
@@ -10,12 +10,6 @@
|
||||
#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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -14,12 +14,6 @@
|
||||
#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
|
||||
|
Reference in New Issue
Block a user