mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0025571: Avoid base Classes without virtual Destructors
Destructors of collection classes from NCollection and math_Function are made virtual to allow safe destruction by pointer to base class. Destructors of classes HatchGen_IntersectionPoint, IntCurveSurface_Intersection, Intf_Interference, IntRes2d_Intersection are made protected to avoid possibility of destructing by pointer to corresponding base class.
This commit is contained in:
parent
e2ba9cb12a
commit
6928e35131
@ -32,16 +32,6 @@ HatchGen_IntersectionPoint::HatchGen_IntersectionPoint () :
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
// Function : ~HatchGen_IntersectionPoint
|
|
||||||
// Purpose : Destructor
|
|
||||||
//=======================================================================
|
|
||||||
|
|
||||||
HatchGen_IntersectionPoint::~HatchGen_IntersectionPoint()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// Function : SetIndex
|
// Function : SetIndex
|
||||||
// Purpose : Sets the index of the supporting curve.
|
// Purpose : Sets the index of the supporting curve.
|
||||||
|
@ -80,17 +80,16 @@ public:
|
|||||||
|
|
||||||
//! Dump of the point on element.
|
//! Dump of the point on element.
|
||||||
Standard_EXPORT virtual void Dump (const Standard_Integer Index = 0) const = 0;
|
Standard_EXPORT virtual void Dump (const Standard_Integer Index = 0) const = 0;
|
||||||
Standard_EXPORT virtual ~HatchGen_IntersectionPoint();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
//! Creates an empty intersection point.
|
//! Creates an empty intersection point.
|
||||||
Standard_EXPORT HatchGen_IntersectionPoint();
|
Standard_EXPORT HatchGen_IntersectionPoint();
|
||||||
|
|
||||||
|
//! Destructor is protected for safer inheritance
|
||||||
|
~HatchGen_IntersectionPoint() {}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
Standard_Integer myIndex;
|
Standard_Integer myIndex;
|
||||||
Standard_Real myParam;
|
Standard_Real myParam;
|
||||||
@ -99,20 +98,6 @@ protected:
|
|||||||
TopAbs_State myAfter;
|
TopAbs_State myAfter;
|
||||||
Standard_Boolean mySegBeg;
|
Standard_Boolean mySegBeg;
|
||||||
Standard_Boolean mySegEnd;
|
Standard_Boolean mySegEnd;
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _HatchGen_IntersectionPoint_HeaderFile
|
#endif // _HatchGen_IntersectionPoint_HeaderFile
|
||||||
|
@ -68,15 +68,14 @@ public:
|
|||||||
//! Dump all the fields.
|
//! Dump all the fields.
|
||||||
Standard_EXPORT void Dump() const;
|
Standard_EXPORT void Dump() const;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
//! Empty Constructor;
|
//! Empty Constructor;
|
||||||
Standard_EXPORT IntCurveSurface_Intersection();
|
Standard_EXPORT IntCurveSurface_Intersection();
|
||||||
|
|
||||||
|
//! Destructor is protected, for safe inheritance
|
||||||
|
~IntCurveSurface_Intersection() {}
|
||||||
|
|
||||||
//! Internal method
|
//! Internal method
|
||||||
//! copy the <Inter> fields to <me>
|
//! copy the <Inter> fields to <me>
|
||||||
Standard_EXPORT void SetValues (const IntCurveSurface_Intersection& Inter);
|
Standard_EXPORT void SetValues (const IntCurveSurface_Intersection& Inter);
|
||||||
|
@ -87,6 +87,9 @@ protected:
|
|||||||
|
|
||||||
IntRes2d_Intersection(const IntRes2d_Intersection& Other);
|
IntRes2d_Intersection(const IntRes2d_Intersection& Other);
|
||||||
|
|
||||||
|
//! Destructor is protected, for safe inheritance
|
||||||
|
~IntRes2d_Intersection () {}
|
||||||
|
|
||||||
Standard_EXPORT void SetValues (const IntRes2d_Intersection& Inter);
|
Standard_EXPORT void SetValues (const IntRes2d_Intersection& Inter);
|
||||||
|
|
||||||
Standard_EXPORT void Append (const IntRes2d_Intersection& Inter, const Standard_Real FirstParam1, const Standard_Real LastParam1, const Standard_Real FirstParam2, const Standard_Real LastParam2);
|
Standard_EXPORT void Append (const IntRes2d_Intersection& Inter, const Standard_Real FirstParam1, const Standard_Real LastParam1, const Standard_Real FirstParam2, const Standard_Real LastParam2);
|
||||||
|
@ -90,9 +90,12 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
//! Empty constructor
|
||||||
Standard_EXPORT Intf_Interference(const Standard_Boolean Self);
|
Standard_EXPORT Intf_Interference(const Standard_Boolean Self);
|
||||||
|
|
||||||
|
//! Destructor is protected, for safer inheritance
|
||||||
|
~Intf_Interference () {}
|
||||||
|
|
||||||
//! Only one argument for the intersection.
|
//! Only one argument for the intersection.
|
||||||
Standard_EXPORT void SelfInterference (const Standard_Boolean Self);
|
Standard_EXPORT void SelfInterference (const Standard_Boolean Self);
|
||||||
|
|
||||||
|
@ -119,6 +119,11 @@ public:
|
|||||||
const Handle(NCollection_BaseAllocator)& Allocator() const
|
const Handle(NCollection_BaseAllocator)& Allocator() const
|
||||||
{ return myAllocator; }
|
{ return myAllocator; }
|
||||||
|
|
||||||
|
// ******** Destructor
|
||||||
|
// Purpose: defines virtual interface
|
||||||
|
virtual ~NCollection_BaseList (void)
|
||||||
|
{}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// --------- PROTECTED METHODS ----------
|
// --------- PROTECTED METHODS ----------
|
||||||
|
|
||||||
|
@ -166,6 +166,9 @@ public:
|
|||||||
myAllocator = (theAllocator.IsNull() ? NCollection_BaseAllocator::CommonBaseAllocator() : theAllocator);
|
myAllocator = (theAllocator.IsNull() ? NCollection_BaseAllocator::CommonBaseAllocator() : theAllocator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Destructor
|
||||||
|
virtual ~NCollection_BaseMap() {}
|
||||||
|
|
||||||
//! BeginResize
|
//! BeginResize
|
||||||
Standard_EXPORT Standard_Boolean BeginResize
|
Standard_EXPORT Standard_Boolean BeginResize
|
||||||
(const Standard_Integer NbBuckets,
|
(const Standard_Integer NbBuckets,
|
||||||
|
@ -115,6 +115,9 @@ public:
|
|||||||
myAllocator = (theAllocator.IsNull() ? NCollection_BaseAllocator::CommonBaseAllocator() : theAllocator);
|
myAllocator = (theAllocator.IsNull() ? NCollection_BaseAllocator::CommonBaseAllocator() : theAllocator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Destructor
|
||||||
|
virtual ~NCollection_BaseSequence() {}
|
||||||
|
|
||||||
Standard_EXPORT void ClearSeq (NCollection_DelSeqNode fDel);
|
Standard_EXPORT void ClearSeq (NCollection_DelSeqNode fDel);
|
||||||
Standard_EXPORT void PAppend (NCollection_SeqNode *);
|
Standard_EXPORT void PAppend (NCollection_SeqNode *);
|
||||||
Standard_EXPORT void PAppend (NCollection_BaseSequence& S);
|
Standard_EXPORT void PAppend (NCollection_BaseSequence& S);
|
||||||
|
@ -184,6 +184,9 @@ protected: //! @name protected methods
|
|||||||
myData = allocMemBlocks (myCapacity);
|
myData = allocMemBlocks (myCapacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Destructor
|
||||||
|
virtual ~NCollection_BaseVector() {}
|
||||||
|
|
||||||
//! @return pointer to memory where to put the new item
|
//! @return pointer to memory where to put the new item
|
||||||
Standard_EXPORT void* expandV (const Standard_Integer theIndex);
|
Standard_EXPORT void* expandV (const Standard_Integer theIndex);
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ class NCollection_DataMap : public NCollection_BaseMap
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
~NCollection_DataMap (void)
|
virtual ~NCollection_DataMap (void)
|
||||||
{ Clear(); }
|
{ Clear(); }
|
||||||
|
|
||||||
//! Size
|
//! Size
|
||||||
|
@ -593,7 +593,7 @@ class NCollection_IndexedDataMap : public NCollection_BaseMap
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
~NCollection_IndexedDataMap (void)
|
virtual ~NCollection_IndexedDataMap (void)
|
||||||
{ Clear(); }
|
{ Clear(); }
|
||||||
|
|
||||||
//! Size
|
//! Size
|
||||||
|
@ -454,7 +454,7 @@ class NCollection_IndexedMap : public NCollection_BaseMap
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
~NCollection_IndexedMap (void)
|
virtual ~NCollection_IndexedMap (void)
|
||||||
{ Clear(); }
|
{ Clear(); }
|
||||||
|
|
||||||
//! Size
|
//! Size
|
||||||
|
@ -271,7 +271,7 @@ public:
|
|||||||
{ PReverse(); }
|
{ PReverse(); }
|
||||||
|
|
||||||
//! Destructor - clears the List
|
//! Destructor - clears the List
|
||||||
~NCollection_List (void)
|
virtual ~NCollection_List (void)
|
||||||
{ Clear(); }
|
{ Clear(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -290,7 +290,7 @@ class NCollection_Map : public NCollection_BaseMap
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
~NCollection_Map (void)
|
virtual ~NCollection_Map (void)
|
||||||
{ Clear(); }
|
{ Clear(); }
|
||||||
|
|
||||||
//! Size
|
//! Size
|
||||||
|
@ -325,7 +325,7 @@ public:
|
|||||||
{ ChangeValue (theIndex) = theItem; }
|
{ ChangeValue (theIndex) = theItem; }
|
||||||
|
|
||||||
// ******** Destructor - clears the Sequence
|
// ******** Destructor - clears the Sequence
|
||||||
~NCollection_Sequence (void)
|
virtual ~NCollection_Sequence (void)
|
||||||
{ Clear(); }
|
{ Clear(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -165,7 +165,7 @@ public: //! @name public methods
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
~NCollection_Vector()
|
virtual ~NCollection_Vector()
|
||||||
{
|
{
|
||||||
for (Standard_Integer anItemIter = 0; anItemIter < myCapacity; ++anItemIter)
|
for (Standard_Integer anItemIter = 0; anItemIter < myCapacity; ++anItemIter)
|
||||||
{
|
{
|
||||||
|
@ -34,6 +34,8 @@ public:
|
|||||||
|
|
||||||
DEFINE_STANDARD_ALLOC
|
DEFINE_STANDARD_ALLOC
|
||||||
|
|
||||||
|
//! Virtual destructor, for safe inheritance
|
||||||
|
virtual ~math_Function () {}
|
||||||
|
|
||||||
//! Computes the value of the function <F> for a given value of
|
//! Computes the value of the function <F> for a given value of
|
||||||
//! variable <X>.
|
//! variable <X>.
|
||||||
@ -56,28 +58,6 @@ public:
|
|||||||
//! to save the current state of the function and to return
|
//! to save the current state of the function and to return
|
||||||
//! an Integer that allows retrieval of the state.
|
//! an Integer that allows retrieval of the state.
|
||||||
Standard_EXPORT virtual Standard_Integer GetStateNumber();
|
Standard_EXPORT virtual Standard_Integer GetStateNumber();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _math_Function_HeaderFile
|
#endif // _math_Function_HeaderFile
|
||||||
|
Loading…
x
Reference in New Issue
Block a user