mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-06-16 05:04:11 +08:00
0024911: Avoid using virtual functions in NCollection classes
NCollection_BaseCollection class, relevant header files, and macro DEFINE_BASECOLLECTION removed. Hence methods Assign() from other compatible (via inheritance of BaseCollection) collections are not available any more, as well as base Iterator class. All methods of Iterator classes are made non-virtual, allowing their inline expansion for better performance. OCCT-specific operators new and delete added to collection classes and removed from iterator classes.
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
#ifndef NCollection_TListIterator_HeaderFile
|
||||
#define NCollection_TListIterator_HeaderFile
|
||||
|
||||
#include <NCollection_BaseCollection.hxx>
|
||||
#include <NCollection_BaseList.hxx>
|
||||
#include <NCollection_TListNode.hxx>
|
||||
|
||||
@@ -26,8 +25,7 @@
|
||||
* Remark: TListIterator is internal class
|
||||
*/
|
||||
template <class TheItemType> class NCollection_TListIterator
|
||||
: public NCollection_BaseCollection<TheItemType>::Iterator,
|
||||
public NCollection_BaseList::Iterator
|
||||
: public NCollection_BaseList::Iterator
|
||||
{
|
||||
public:
|
||||
//! Empty constructor - for later Init
|
||||
@@ -36,27 +34,20 @@ template <class TheItemType> class NCollection_TListIterator
|
||||
//! Constructor with initialisation
|
||||
NCollection_TListIterator (const NCollection_BaseList& theList) :
|
||||
NCollection_BaseList::Iterator (theList) {}
|
||||
//! Assignment
|
||||
NCollection_TListIterator& operator= (const NCollection_TListIterator& theIt)
|
||||
{
|
||||
NCollection_BaseList::Iterator& me = * this;
|
||||
me.operator= (theIt);
|
||||
return * this;
|
||||
}
|
||||
//! Check end
|
||||
virtual Standard_Boolean More (void) const
|
||||
Standard_Boolean More (void) const
|
||||
{ return (myCurrent!=NULL); }
|
||||
//! Make step
|
||||
virtual void Next (void)
|
||||
void Next (void)
|
||||
{
|
||||
myPrevious = myCurrent;
|
||||
myCurrent = myCurrent->Next();
|
||||
}
|
||||
//! Constant Value access
|
||||
virtual const TheItemType& Value (void) const
|
||||
const TheItemType& Value (void) const
|
||||
{ return ((const NCollection_TListNode<TheItemType>*) myCurrent)->Value(); }
|
||||
//! Variable Value access
|
||||
virtual TheItemType& ChangeValue (void) const
|
||||
TheItemType& ChangeValue (void) const
|
||||
{ return ((NCollection_TListNode<TheItemType> *)myCurrent)->ChangeValue(); }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user