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

0024742: Remove rarely used collection classes: Set

Classes NCollection_Set and NCollection_HSet removed as unused (along with NCollection_DefineSet.hxx and NCollection_DefineHSet.hxx).

Classes TCollection_Set and TCollection_HSet removed (along with TCollection_SetIterator and TCollection_SetList nested classes).
Code previously using Set classes updated to equivalent use of Sequence (Adaptor3d and Visual3d packages) or TColStd_PackedMapOfInteger (BRepAlgo package).

In Adaptor3d_CurveOnSurface, calculation of continuity intervals refactored so as to build and store sorted sequence of reals, instead of collecting them to set, copying to array, and then sorting.
This commit is contained in:
dln
2014-04-08 12:55:04 +04:00
committed by abv
parent 6af4fe1c46
commit 54f7544df6
34 changed files with 353 additions and 1869 deletions

View File

@@ -28,8 +28,6 @@ NCollection_HArray1.hxx
NCollection_Array2.hxx
NCollection_HArray2.hxx
NCollection_List.hxx
NCollection_Set.hxx
NCollection_HSet.hxx
NCollection_Map.hxx
NCollection_DataMap.hxx
NCollection_DoubleMap.hxx
@@ -51,8 +49,6 @@ NCollection_DefineIndexedMap.hxx
NCollection_DefineIndexedDataMap.hxx
NCollection_DefineSequence.hxx
NCollection_DefineHSequence.hxx
NCollection_DefineSet.hxx
NCollection_DefineHSet.hxx
NCollection_BaseVector.hxx
NCollection_BaseVector.cxx

View File

@@ -1,57 +0,0 @@
// Created on: 2002-04-29
// Created by: Alexander KARTOMIN (akm)
// Copyright (c) 2002-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef NCollection_DefineHSet_HeaderFile
#define NCollection_DefineHSet_HeaderFile
#include <Standard_DefineHandle.hxx>
#include <NCollection_DefineSet.hxx>
#include <MMgt_TShared.hxx>
// Declaration of Set class managed by Handle
#define DEFINE_HSET(HClassName, _SetType_) \
\
class HClassName : public _SetType_, \
public MMgt_TShared { \
public: \
inline HClassName (); \
inline HClassName (const _SetType_& anOther); \
inline const _SetType_& Set () const; \
inline _SetType_& ChangeSet (); \
DEFINE_STANDARD_RTTI (HClassName) \
}; \
\
DEFINE_STANDARD_HANDLE (HClassName, MMgt_TShared) \
\
inline HClassName::HClassName () : \
_SetType_(), \
MMgt_TShared() {} \
\
inline HClassName::HClassName (const _SetType_& anOther) : \
_SetType_(anOther), \
MMgt_TShared() {} \
\
inline const _SetType_& HClassName::Set () const \
{ return * (const _SetType_ *) this; } \
\
inline _SetType_& HClassName::ChangeSet () \
{ return * (_SetType_ *) this; } \
#define IMPLEMENT_HSET(HClassName) \
IMPLEMENT_STANDARD_HANDLE (HClassName, MMgt_TShared) \
IMPLEMENT_STANDARD_RTTIEXT (HClassName, MMgt_TShared)
#endif

View File

@@ -1,34 +0,0 @@
// Created on: 2002-04-17
// Created by: Alexander Kartomin (akm)
// Copyright (c) 2002-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// Automatically created from NCollection_Set.hxx by GAWK
// Purpose: A set is an unordered collection of items without
// duplications. To test for duplications the operators == and !=
// are used on the items.
// Inherits BaseList, adding the data item to each node.
#ifndef NCollection_DefineSet_HeaderFile
#define NCollection_DefineSet_HeaderFile
#include <NCollection_DefineBaseCollection.hxx>
#include <NCollection_Set.hxx>
// **************************************** Template for Set class ********
#define DEFINE_SET(_ClassName_, _BaseCollection_, TheItemType) \
typedef NCollection_Set<TheItemType > _ClassName_;
#endif

View File

@@ -1,27 +0,0 @@
// Created on: 2002-04-29
// Created by: Alexander KARTOMIN (akm)
// Copyright (c) 2002-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef NCollection_HSet_HeaderFile
#define NCollection_HSet_HeaderFile
#include <NCollection_DefineHSet.hxx>
#include <NCollection_Set.hxx>
// Declaration of Set class managed by Handle
#define NCOLLECTION_HSET(HClassName,Type) \
DEFINE_HSET(HClassName,NCollection_Set<Type >)
#endif

View File

@@ -1,227 +0,0 @@
// Created on: 2002-04-17
// Created by: Alexander Kartomin (akm)
// Copyright (c) 2002-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef NCollection_Set_HeaderFile
#define NCollection_Set_HeaderFile
#include <NCollection_BaseCollection.hxx>
#include <NCollection_BaseList.hxx>
#include <NCollection_TListNode.hxx>
#include <NCollection_TListIterator.hxx>
/**
* Purpose: A set is an unordered collection of items without
* duplications. To test for duplications the operators == and !=
* are used on the items.
* Inherits BaseList, adding the data item to each node.
*/
template <class TheItemType> class NCollection_Set
: public NCollection_BaseCollection<TheItemType>,
public NCollection_BaseList
{
public:
typedef NCollection_TListNode<TheItemType> SetNode;
typedef NCollection_TListIterator<TheItemType> Iterator;
public:
// ---------- PUBLIC METHODS ------------
//! Constructor
NCollection_Set(const Handle(NCollection_BaseAllocator)& theAllocator=0L) :
NCollection_BaseCollection<TheItemType>(theAllocator),
NCollection_BaseList() {}
//! Copy constructor
NCollection_Set (const NCollection_Set& theOther) :
NCollection_BaseCollection<TheItemType>(theOther.myAllocator),
NCollection_BaseList()
{ *this = theOther; }
//! Size - Number of items
virtual Standard_Integer Size (void) const
{ return Extent(); }
//! Replace this list by the items of theOther collection
virtual void Assign (const NCollection_BaseCollection<TheItemType>& theOther)
{
if (this == &theOther)
return;
Clear();
TYPENAME NCollection_BaseCollection<TheItemType>::Iterator& anIter =
theOther.CreateIterator();
for (; anIter.More(); anIter.Next())
{
SetNode* pNew = new (this->myAllocator) SetNode(anIter.Value());
PAppend (pNew);
}
}
//! Replace this list by the items of theOther Set
NCollection_Set& operator= (const NCollection_Set& theOther)
{
if (this == &theOther)
return *this;
Clear ();
SetNode * pCur = (SetNode *) theOther.PFirst();
while (pCur)
{
SetNode* pNew = new (this->myAllocator) SetNode(pCur->Value());
PAppend (pNew);
pCur = (SetNode *) pCur->Next();
}
return *this;
}
//! Clear this set
void Clear (void)
{ PClear (SetNode::delNode, this->myAllocator); }
//! Add item
Standard_Boolean Add (const TheItemType& theItem)
{
Iterator anIter(*this);
while (anIter.More())
{
if (anIter.Value() == theItem)
return Standard_False;
anIter.Next();
}
SetNode * pNew = new (this->myAllocator) SetNode(theItem);
PPrepend (pNew);
return Standard_True;
}
//! Remove item
Standard_Boolean Remove (const TheItemType& theItem)
{
Iterator anIter(*this);
while (anIter.More())
{
if (anIter.Value() == theItem)
{
PRemove (anIter, SetNode::delNode, this->myAllocator);
return Standard_True;
}
anIter.Next();
}
return Standard_False;
}
//! Remove - wrapper against 'hiding' warnings
void Remove (Iterator& theIter)
{ NCollection_BaseList::PRemove (theIter,
SetNode::delNode,
this->myAllocator); }
//! Contains - item inclusion query
Standard_Boolean Contains (const TheItemType& theItem) const
{
Iterator anIter(*this);
for (; anIter.More(); anIter.Next())
if (anIter.Value() == theItem)
return Standard_True;
return Standard_False;
}
//! IsASubset
Standard_Boolean IsASubset (const NCollection_Set& theOther)
{
if (this == &theOther)
return Standard_True;
Iterator anIter(theOther);
for (; anIter.More(); anIter.Next())
if (!Contains(anIter.Value()))
return Standard_False;
return Standard_True;
}
//! IsAProperSubset
Standard_Boolean IsAProperSubset (const NCollection_Set& theOther)
{
if (myLength <= theOther.Extent())
return Standard_False;
Iterator anIter(theOther);
for (; anIter.More(); anIter.Next())
if (!Contains(anIter.Value()))
return Standard_False;
return Standard_True;
}
//! Union
void Union (const NCollection_Set& theOther)
{
if (this == &theOther)
return;
Iterator anIter(theOther);
Iterator aMyIter;
Standard_Integer i, iLength=myLength;
for (; anIter.More(); anIter.Next())
{
Standard_Boolean isIn=Standard_False;
const TheItemType& theItem = anIter.Value();
for (aMyIter.Init(*this), i=1;
i<=iLength;
aMyIter.Next(), i++)
if (theItem == aMyIter.Value())
isIn = Standard_True;
if (!isIn)
{
SetNode * pNew = new (this->myAllocator) SetNode(theItem);
PAppend (pNew);
}
}
}
//! Intersection
void Intersection (const NCollection_Set& theOther)
{
if (this == &theOther)
return;
Iterator anIter(*this);
while (anIter.More())
if (theOther.Contains(anIter.Value()))
anIter.Next();
else
NCollection_BaseList::PRemove (anIter, SetNode::delNode, this->myAllocator);
}
//! Difference (Subtraction)
void Difference (const NCollection_Set& theOther)
{
if (this == &theOther)
return;
Iterator anIter(*this);
while (anIter.More())
if (theOther.Contains(anIter.Value()))
NCollection_BaseList::PRemove (anIter, SetNode::delNode, this->myAllocator);
else
anIter.Next();
}
//! Destructor - clears the List
~NCollection_Set (void)
{ Clear(); }
private:
// ----------- PRIVATE METHODS -----------
//! Creates Iterator for use on BaseCollection
virtual TYPENAME NCollection_BaseCollection<TheItemType>::Iterator&
CreateIterator(void) const
{ return *(new (this->IterAllocator()) Iterator(*this)); }
};
#endif