1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0025616: Avoid Classes using "new" to allocate Instances but not defining a copy Constructor

The empty copy constructor, assignemnts operator, default constructors added to the following classes:
The following classes use “new” function without Handles:
- Select3D_PointData
- BSB_T3Bits
- IntPatch_InfoPD
- LDOM_StringElem
- BinomAllocator
- ProjLib_OnSurface
- Standard_MMgrFactory

Useless declaration of default constructor have been deleted.
This commit is contained in:
azn
2015-01-15 14:41:27 +03:00
committed by bugmaster
parent c8be748cd4
commit 6a38ff486c
8 changed files with 96 additions and 57 deletions

View File

@@ -46,12 +46,18 @@
// used to construct appropriate memory manager according
// to environment settings, and to ensure destruction upon exit
//=======================================================================
class Standard_MMgrFactory {
public:
Standard_MMgrFactory();
class Standard_MMgrFactory
{
public:
static Standard_MMgrRoot* GetMMgr();
~Standard_MMgrFactory();
public:
private:
Standard_MMgrFactory();
Standard_MMgrFactory (const Standard_MMgrFactory&);
Standard_MMgrFactory& operator= (const Standard_MMgrFactory&);
private:
Standard_MMgrRoot* myFMMgr;
};
@@ -157,11 +163,8 @@ Standard_MMgrFactory::Standard_MMgrFactory()
Standard_MMgrFactory::~Standard_MMgrFactory()
{
if ( myFMMgr ) {
if ( myFMMgr )
myFMMgr->Purge(Standard_True);
// delete myFMMgr;
// myFMMgr = 0;
}
}
//=======================================================================
@@ -205,8 +208,7 @@ Standard_MMgrFactory::~Standard_MMgrFactory()
// be counting calls to Allocate() and Free()...
//
//=======================================================================
static Standard_MMgrRoot* GetMMgr()
Standard_MMgrRoot* Standard_MMgrFactory::GetMMgr()
{
static Standard_MMgrFactory aFactory;
return aFactory.myFMMgr;
@@ -219,7 +221,7 @@ static Standard_MMgrRoot* GetMMgr()
Standard_Address Standard::Allocate(const Standard_Size size)
{
return GetMMgr()->Allocate(size);
return Standard_MMgrFactory::GetMMgr()->Allocate(size);
}
//=======================================================================
@@ -229,7 +231,7 @@ Standard_Address Standard::Allocate(const Standard_Size size)
void Standard::Free (Standard_Address theStorage)
{
GetMMgr()->Free(theStorage);
Standard_MMgrFactory::GetMMgr()->Free(theStorage);
}
//=======================================================================
@@ -240,7 +242,7 @@ void Standard::Free (Standard_Address theStorage)
Standard_Address Standard::Reallocate (Standard_Address theStorage,
const Standard_Size theSize)
{
return GetMMgr()->Reallocate (theStorage, theSize);
return Standard_MMgrFactory::GetMMgr()->Reallocate (theStorage, theSize);
}
//=======================================================================
@@ -250,7 +252,7 @@ Standard_Address Standard::Reallocate (Standard_Address theStorage,
Standard_Integer Standard::Purge()
{
return GetMMgr()->Purge();
return Standard_MMgrFactory::GetMMgr()->Purge();
}
//=======================================================================