mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-06 06:04:17 +05:00
PAL11544: Improve memory management: implement and use destructors.
This commit is contained in:
parent
0eff916f1c
commit
5d147e239e
@ -33,7 +33,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function :
|
//function : Constructor
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
SMESHDS_Command::SMESHDS_Command(const SMESHDS_CommandType aType):myType(aType),
|
SMESHDS_Command::SMESHDS_Command(const SMESHDS_CommandType aType):myType(aType),
|
||||||
@ -41,6 +41,14 @@ myNumber(0)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Destructor
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
SMESHDS_Command::~SMESHDS_Command()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function :
|
//function :
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -1182,4 +1182,5 @@ void SMESHDS_Mesh::SetMeshElementOnShape(const SMDS_MeshElement* anElement,
|
|||||||
|
|
||||||
SMESHDS_Mesh::~SMESHDS_Mesh()
|
SMESHDS_Mesh::~SMESHDS_Mesh()
|
||||||
{
|
{
|
||||||
|
delete myScript;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,15 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Destructor
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
SMESHDS_Script::~SMESHDS_Script()
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : getCommand
|
//function : getCommand
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -222,7 +231,6 @@ void SMESHDS_Script::ChangePolyhedronNodes (const int ElementID,
|
|||||||
//function : Renumber
|
//function : Renumber
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void SMESHDS_Script::Renumber (const bool isNodes, const int startID, const int deltaID)
|
void SMESHDS_Script::Renumber (const bool isNodes, const int startID, const int deltaID)
|
||||||
{
|
{
|
||||||
getCommand(SMESHDS_Renumber)->Renumber( isNodes, startID, deltaID );
|
getCommand(SMESHDS_Renumber)->Renumber( isNodes, startID, deltaID );
|
||||||
@ -234,7 +242,11 @@ void SMESHDS_Script::Renumber (const bool isNodes, const int startID, const int
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void SMESHDS_Script::Clear()
|
void SMESHDS_Script::Clear()
|
||||||
{
|
{
|
||||||
myCommands.clear();
|
list<SMESHDS_Command*>::iterator anIt = myCommands.begin();
|
||||||
|
for (; anIt != myCommands.end(); anIt++) {
|
||||||
|
delete (*anIt);
|
||||||
|
}
|
||||||
|
myCommands.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -243,5 +255,5 @@ void SMESHDS_Script::Clear()
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
const list<SMESHDS_Command*>& SMESHDS_Script::GetCommands()
|
const list<SMESHDS_Command*>& SMESHDS_Script::GetCommands()
|
||||||
{
|
{
|
||||||
return myCommands;
|
return myCommands;
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,9 @@
|
|||||||
class SMESHDS_Script
|
class SMESHDS_Script
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
SMESHDS_Script() {};
|
||||||
|
~SMESHDS_Script();
|
||||||
|
|
||||||
void AddNode(int NewNodeID, double x, double y, double z);
|
void AddNode(int NewNodeID, double x, double y, double z);
|
||||||
void AddEdge(int NewEdgeID, int idnode1, int idnode2);
|
void AddEdge(int NewEdgeID, int idnode1, int idnode2);
|
||||||
void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3);
|
void AddFace(int NewFaceID, int idnode1, int idnode2, int idnode3);
|
||||||
@ -66,8 +69,7 @@ class SMESHDS_Script
|
|||||||
void Renumber (const bool isNodes, const int startID, const int deltaID);
|
void Renumber (const bool isNodes, const int startID, const int deltaID);
|
||||||
void Clear();
|
void Clear();
|
||||||
const std::list<SMESHDS_Command*> & GetCommands();
|
const std::list<SMESHDS_Command*> & GetCommands();
|
||||||
~SMESHDS_Script();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SMESHDS_Command* getCommand(const SMESHDS_CommandType aType);
|
SMESHDS_Command* getCommand(const SMESHDS_CommandType aType);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user