mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-05 18:16:23 +03: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:
parent
598fcce93c
commit
ddf2fe8eeb
@ -17,13 +17,9 @@
|
||||
#define _AIS_NDataMapOfTransientIteratorOfListTransient_HeaderFile
|
||||
|
||||
#include <AIS_NListIteratorOfListTransient.hxx>
|
||||
#include <NCollection_DefineDataMap.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
DEFINE_BASECOLLECTION(AIS_BaseCollItListTransient,
|
||||
AIS_NListIteratorOfListTransient)
|
||||
DEFINE_DATAMAP (AIS_NDataMapOfTransientIteratorOfListTransient,
|
||||
AIS_BaseCollItListTransient,
|
||||
Handle(Standard_Transient),
|
||||
AIS_NListIteratorOfListTransient)
|
||||
typedef NCollection_DataMap<Handle(Standard_Transient), AIS_NListIteratorOfListTransient>
|
||||
AIS_NDataMapOfTransientIteratorOfListTransient;
|
||||
|
||||
#endif
|
||||
|
@ -17,11 +17,8 @@
|
||||
#define _AIS_NListTransient_HeaderFile
|
||||
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <NCollection_StdBase.hxx>
|
||||
#include <NCollection_DefineList.hxx>
|
||||
#include <NCollection_List.hxx>
|
||||
|
||||
DEFINE_LIST (AIS_NListTransient,
|
||||
NCollection_BaseCollTransient,
|
||||
Handle(Standard_Transient))
|
||||
typedef NCollection_List<Handle(Standard_Transient)> AIS_NListTransient;
|
||||
|
||||
#endif
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include <BOPAlgo_BuilderSolid.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
#include <NCollection_IncAllocator.hxx>
|
||||
|
||||
static
|
||||
TopAbs_ShapeEnum TypeToExplore(const Standard_Integer theDim);
|
||||
|
@ -30,27 +30,23 @@ template <class Type> class BOPCol_NCVector
|
||||
public:
|
||||
BOPCol_NCVector(const Standard_Integer theIncrement=256,
|
||||
const Handle(NCollection_BaseAllocator)& theAlloc = NULL)
|
||||
: NCollection_Vector<Type>(theIncrement, theAlloc) {
|
||||
};
|
||||
: NCollection_Vector<Type>(theIncrement, theAlloc)
|
||||
{}
|
||||
//
|
||||
BOPCol_NCVector(const BOPCol_NCVector& theOther)
|
||||
: NCollection_Vector<Type>(theOther) {
|
||||
};
|
||||
: NCollection_Vector<Type>(theOther)
|
||||
{}
|
||||
//
|
||||
Type& Append1 ()
|
||||
{
|
||||
Type& anAppended =
|
||||
*(Type* )NCollection_BaseVector::expandV (NCollection_BaseCollection<Type>::myAllocator,
|
||||
NCollection_Vector<Type>::myLength);
|
||||
Type& anAppended = *(Type*)this->expandV (this->myLength);
|
||||
return anAppended;
|
||||
}
|
||||
//
|
||||
Standard_Integer Extent() const
|
||||
{
|
||||
return NCollection_Vector<Type>::myLength;
|
||||
return this->myLength;
|
||||
}
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -19,7 +19,7 @@
|
||||
//
|
||||
#include <Bnd_Box.hxx>
|
||||
//
|
||||
#include <NCollection_BaseAllocator.hxx>
|
||||
#include <NCollection_IncAllocator.hxx>
|
||||
#include <NCollection_UBTreeFiller.hxx>
|
||||
//
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
#include <NCollection_UBTreeFiller.hxx>
|
||||
#include <NCollection_IncAllocator.hxx>
|
||||
|
||||
#include <BOPCol_BoxBndTree.hxx>
|
||||
#include <BOPDS_IndexRange.hxx>
|
||||
#include <BOPDS_PassKeyBoolean.hxx>
|
||||
|
@ -16,7 +16,7 @@
|
||||
//
|
||||
#include <Bnd_Box.hxx>
|
||||
//
|
||||
#include <NCollection_BaseAllocator.hxx>
|
||||
#include <NCollection_IncAllocator.hxx>
|
||||
#include <NCollection_UBTreeFiller.hxx>
|
||||
//
|
||||
#include <TopoDS.hxx>
|
||||
|
@ -15,11 +15,11 @@
|
||||
|
||||
#ifndef _Font_NListOfSystemFont_HeaderFile
|
||||
#define _Font_NListOfSystemFont_HeaderFile
|
||||
#include <NCollection_DefineList.hxx>
|
||||
|
||||
#include <NCollection_List.hxx>
|
||||
#include <Font_SystemFont.hxx>
|
||||
DEFINE_LIST (Font_NListOfSystemFont,
|
||||
NCollection_List,
|
||||
Handle(Font_SystemFont))
|
||||
|
||||
typedef NCollection_List<Handle(Font_SystemFont)> Font_NListOfSystemFont;
|
||||
|
||||
inline Standard_Boolean IsEqual (const Handle(Font_SystemFont)& theFirstFont,
|
||||
const Handle(Font_SystemFont)& theSecondFont)
|
||||
|
@ -1507,7 +1507,7 @@ Standard_Boolean DecompositionOfWLine(const Handle(IntPatch_WLine)& theWLine,
|
||||
aNbListOfPointIndex=aListOfPointIndex.Extent();
|
||||
if(aNbListOfPointIndex) {
|
||||
nblines++;
|
||||
anArrayOfLines[nblines] = aListOfPointIndex;
|
||||
anArrayOfLines[nblines].Assign (aListOfPointIndex);
|
||||
anArrayOfLineType[nblines] = bIsPrevPointOnBoundary;
|
||||
aListOfPointIndex.Clear();
|
||||
}
|
||||
|
@ -16,11 +16,9 @@
|
||||
#ifndef _Graphic3d_NListOfHAsciiString_HeaderFile
|
||||
#define _Graphic3d_NListOfHAsciiString_HeaderFile
|
||||
|
||||
#include <NCollection_DefineList.hxx>
|
||||
#include <NCollection_List.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
DEFINE_LIST (Graphic3d_NListOfHAsciiString,
|
||||
NCollection_List,
|
||||
Handle(TCollection_HAsciiString))
|
||||
typedef NCollection_List<Handle(TCollection_HAsciiString)> Graphic3d_NListOfHAsciiString;
|
||||
|
||||
#endif
|
||||
|
@ -15,19 +15,15 @@
|
||||
|
||||
#include <Message_MsgFile.hxx>
|
||||
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <OSD_Environment.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <NCollection_DefineBaseCollection.hxx>
|
||||
#include <NCollection_DefineDataMap.hxx>
|
||||
#include <OSD_Environment.hxx>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
DEFINE_BASECOLLECTION(Message_CollectionOfExtendedString, TCollection_ExtendedString)
|
||||
DEFINE_DATAMAP(Message_DataMapOfExtendedString,
|
||||
Message_CollectionOfExtendedString,
|
||||
TCollection_AsciiString,
|
||||
TCollection_ExtendedString)
|
||||
typedef NCollection_DataMap<TCollection_AsciiString,TCollection_ExtendedString> Message_DataMapOfExtendedString;
|
||||
|
||||
static Message_DataMapOfExtendedString& msgsDataMap ()
|
||||
{
|
||||
|
@ -18,7 +18,6 @@ NCollection_BaseSequence.cxx
|
||||
NCollection_BaseMap.hxx
|
||||
NCollection_BaseMap.cxx
|
||||
|
||||
NCollection_BaseCollection.hxx
|
||||
NCollection_TListNode.hxx
|
||||
NCollection_TListIterator.hxx
|
||||
NCollection_Sequence.hxx
|
||||
@ -34,9 +33,6 @@ NCollection_DoubleMap.hxx
|
||||
NCollection_IndexedMap.hxx
|
||||
NCollection_IndexedDataMap.hxx
|
||||
|
||||
NCollection_DefineBaseCollection.hxx
|
||||
NCollection_DefineTListIterator.hxx
|
||||
NCollection_DefineTListNode.hxx
|
||||
NCollection_DefineArray1.hxx
|
||||
NCollection_DefineHArray1.hxx
|
||||
NCollection_DefineArray2.hxx
|
||||
@ -54,7 +50,6 @@ NCollection_BaseVector.hxx
|
||||
NCollection_BaseVector.cxx
|
||||
NCollection_Vector.hxx
|
||||
NCollection_DefineVector.hxx
|
||||
NCollection_StdBase.hxx
|
||||
|
||||
NCollection_EBTree.hxx
|
||||
NCollection_UBTree.hxx
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#endif
|
||||
|
||||
#include <NCollection_BaseCollection.hxx>
|
||||
#include <NCollection_DefineAlloc.hxx>
|
||||
#include <NCollection_StlIterator.hxx>
|
||||
|
||||
// *********************************************** Template for Array1 class
|
||||
@ -55,8 +55,8 @@
|
||||
* compatibility the method IsAllocated remained in class along
|
||||
* with IsDeletable.
|
||||
*/
|
||||
template <class TheItemType> class NCollection_Array1
|
||||
: public NCollection_BaseCollection<TheItemType>
|
||||
template <class TheItemType>
|
||||
class NCollection_Array1
|
||||
{
|
||||
public:
|
||||
//! STL-compliant typedef for value type
|
||||
@ -64,7 +64,7 @@ public:
|
||||
|
||||
public:
|
||||
//! Implementation of the Iterator interface.
|
||||
class Iterator : public NCollection_BaseCollection<TheItemType>::Iterator
|
||||
class Iterator
|
||||
{
|
||||
public:
|
||||
|
||||
@ -99,35 +99,35 @@ public:
|
||||
}
|
||||
|
||||
//! Check end
|
||||
virtual Standard_Boolean More (void) const
|
||||
Standard_Boolean More (void) const
|
||||
{ return myPtrCur < myPtrEnd; }
|
||||
|
||||
//! Increment operator
|
||||
virtual void Next (void)
|
||||
void Next (void)
|
||||
{ ++myPtrCur; }
|
||||
|
||||
//! Decrement operator
|
||||
virtual void Previous()
|
||||
void Previous()
|
||||
{ --myPtrCur; }
|
||||
|
||||
//! Offset operator.
|
||||
virtual void Offset (ptrdiff_t theOffset)
|
||||
void Offset (ptrdiff_t theOffset)
|
||||
{ myPtrCur += theOffset; }
|
||||
|
||||
//! Difference operator.
|
||||
virtual ptrdiff_t Differ (const Iterator& theOther) const
|
||||
ptrdiff_t Differ (const Iterator& theOther) const
|
||||
{ return myPtrCur - theOther.myPtrCur; }
|
||||
|
||||
//! Constant value access
|
||||
virtual const TheItemType& Value (void) const
|
||||
const TheItemType& Value (void) const
|
||||
{ return *myPtrCur; }
|
||||
|
||||
//! Variable value access
|
||||
virtual TheItemType& ChangeValue (void) const
|
||||
TheItemType& ChangeValue (void) const
|
||||
{ return *myPtrCur; }
|
||||
|
||||
//! Performs comparison of two iterators
|
||||
virtual Standard_Boolean IsEqual (const Iterator& theOther) const
|
||||
Standard_Boolean IsEqual (const Iterator& theOther) const
|
||||
{ return myPtrCur == theOther.myPtrCur; }
|
||||
|
||||
private:
|
||||
@ -159,7 +159,6 @@ public:
|
||||
//! Constructor
|
||||
NCollection_Array1(const Standard_Integer theLower,
|
||||
const Standard_Integer theUpper) :
|
||||
NCollection_BaseCollection<TheItemType> (),
|
||||
myLowerBound (theLower),
|
||||
myUpperBound (theUpper),
|
||||
myDeletable (Standard_True)
|
||||
@ -179,7 +178,6 @@ public:
|
||||
|
||||
//! Copy constructor
|
||||
NCollection_Array1 (const NCollection_Array1& theOther) :
|
||||
NCollection_BaseCollection<TheItemType> (),
|
||||
myLowerBound (theOther.Lower()),
|
||||
myUpperBound (theOther.Upper()),
|
||||
myDeletable (Standard_True)
|
||||
@ -198,7 +196,6 @@ public:
|
||||
NCollection_Array1 (const TheItemType& theBegin,
|
||||
const Standard_Integer theLower,
|
||||
const Standard_Integer theUpper) :
|
||||
NCollection_BaseCollection<TheItemType> (),
|
||||
myLowerBound (theLower),
|
||||
myUpperBound (theUpper),
|
||||
myDeletable (Standard_False)
|
||||
@ -219,7 +216,7 @@ public:
|
||||
}
|
||||
|
||||
//! Size query
|
||||
virtual Standard_Integer Size (void) const
|
||||
Standard_Integer Size (void) const
|
||||
{ return Length(); }
|
||||
//! Length query (the same)
|
||||
Standard_Integer Length (void) const
|
||||
@ -240,27 +237,8 @@ public:
|
||||
Standard_Boolean IsAllocated (void) const
|
||||
{ return myDeletable; }
|
||||
|
||||
//! Assign (any collection to this array)
|
||||
// Copies items from the other collection into the allocated
|
||||
// storage. Raises an exception when sizes differ.
|
||||
virtual void Assign (const NCollection_BaseCollection<TheItemType>& theOther)
|
||||
{
|
||||
if (&theOther == this)
|
||||
return;
|
||||
#if !defined No_Exception && !defined No_Standard_DimensionMismatch
|
||||
if (Length() != theOther.Size())
|
||||
Standard_DimensionMismatch::Raise ("NCollection_Array1::Assign");
|
||||
#endif
|
||||
TYPENAME NCollection_BaseCollection<TheItemType>::Iterator& anIter2 =
|
||||
theOther.CreateIterator();
|
||||
TheItemType * const pEndItem = &myData[myUpperBound];
|
||||
for (TheItemType * pItem = &myData[myLowerBound];
|
||||
pItem <= pEndItem; anIter2.Next())
|
||||
* pItem ++ = anIter2.Value();
|
||||
}
|
||||
|
||||
//! operator= (array to array)
|
||||
NCollection_Array1& operator= (const NCollection_Array1& theOther)
|
||||
//! Assignment
|
||||
NCollection_Array1& Assign (const NCollection_Array1& theOther)
|
||||
{
|
||||
if (&theOther == this)
|
||||
return *this;
|
||||
@ -275,6 +253,12 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Assignment operator
|
||||
NCollection_Array1& operator= (const NCollection_Array1& theOther)
|
||||
{
|
||||
return Assign (theOther);
|
||||
}
|
||||
|
||||
//! @return first element
|
||||
const TheItemType& First() const
|
||||
{
|
||||
@ -342,15 +326,6 @@ public:
|
||||
~NCollection_Array1 (void)
|
||||
{ if (myDeletable) delete [] &(myData[myLowerBound]); }
|
||||
|
||||
private:
|
||||
// ----------- PRIVATE METHODS -----------
|
||||
|
||||
// ******** Creates Iterator for use on BaseCollection
|
||||
virtual
|
||||
TYPENAME NCollection_BaseCollection<TheItemType>::Iterator&
|
||||
CreateIterator(void) const
|
||||
{ return *(new (this->IterAllocator()) Iterator(*this)); }
|
||||
|
||||
protected:
|
||||
// ---------- PROTECTED FIELDS -----------
|
||||
Standard_Integer myLowerBound;
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#endif
|
||||
|
||||
#include <NCollection_BaseCollection.hxx>
|
||||
#include <NCollection_DefineAlloc.hxx>
|
||||
|
||||
// *********************************************** Template for Array2 class
|
||||
/**
|
||||
@ -37,8 +37,8 @@
|
||||
* for (i = A.LowerRow(); i <= A.UpperRow(); i++)
|
||||
* for (j = A.LowerCol(); j <= A.UpperCol(); j++)
|
||||
*/
|
||||
template <class TheItemType> class NCollection_Array2
|
||||
: public NCollection_BaseCollection<TheItemType>
|
||||
template <class TheItemType>
|
||||
class NCollection_Array2
|
||||
{
|
||||
public:
|
||||
//! STL-compliant typedef for value type
|
||||
@ -46,7 +46,7 @@ public:
|
||||
|
||||
public:
|
||||
// **************** Implementation of the Iterator interface.
|
||||
class Iterator : public NCollection_BaseCollection<TheItemType>::Iterator
|
||||
class Iterator
|
||||
{
|
||||
public:
|
||||
//! Empty constructor - for later Init
|
||||
@ -67,16 +67,16 @@ public:
|
||||
myArray = (NCollection_Array2 *) &theArray;
|
||||
}
|
||||
//! Check end
|
||||
virtual Standard_Boolean More (void) const
|
||||
Standard_Boolean More (void) const
|
||||
{ return (myCurrent < mySize); }
|
||||
//! Make step
|
||||
virtual void Next (void)
|
||||
void Next (void)
|
||||
{ myCurrent++; }
|
||||
//! Constant value access
|
||||
virtual const TheItemType& Value (void) const
|
||||
const TheItemType& Value (void) const
|
||||
{ return myArray->myStart[myCurrent]; }
|
||||
//! Variable value access
|
||||
virtual TheItemType& ChangeValue (void) const
|
||||
TheItemType& ChangeValue (void) const
|
||||
{ return myArray->myStart[myCurrent]; }
|
||||
private:
|
||||
Standard_Integer myCurrent; //!< Index of the current item
|
||||
@ -92,7 +92,6 @@ public:
|
||||
const Standard_Integer theRowUpper,
|
||||
const Standard_Integer theColLower,
|
||||
const Standard_Integer theColUpper) :
|
||||
NCollection_BaseCollection<TheItemType> (),
|
||||
myLowerRow (theRowLower),
|
||||
myUpperRow (theRowUpper),
|
||||
myLowerCol (theColLower),
|
||||
@ -102,7 +101,6 @@ public:
|
||||
|
||||
//! Copy constructor
|
||||
NCollection_Array2 (const NCollection_Array2& theOther) :
|
||||
NCollection_BaseCollection<TheItemType> (),
|
||||
myLowerRow (theOther.LowerRow()),
|
||||
myUpperRow (theOther.UpperRow()),
|
||||
myLowerCol (theOther.LowerCol()),
|
||||
@ -119,7 +117,6 @@ public:
|
||||
const Standard_Integer theRowUpper,
|
||||
const Standard_Integer theColLower,
|
||||
const Standard_Integer theColUpper) :
|
||||
NCollection_BaseCollection<TheItemType> (),
|
||||
myLowerRow (theRowLower),
|
||||
myUpperRow (theRowUpper),
|
||||
myLowerCol (theColLower),
|
||||
@ -139,7 +136,7 @@ public:
|
||||
}
|
||||
|
||||
//! Size (number of items)
|
||||
virtual Standard_Integer Size (void) const
|
||||
Standard_Integer Size (void) const
|
||||
{ return Length(); }
|
||||
//! Length (number of items)
|
||||
Standard_Integer Length (void) const
|
||||
@ -169,28 +166,8 @@ public:
|
||||
Standard_Boolean IsDeletable (void) const
|
||||
{ return myDeletable; }
|
||||
|
||||
//! Assign
|
||||
// Copies items from the other collection into the allocated
|
||||
// storage. Raises an exception when sizes differ.
|
||||
virtual void Assign (const NCollection_BaseCollection<TheItemType>& theOther)
|
||||
{
|
||||
if (&theOther == this)
|
||||
return;
|
||||
#if !defined No_Exception && !defined No_Standard_DimensionMismatch
|
||||
if (Length() != theOther.Size())
|
||||
Standard_DimensionMismatch::Raise ("NCollection_Array2::Assign");
|
||||
#endif
|
||||
TYPENAME NCollection_BaseCollection<TheItemType>::Iterator& anIter2 =
|
||||
theOther.CreateIterator();
|
||||
const TheItemType* pEnd = myStart+Length();
|
||||
for (TheItemType* pItem=myStart;
|
||||
pItem < pEnd;
|
||||
pItem++, anIter2.Next())
|
||||
*pItem = anIter2.Value();
|
||||
}
|
||||
|
||||
//! operator= (array to array)
|
||||
NCollection_Array2& operator= (const NCollection_Array2& theOther)
|
||||
//! Assignment
|
||||
NCollection_Array2& Assign (const NCollection_Array2& theOther)
|
||||
{
|
||||
if (&theOther == this)
|
||||
return *this;
|
||||
@ -206,6 +183,12 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Assignment operator
|
||||
NCollection_Array2& operator= (const NCollection_Array2& theOther)
|
||||
{
|
||||
return Assign (theOther);
|
||||
}
|
||||
|
||||
//! Constant value access
|
||||
const TheItemType& Value (const Standard_Integer theRow,
|
||||
const Standard_Integer theCol) const
|
||||
@ -299,11 +282,6 @@ public:
|
||||
myData = pTable - myLowerRow;
|
||||
}
|
||||
|
||||
//! Creates Iterator for use on BaseCollection
|
||||
virtual TYPENAME NCollection_BaseCollection<TheItemType>::Iterator&
|
||||
CreateIterator(void) const
|
||||
{ return *(new (this->IterAllocator()) Iterator(*this)); }
|
||||
|
||||
protected:
|
||||
// ---------- PROTECTED FIELDS -----------
|
||||
Standard_Integer myLowerRow;
|
||||
|
@ -16,6 +16,7 @@
|
||||
// Purpose: Implementation of the BaseAllocator class
|
||||
|
||||
#include <NCollection_BaseAllocator.hxx>
|
||||
#include <NCollection_IncAllocator.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <NCollection_Map.hxx>
|
||||
#include <NCollection_List.hxx>
|
||||
|
@ -1,129 +0,0 @@
|
||||
// Created on: 2002-04-09
|
||||
// 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_BaseCollection_HeaderFile
|
||||
#define NCollection_BaseCollection_HeaderFile
|
||||
|
||||
#include <NCollection_IncAllocator.hxx>
|
||||
#include <NCollection_DefineAlloc.hxx>
|
||||
|
||||
/**
|
||||
* Purpose: NCollection_BaseCollection is the base abstract class for
|
||||
* all collection templates of this package.
|
||||
* The set of collections is similar to that of TCollection.
|
||||
* Also the methods of classes have mostly the same names for
|
||||
* easy switch from TCollection <-> NCollection containers.
|
||||
*
|
||||
* NCollection is a nocdlpack, thus it is compiled without WOK.
|
||||
* BaseCollection allows assigning the collections of different
|
||||
* kinds (the items type being the same) with a few obvious
|
||||
* exclusions - one can not assign any collection to the map
|
||||
* having double data (two keys or a key plus value). Only the
|
||||
* maps of the very same type may be assigned through operator=
|
||||
* Said maps are: DoubleMap,
|
||||
* DataMap,
|
||||
* IndexedDataMap
|
||||
*
|
||||
* For the users needing control over the memory usage the
|
||||
* allocators were added (see NCollection_BaseAllocator header)
|
||||
* Others may forget it - BaseAllocator is used by default and
|
||||
* then memory is managed through Standard::Allocate/::Free.
|
||||
*/
|
||||
template<class TheItemType> class NCollection_BaseCollection
|
||||
{
|
||||
public:
|
||||
// **************** The interface for iterating over collections
|
||||
class Iterator
|
||||
{
|
||||
public:
|
||||
//! Query if the end of collection is reached by iterator
|
||||
virtual Standard_Boolean More(void) const=0;
|
||||
//! Make a step along the collection
|
||||
virtual void Next(void)=0;
|
||||
//! Value inquiry
|
||||
virtual const TheItemType& Value(void) const=0;
|
||||
//! Value change access
|
||||
virtual TheItemType& ChangeValue(void) const=0;
|
||||
public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
DEFINE_NCOLLECTION_ALLOC
|
||||
protected:
|
||||
//! Empty constructor
|
||||
Iterator (void) {}
|
||||
//! Virtual destructor is necessary for classes with virtual methods
|
||||
virtual ~Iterator (void) {}
|
||||
protected:
|
||||
//! operator= is prohibited
|
||||
const Iterator& operator= (const Iterator&);
|
||||
//! Copy constructor **
|
||||
Iterator (const Iterator&) {}
|
||||
}; // End of nested class Iterator
|
||||
|
||||
public:
|
||||
// ---------- PUBLIC METHODS ------------
|
||||
|
||||
//! Common for all collections constructor takes care of theAllocator
|
||||
NCollection_BaseCollection
|
||||
(const Handle(NCollection_BaseAllocator)& theAllocator=0L)
|
||||
{
|
||||
if (theAllocator.IsNull())
|
||||
myAllocator = NCollection_BaseAllocator::CommonBaseAllocator();
|
||||
else
|
||||
myAllocator = theAllocator;
|
||||
}
|
||||
|
||||
//! Number of items
|
||||
virtual Standard_Integer Size(void) const = 0;
|
||||
|
||||
//! Virtual assignment
|
||||
virtual void Assign
|
||||
(const NCollection_BaseCollection& theOther)=0;
|
||||
|
||||
//! Method to create iterators for base collections
|
||||
virtual Iterator& CreateIterator(void) const=0;
|
||||
|
||||
//! Destructor - must be implemented to release the memory
|
||||
virtual ~NCollection_BaseCollection (void) {}
|
||||
|
||||
//! Returns attached allocator
|
||||
const Handle(NCollection_BaseAllocator)& Allocator() const { return myAllocator; }
|
||||
|
||||
protected:
|
||||
// --------- PROTECTED METHOD -----------
|
||||
const Handle(NCollection_BaseAllocator)& IterAllocator(void) const
|
||||
{
|
||||
if (myIterAllocator.IsNull())
|
||||
(Handle(NCollection_BaseAllocator)&) myIterAllocator =
|
||||
new NCollection_IncAllocator(64);
|
||||
return myIterAllocator;
|
||||
}
|
||||
|
||||
//! Exchange allocators of two collections
|
||||
void exchangeAllocators (NCollection_BaseCollection& theOther)
|
||||
{
|
||||
std::swap (myAllocator, theOther.myAllocator);
|
||||
std::swap (myIterAllocator, theOther.myIterAllocator);
|
||||
}
|
||||
|
||||
protected:
|
||||
// --------- PROTECTED FIELDS -----------
|
||||
Handle(NCollection_BaseAllocator) myAllocator;
|
||||
private:
|
||||
// ---------- PRIVATE FIELDS ------------
|
||||
Handle(NCollection_BaseAllocator) myIterAllocator;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -22,16 +22,14 @@
|
||||
//purpose : Deletes all nodes from the list
|
||||
//=======================================================================
|
||||
|
||||
void NCollection_BaseList::PClear
|
||||
(NCollection_DelListNode fDel,
|
||||
Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
void NCollection_BaseList::PClear (NCollection_DelListNode fDel)
|
||||
{
|
||||
NCollection_ListNode* pCur = myFirst;
|
||||
NCollection_ListNode* pNext = NULL;
|
||||
while(pCur)
|
||||
{
|
||||
pNext = pCur->Next();
|
||||
fDel (pCur,theAllocator);
|
||||
fDel (pCur, myAllocator);
|
||||
pCur = pNext;
|
||||
}
|
||||
myLength = 0;
|
||||
@ -115,15 +113,13 @@ void NCollection_BaseList::PPrepend (NCollection_BaseList& theOther)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void NCollection_BaseList::PRemoveFirst
|
||||
(NCollection_DelListNode fDel,
|
||||
Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
void NCollection_BaseList::PRemoveFirst (NCollection_DelListNode fDel)
|
||||
{
|
||||
Standard_NoSuchObject_Raise_if(IsEmpty(),
|
||||
"NCollection_BaseList::PRemoveFirst");
|
||||
NCollection_ListNode* pItem = myFirst;
|
||||
myFirst = pItem->Next();
|
||||
fDel (pItem, theAllocator);
|
||||
fDel (pItem, myAllocator);
|
||||
myLength--;
|
||||
if (myLength == 0)
|
||||
myLast = NULL;
|
||||
@ -134,23 +130,20 @@ void NCollection_BaseList::PRemoveFirst
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void NCollection_BaseList::PRemove
|
||||
(Iterator& theIter,
|
||||
NCollection_DelListNode fDel,
|
||||
Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
void NCollection_BaseList::PRemove (Iterator& theIter, NCollection_DelListNode fDel)
|
||||
{
|
||||
Standard_NoSuchObject_Raise_if(!theIter.More(),
|
||||
"NCollection_BaseList::PRemove");
|
||||
if (theIter.myPrevious == NULL)
|
||||
{
|
||||
PRemoveFirst (fDel,theAllocator);
|
||||
PRemoveFirst (fDel);
|
||||
theIter.myCurrent = myFirst;
|
||||
}
|
||||
else
|
||||
{
|
||||
NCollection_ListNode* pNode = (theIter.myCurrent)->Next();
|
||||
(theIter.myPrevious)->Next() = pNode;
|
||||
fDel (theIter.myCurrent,theAllocator);
|
||||
fDel (theIter.myCurrent, myAllocator);
|
||||
theIter.myCurrent = pNode;
|
||||
if (pNode == NULL)
|
||||
myLast = theIter.myPrevious;
|
||||
|
@ -26,6 +26,7 @@
|
||||
#define NCollection_BaseList_HeaderFile
|
||||
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
#include <NCollection_DefineAlloc.hxx>
|
||||
#include <NCollection_ListNode.hxx>
|
||||
|
||||
typedef void (* NCollection_DelListNode)
|
||||
@ -34,7 +35,12 @@ typedef void (* NCollection_DelListNode)
|
||||
// ********************************************************** BaseList class
|
||||
class NCollection_BaseList
|
||||
{
|
||||
public:
|
||||
public:
|
||||
//! Memory allocation
|
||||
DEFINE_STANDARD_ALLOC
|
||||
DEFINE_NCOLLECTION_ALLOC
|
||||
|
||||
public:
|
||||
class Iterator
|
||||
{
|
||||
public:
|
||||
@ -78,7 +84,7 @@ class NCollection_BaseList
|
||||
}
|
||||
//-------------------------------------------------------
|
||||
//! Performs comparison of two iterators
|
||||
virtual Standard_Boolean IsEqual (const Iterator& theOther) const
|
||||
Standard_Boolean IsEqual (const Iterator& theOther) const
|
||||
{
|
||||
return *this == theOther;
|
||||
}
|
||||
@ -113,15 +119,17 @@ class NCollection_BaseList
|
||||
|
||||
// ******** Constructor
|
||||
// Purpose: Initializes an empty list
|
||||
NCollection_BaseList(void) :
|
||||
NCollection_BaseList (const Handle(NCollection_BaseAllocator)& theAllocator=0L) :
|
||||
myFirst(NULL),
|
||||
myLast(NULL),
|
||||
myLength(0) {}
|
||||
myLength(0)
|
||||
{
|
||||
myAllocator = (theAllocator.IsNull() ? NCollection_BaseAllocator::CommonBaseAllocator() : theAllocator);
|
||||
}
|
||||
|
||||
// ******** PClear
|
||||
// Purpose: deletes all nodes
|
||||
Standard_EXPORT void PClear (NCollection_DelListNode fDel,
|
||||
Handle(NCollection_BaseAllocator)& theAllocator);
|
||||
Standard_EXPORT void PClear (NCollection_DelListNode fDel);
|
||||
|
||||
// ******** PFirst
|
||||
// Purpose: Returns pointer to the first node
|
||||
@ -162,15 +170,13 @@ class NCollection_BaseList
|
||||
// ******** PRemoveFirst
|
||||
// Purpose: Removes first node
|
||||
Standard_EXPORT void PRemoveFirst
|
||||
(NCollection_DelListNode fDel,
|
||||
Handle(NCollection_BaseAllocator)& theAllocator);
|
||||
(NCollection_DelListNode fDel);
|
||||
|
||||
// ******** PRemove
|
||||
// Purpose: Removes the node pointed by theIter[ator]
|
||||
Standard_EXPORT void PRemove
|
||||
(Iterator& theIter,
|
||||
NCollection_DelListNode fDel,
|
||||
Handle(NCollection_BaseAllocator)& theAllocator);
|
||||
NCollection_DelListNode fDel);
|
||||
|
||||
// ******** PInsertBefore
|
||||
// Purpose: Inserts theNode before one pointed by theIter[ator]
|
||||
@ -197,7 +203,8 @@ class NCollection_BaseList
|
||||
Standard_EXPORT void PReverse ();
|
||||
|
||||
protected:
|
||||
// ------------ PRIVATE FIELDS ------------
|
||||
// ------------ PROTECTED FIELDS ------------
|
||||
Handle(NCollection_BaseAllocator) myAllocator;
|
||||
NCollection_ListNode * myFirst; // Pointer to the head
|
||||
NCollection_ListNode * myLast; // Pointer to the tail
|
||||
Standard_Integer myLength; // Actual length
|
||||
|
@ -27,8 +27,7 @@ Standard_Boolean NCollection_BaseMap::BeginResize
|
||||
(const Standard_Integer NbBuckets,
|
||||
Standard_Integer& N,
|
||||
NCollection_ListNode**& data1,
|
||||
NCollection_ListNode**& data2,
|
||||
Handle(NCollection_BaseAllocator)& theAllocator) const
|
||||
NCollection_ListNode**& data2) const
|
||||
{
|
||||
if (mySaturated) return Standard_False;
|
||||
N = NextPrimeForMap(NbBuckets);
|
||||
@ -39,12 +38,12 @@ Standard_Boolean NCollection_BaseMap::BeginResize
|
||||
return Standard_False;
|
||||
}
|
||||
data1 = (NCollection_ListNode **)
|
||||
theAllocator->Allocate((N+1)*sizeof(NCollection_ListNode *));
|
||||
myAllocator->Allocate((N+1)*sizeof(NCollection_ListNode *));
|
||||
memset(data1, 0, (N+1)*sizeof(NCollection_ListNode *));
|
||||
if (isDouble)
|
||||
{
|
||||
data2 = (NCollection_ListNode **)
|
||||
theAllocator->Allocate((N+1)*sizeof(NCollection_ListNode *));
|
||||
myAllocator->Allocate((N+1)*sizeof(NCollection_ListNode *));
|
||||
memset(data2, 0, (N+1)*sizeof(NCollection_ListNode *));
|
||||
}
|
||||
else
|
||||
@ -61,13 +60,12 @@ void NCollection_BaseMap::EndResize
|
||||
(const Standard_Integer NbBuckets,
|
||||
const Standard_Integer N,
|
||||
NCollection_ListNode** data1,
|
||||
NCollection_ListNode** data2,
|
||||
Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
NCollection_ListNode** data2)
|
||||
{
|
||||
if (myData1)
|
||||
theAllocator->Free(myData1);
|
||||
myAllocator->Free(myData1);
|
||||
if (myData2)
|
||||
theAllocator->Free(myData2);
|
||||
myAllocator->Free(myData2);
|
||||
myNbBuckets = N;
|
||||
mySaturated = (myNbBuckets <= NbBuckets);
|
||||
myData1 = data1;
|
||||
@ -80,10 +78,8 @@ void NCollection_BaseMap::EndResize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void NCollection_BaseMap::Destroy
|
||||
(NCollection_DelMapNode fDel,
|
||||
Handle(NCollection_BaseAllocator)& theAllocator,
|
||||
const Standard_Boolean doReleaseMemory)
|
||||
void NCollection_BaseMap::Destroy (NCollection_DelMapNode fDel,
|
||||
Standard_Boolean doReleaseMemory)
|
||||
{
|
||||
if (!IsEmpty())
|
||||
{
|
||||
@ -98,7 +94,7 @@ void NCollection_BaseMap::Destroy
|
||||
while (p)
|
||||
{
|
||||
q = (NCollection_ListNode*)p->Next();
|
||||
fDel (p, theAllocator);
|
||||
fDel (p, myAllocator);
|
||||
p = q;
|
||||
}
|
||||
data[i] = NULL;
|
||||
@ -111,9 +107,9 @@ void NCollection_BaseMap::Destroy
|
||||
{
|
||||
mySaturated = Standard_False;
|
||||
if (myData1)
|
||||
theAllocator->Free(myData1);
|
||||
myAllocator->Free(myData1);
|
||||
if (isDouble && myData2)
|
||||
theAllocator->Free(myData2);
|
||||
myAllocator->Free(myData2);
|
||||
myData1 = myData2 = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -16,13 +16,9 @@
|
||||
#ifndef NCollection_BaseMap_HeaderFile
|
||||
#define NCollection_BaseMap_HeaderFile
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <NCollection_BaseAllocator.hxx>
|
||||
#include <NCollection_DefineAlloc.hxx>
|
||||
#include <NCollection_ListNode.hxx>
|
||||
|
||||
typedef void (* NCollection_DelMapNode)
|
||||
@ -40,7 +36,12 @@ typedef void (* NCollection_DelMapNode)
|
||||
|
||||
class NCollection_BaseMap
|
||||
{
|
||||
public:
|
||||
public:
|
||||
//! Memory allocation
|
||||
DEFINE_STANDARD_ALLOC
|
||||
DEFINE_NCOLLECTION_ALLOC
|
||||
|
||||
public:
|
||||
// **************************************** Class Iterator ****************
|
||||
class Iterator
|
||||
{
|
||||
@ -92,7 +93,7 @@ class NCollection_BaseMap
|
||||
}
|
||||
|
||||
//! Performs comparison of two iterators.
|
||||
virtual Standard_Boolean IsEqual (const Iterator& theOther) const
|
||||
Standard_Boolean IsEqual (const Iterator& theOther) const
|
||||
{
|
||||
return myBucket == theOther.myBucket && myNode == theOther.myNode;
|
||||
}
|
||||
@ -153,29 +154,31 @@ class NCollection_BaseMap
|
||||
|
||||
//! Constructor
|
||||
NCollection_BaseMap (const Standard_Integer NbBuckets,
|
||||
const Standard_Boolean single) :
|
||||
myData1(NULL),
|
||||
myData2(NULL),
|
||||
isDouble(!single),
|
||||
mySaturated(Standard_False),
|
||||
myNbBuckets(NbBuckets),
|
||||
mySize(0) {}
|
||||
const Standard_Boolean single,
|
||||
const Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
: myData1(NULL),
|
||||
myData2(NULL),
|
||||
isDouble(!single),
|
||||
mySaturated(Standard_False),
|
||||
myNbBuckets(NbBuckets),
|
||||
mySize(0)
|
||||
{
|
||||
myAllocator = (theAllocator.IsNull() ? NCollection_BaseAllocator::CommonBaseAllocator() : theAllocator);
|
||||
}
|
||||
|
||||
//! BeginResize
|
||||
Standard_EXPORT Standard_Boolean BeginResize
|
||||
(const Standard_Integer NbBuckets,
|
||||
Standard_Integer& NewBuckets,
|
||||
NCollection_ListNode**& data1,
|
||||
NCollection_ListNode**& data2,
|
||||
Handle(NCollection_BaseAllocator)& theAllocator) const;
|
||||
NCollection_ListNode**& data2) const;
|
||||
|
||||
//! EndResize
|
||||
Standard_EXPORT void EndResize
|
||||
(const Standard_Integer NbBuckets,
|
||||
const Standard_Integer NewBuckets,
|
||||
NCollection_ListNode** data1,
|
||||
NCollection_ListNode** data2,
|
||||
Handle(NCollection_BaseAllocator)& theAllocator);
|
||||
NCollection_ListNode** data2);
|
||||
|
||||
//! Resizable
|
||||
Standard_Boolean Resizable() const
|
||||
@ -191,9 +194,7 @@ class NCollection_BaseMap
|
||||
|
||||
//! Destroy
|
||||
Standard_EXPORT void Destroy(NCollection_DelMapNode fDel,
|
||||
Handle(NCollection_BaseAllocator)& theAllocator,
|
||||
const Standard_Boolean doReleaseMemory
|
||||
= Standard_True);
|
||||
Standard_Boolean doReleaseMemory = Standard_True);
|
||||
|
||||
//! NextPrimeForMap
|
||||
Standard_EXPORT Standard_Integer NextPrimeForMap
|
||||
@ -202,6 +203,7 @@ class NCollection_BaseMap
|
||||
//! Exchange content of two maps without data copying
|
||||
void exchangeMapsData (NCollection_BaseMap& theOther)
|
||||
{
|
||||
std::swap (myAllocator, theOther.myAllocator);
|
||||
std::swap (myData1, theOther.myData1);
|
||||
std::swap (myData2, theOther.myData2);
|
||||
//std::swap (isDouble, theOther.isDouble);
|
||||
@ -212,6 +214,7 @@ class NCollection_BaseMap
|
||||
|
||||
protected:
|
||||
// --------- PROTECTED FIELDS -----------
|
||||
Handle(NCollection_BaseAllocator) myAllocator;
|
||||
NCollection_ListNode ** myData1;
|
||||
NCollection_ListNode ** myData2;
|
||||
|
||||
@ -224,7 +227,6 @@ class NCollection_BaseMap
|
||||
|
||||
// ---------- FRIEND CLASSES ------------
|
||||
friend class Iterator;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -20,19 +20,24 @@
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
|
||||
inline void NCollection_BaseSequence::Nullify ()
|
||||
{
|
||||
myFirstItem = myLastItem = myCurrentItem = NULL;
|
||||
myCurrentIndex = mySize = 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ClearSeq
|
||||
//purpose : removes all items from the current sequence
|
||||
//=======================================================================
|
||||
|
||||
void NCollection_BaseSequence::ClearSeq
|
||||
(NCollection_DelSeqNode fDel, Handle(NCollection_BaseAllocator)& theAl)
|
||||
void NCollection_BaseSequence::ClearSeq (NCollection_DelSeqNode fDel)
|
||||
{
|
||||
NCollection_SeqNode* p = myFirstItem;
|
||||
while (p) {
|
||||
NCollection_SeqNode* q = p;
|
||||
p = p->Next();
|
||||
fDel (q, theAl);
|
||||
fDel (q, myAllocator);
|
||||
}
|
||||
Nullify();
|
||||
}
|
||||
@ -324,8 +329,7 @@ void NCollection_BaseSequence::PSplit (const Standard_Integer theIndex,
|
||||
|
||||
void NCollection_BaseSequence::RemoveSeq
|
||||
(NCollection_BaseSequence::Iterator& thePosition,
|
||||
NCollection_DelSeqNode fDel,
|
||||
Handle(NCollection_BaseAllocator)& theAl)
|
||||
NCollection_DelSeqNode fDel)
|
||||
{
|
||||
NCollection_SeqNode * aPos = thePosition.myCurrent;
|
||||
if (aPos == NULL)
|
||||
@ -346,7 +350,7 @@ void NCollection_BaseSequence::RemoveSeq
|
||||
myCurrentItem = myLastItem;
|
||||
myCurrentIndex = mySize;
|
||||
|
||||
fDel (aPos, theAl);
|
||||
fDel (aPos, myAllocator);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -354,10 +358,8 @@ void NCollection_BaseSequence::RemoveSeq
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void NCollection_BaseSequence::RemoveSeq
|
||||
(const Standard_Integer theIndex,
|
||||
NCollection_DelSeqNode fDel,
|
||||
Handle(NCollection_BaseAllocator)& theAl)
|
||||
void NCollection_BaseSequence::RemoveSeq (const Standard_Integer theIndex,
|
||||
NCollection_DelSeqNode fDel)
|
||||
{
|
||||
Standard_OutOfRange_Raise_if (theIndex <= 0 || theIndex > mySize, "");
|
||||
|
||||
@ -381,7 +383,7 @@ void NCollection_BaseSequence::RemoveSeq
|
||||
myCurrentIndex = mySize;
|
||||
}
|
||||
}
|
||||
fDel (p, theAl);
|
||||
fDel (p, myAllocator);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -389,11 +391,9 @@ void NCollection_BaseSequence::RemoveSeq
|
||||
//purpose : remove a set of items
|
||||
//=======================================================================
|
||||
|
||||
void NCollection_BaseSequence::RemoveSeq
|
||||
(const Standard_Integer From,
|
||||
const Standard_Integer To,
|
||||
NCollection_DelSeqNode fDel,
|
||||
Handle(NCollection_BaseAllocator)& theAl)
|
||||
void NCollection_BaseSequence::RemoveSeq (const Standard_Integer From,
|
||||
const Standard_Integer To,
|
||||
NCollection_DelSeqNode fDel)
|
||||
{
|
||||
Standard_OutOfRange_Raise_if (From <= 0 || To > mySize || From > To, "");
|
||||
|
||||
@ -425,7 +425,7 @@ void NCollection_BaseSequence::RemoveSeq
|
||||
for (Standard_Integer i = From; i <= To; i++) {
|
||||
NCollection_SeqNode * tmp = pfrom;
|
||||
pfrom = pfrom->Next();
|
||||
fDel (tmp, theAl);
|
||||
fDel (tmp, myAllocator);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,12 +18,16 @@
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <NCollection_BaseAllocator.hxx>
|
||||
#include <NCollection_DefineAlloc.hxx>
|
||||
|
||||
// **************************************** Class SeqNode ********************
|
||||
|
||||
class NCollection_SeqNode
|
||||
{
|
||||
public:
|
||||
public:
|
||||
// define new operator for use with NCollection allocators
|
||||
DEFINE_NCOLLECTION_ALLOC
|
||||
public:
|
||||
NCollection_SeqNode () : myNext (NULL), myPrevious (NULL) {}
|
||||
NCollection_SeqNode * Next () const { return myNext; }
|
||||
NCollection_SeqNode * Previous () const { return myPrevious; }
|
||||
@ -44,7 +48,12 @@ typedef void (* NCollection_DelSeqNode)
|
||||
*/
|
||||
class NCollection_BaseSequence
|
||||
{
|
||||
public:
|
||||
public:
|
||||
//! Memory allocation
|
||||
DEFINE_STANDARD_ALLOC
|
||||
DEFINE_NCOLLECTION_ALLOC
|
||||
|
||||
public:
|
||||
class Iterator
|
||||
{
|
||||
public:
|
||||
@ -96,9 +105,17 @@ class NCollection_BaseSequence
|
||||
protected:
|
||||
// Methods PROTECTED
|
||||
//
|
||||
inline NCollection_BaseSequence ();
|
||||
Standard_EXPORT void ClearSeq (NCollection_DelSeqNode fDel,
|
||||
Handle(NCollection_BaseAllocator)& theAl);
|
||||
NCollection_BaseSequence (const Handle(NCollection_BaseAllocator)& theAllocator) :
|
||||
myFirstItem (NULL),
|
||||
myLastItem (NULL),
|
||||
myCurrentItem (NULL),
|
||||
myCurrentIndex (0),
|
||||
mySize (0)
|
||||
{
|
||||
myAllocator = (theAllocator.IsNull() ? NCollection_BaseAllocator::CommonBaseAllocator() : theAllocator);
|
||||
}
|
||||
|
||||
Standard_EXPORT void ClearSeq (NCollection_DelSeqNode fDel);
|
||||
Standard_EXPORT void PAppend (NCollection_SeqNode *);
|
||||
Standard_EXPORT void PAppend (NCollection_BaseSequence& S);
|
||||
Standard_EXPORT void PPrepend (NCollection_SeqNode *);
|
||||
@ -112,15 +129,12 @@ class NCollection_BaseSequence
|
||||
Standard_EXPORT void PSplit (const Standard_Integer Index,
|
||||
NCollection_BaseSequence& Sub);
|
||||
Standard_EXPORT void RemoveSeq (Iterator& thePosition,
|
||||
NCollection_DelSeqNode fDel,
|
||||
Handle(NCollection_BaseAllocator)& theAl);
|
||||
NCollection_DelSeqNode fDel);
|
||||
Standard_EXPORT void RemoveSeq (const Standard_Integer Index,
|
||||
NCollection_DelSeqNode fDel,
|
||||
Handle(NCollection_BaseAllocator)& theAl);
|
||||
NCollection_DelSeqNode fDel);
|
||||
Standard_EXPORT void RemoveSeq (const Standard_Integer From,
|
||||
const Standard_Integer To,
|
||||
NCollection_DelSeqNode fDel,
|
||||
Handle(NCollection_BaseAllocator)& theAl);
|
||||
NCollection_DelSeqNode fDel);
|
||||
Standard_EXPORT void PReverse ();
|
||||
Standard_EXPORT void PExchange (const Standard_Integer I,
|
||||
const Standard_Integer J) ;
|
||||
@ -130,6 +144,7 @@ class NCollection_BaseSequence
|
||||
protected:
|
||||
// Fields PROTECTED
|
||||
//
|
||||
Handle(NCollection_BaseAllocator) myAllocator;
|
||||
NCollection_SeqNode* myFirstItem;
|
||||
NCollection_SeqNode* myLastItem;
|
||||
NCollection_SeqNode* myCurrentItem;
|
||||
@ -141,21 +156,8 @@ class NCollection_BaseSequence
|
||||
//
|
||||
Standard_EXPORT NCollection_BaseSequence
|
||||
(const NCollection_BaseSequence& Other);
|
||||
inline void Nullify ();
|
||||
inline void Nullify ();
|
||||
friend class Iterator;
|
||||
};
|
||||
|
||||
inline NCollection_BaseSequence::NCollection_BaseSequence ()
|
||||
: myFirstItem (NULL),
|
||||
myLastItem (NULL),
|
||||
myCurrentItem (NULL),
|
||||
myCurrentIndex (0),
|
||||
mySize (0) {}
|
||||
|
||||
inline void NCollection_BaseSequence::Nullify ()
|
||||
{
|
||||
myFirstItem = myLastItem = myCurrentItem = NULL;
|
||||
myCurrentIndex = mySize = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -63,12 +63,11 @@ void NCollection_BaseVector::Iterator::initV (const NCollection_BaseVector& theV
|
||||
//=======================================================================
|
||||
|
||||
NCollection_BaseVector::MemBlock* NCollection_BaseVector
|
||||
::allocMemBlocks (Handle(NCollection_BaseAllocator)& theAllocator,
|
||||
const Standard_Integer theCapacity,
|
||||
::allocMemBlocks (const Standard_Integer theCapacity,
|
||||
MemBlock* theSource,
|
||||
const Standard_Integer theSourceSize)
|
||||
{
|
||||
MemBlock* aData = (MemBlock* )theAllocator->Allocate (theCapacity * sizeof(MemBlock));
|
||||
MemBlock* aData = (MemBlock* )myAllocator->Allocate (theCapacity * sizeof(MemBlock));
|
||||
|
||||
// copy content from source array
|
||||
Standard_Integer aCapacity = 0;
|
||||
@ -76,7 +75,7 @@ NCollection_BaseVector::MemBlock* NCollection_BaseVector
|
||||
{
|
||||
memcpy (aData, theSource, theSourceSize * sizeof(MemBlock));
|
||||
aCapacity = theSourceSize;
|
||||
theAllocator->Free (theSource);
|
||||
myAllocator->Free (theSource);
|
||||
}
|
||||
|
||||
// Nullify newly allocated blocks
|
||||
@ -110,8 +109,7 @@ void NCollection_BaseVector::Clear()
|
||||
//purpose : returns the pointer where the new data item is supposed to be put
|
||||
//=======================================================================
|
||||
|
||||
void* NCollection_BaseVector::expandV (Handle(NCollection_BaseAllocator)& theAllocator,
|
||||
const Standard_Integer theIndex)
|
||||
void* NCollection_BaseVector::expandV (const Standard_Integer theIndex)
|
||||
{
|
||||
const Standard_Integer aNewLength = theIndex + 1;
|
||||
if (myNBlocks > 0)
|
||||
@ -140,7 +138,7 @@ void* NCollection_BaseVector::expandV (Handle(NCollection_BaseAllocator)& theAll
|
||||
// Reallocate the array myData
|
||||
do myCapacity += GetCapacity(myIncrement); while (myCapacity <= nNewBlock);
|
||||
|
||||
myData = allocMemBlocks (theAllocator, myCapacity, myData, myNBlocks);
|
||||
myData = allocMemBlocks (myCapacity, myData, myNBlocks);
|
||||
}
|
||||
if (myNBlocks > 0)
|
||||
{
|
||||
|
@ -17,15 +17,11 @@
|
||||
#define NCollection_BaseVector_HeaderFile
|
||||
|
||||
#include <Standard_TypeDef.hxx>
|
||||
#include <NCollection_BaseAllocator.hxx>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <NCollection_BaseAllocator.hxx>
|
||||
#include <NCollection_DefineAlloc.hxx>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push, 1)
|
||||
#pragma warning(disable:4355)
|
||||
#endif
|
||||
#include <stddef.h>
|
||||
|
||||
// this value defines the number of blocks that are reserved
|
||||
// when the capacity of vector is increased
|
||||
@ -37,6 +33,10 @@ inline Standard_Integer GetCapacity (const Standard_Integer theIncrement)
|
||||
//! Class NCollection_BaseVector - base for NCollection_Vector template
|
||||
class NCollection_BaseVector
|
||||
{
|
||||
public:
|
||||
//! Memory allocation
|
||||
DEFINE_STANDARD_ALLOC
|
||||
DEFINE_NCOLLECTION_ALLOC
|
||||
|
||||
protected:
|
||||
|
||||
@ -112,14 +112,14 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void offsetV (Standard_Integer theOffset)
|
||||
void offsetV (Standard_Integer theOffset)
|
||||
{
|
||||
const Standard_Integer anIndex = myCurIndex + myICurBlock * myVector->myIncrement + theOffset;
|
||||
myICurBlock = anIndex / myVector->myIncrement;
|
||||
myCurIndex = anIndex % myVector->myIncrement;
|
||||
}
|
||||
|
||||
virtual Standard_Integer differV (const Iterator& theOther) const
|
||||
Standard_Integer differV (const Iterator& theOther) const
|
||||
{
|
||||
return (myCurIndex - theOther.myCurIndex) + (myICurBlock - theOther.myICurBlock) * myVector->myIncrement;
|
||||
}
|
||||
@ -144,19 +144,17 @@ protected: //! @name Block initializer
|
||||
const Standard_Integer theSize);
|
||||
|
||||
//! Allocate memory for array of memory blocks.
|
||||
//! @param theAllocator Memory allocator to use
|
||||
//! @param theCapacity Number of memory blocks in array
|
||||
//! @param theSource Original array of memory blocks, will be automatically deallocated
|
||||
//! @param theSourceSize Number of memory blocks in original array
|
||||
Standard_EXPORT static MemBlock* allocMemBlocks (Handle(NCollection_BaseAllocator)& theAllocator,
|
||||
const Standard_Integer theCapacity,
|
||||
MemBlock* theSource = NULL,
|
||||
const Standard_Integer theSourceSize = 0);
|
||||
Standard_EXPORT MemBlock* allocMemBlocks (const Standard_Integer theCapacity,
|
||||
MemBlock* theSource = NULL,
|
||||
const Standard_Integer theSourceSize = 0);
|
||||
|
||||
protected: //! @name protected methods
|
||||
|
||||
//! Empty constructor
|
||||
NCollection_BaseVector (Handle(NCollection_BaseAllocator)& theAllocator,
|
||||
NCollection_BaseVector (const Handle(NCollection_BaseAllocator)& theAllocator,
|
||||
initMemBlocks_t theInitBlocks,
|
||||
const size_t theSize,
|
||||
const Standard_Integer theInc)
|
||||
@ -165,11 +163,14 @@ protected: //! @name protected methods
|
||||
myLength (0),
|
||||
myCapacity (GetCapacity (myIncrement)),
|
||||
myNBlocks (0),
|
||||
myData (allocMemBlocks (theAllocator, myCapacity)),
|
||||
myInitBlocks (theInitBlocks) {}
|
||||
myInitBlocks (theInitBlocks)
|
||||
{
|
||||
myAllocator = (theAllocator.IsNull() ? NCollection_BaseAllocator::CommonBaseAllocator() : theAllocator);
|
||||
myData = allocMemBlocks (myCapacity);
|
||||
}
|
||||
|
||||
//! Copy constructor
|
||||
NCollection_BaseVector (Handle(NCollection_BaseAllocator)& theAllocator,
|
||||
NCollection_BaseVector (const Handle(NCollection_BaseAllocator)& theAllocator,
|
||||
initMemBlocks_t theInitBlocks,
|
||||
const NCollection_BaseVector& theOther)
|
||||
: myItemSize (theOther.myItemSize),
|
||||
@ -177,12 +178,14 @@ protected: //! @name protected methods
|
||||
myLength (theOther.myLength),
|
||||
myCapacity (GetCapacity(myIncrement) + theOther.myLength / theOther.myIncrement),
|
||||
myNBlocks (1 + (theOther.myLength - 1)/theOther.myIncrement),
|
||||
myData (allocMemBlocks (theAllocator, myCapacity)),
|
||||
myInitBlocks (theInitBlocks) {}
|
||||
myInitBlocks (theInitBlocks)
|
||||
{
|
||||
myAllocator = (theAllocator.IsNull() ? NCollection_BaseAllocator::CommonBaseAllocator() : theAllocator);
|
||||
myData = allocMemBlocks (myCapacity);
|
||||
}
|
||||
|
||||
//! @return pointer to memory where to put the new item
|
||||
Standard_EXPORT void* expandV (Handle(NCollection_BaseAllocator)& theAllocator,
|
||||
const Standard_Integer theIndex);
|
||||
Standard_EXPORT void* expandV (const Standard_Integer theIndex);
|
||||
|
||||
//! Locate the memory holding the desired value
|
||||
inline void* findV (const Standard_Integer theIndex) const
|
||||
@ -198,8 +201,9 @@ public: //! @name public API
|
||||
//! Empty the vector of its objects
|
||||
Standard_EXPORT void Clear();
|
||||
|
||||
protected: //! @name Private fields
|
||||
protected: //! @name Protected fields
|
||||
|
||||
Handle(NCollection_BaseAllocator) myAllocator;
|
||||
size_t myItemSize;
|
||||
Standard_Integer myIncrement;
|
||||
Standard_Integer myLength;
|
||||
@ -211,11 +215,6 @@ protected: //! @name Private fields
|
||||
protected:
|
||||
|
||||
friend class Iterator;
|
||||
|
||||
};
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // NCollection_BaseVector_HeaderFile
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
}
|
||||
|
||||
//! Destructor.
|
||||
virtual ~NCollection_Buffer()
|
||||
~NCollection_Buffer()
|
||||
{
|
||||
Free();
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <NCollection_List.hxx>
|
||||
#include <NCollection_Map.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <NCollection_BaseAllocator.hxx>
|
||||
#include <NCollection_IncAllocator.hxx>
|
||||
#include <NCollection_TypeDef.hxx>
|
||||
|
||||
//! Auxiliary enumeration serving as responce from method Inspect
|
||||
|
@ -16,7 +16,6 @@
|
||||
#ifndef NCollection_DataMap_HeaderFile
|
||||
#define NCollection_DataMap_HeaderFile
|
||||
|
||||
#include <NCollection_BaseCollection.hxx>
|
||||
#include <NCollection_BaseMap.hxx>
|
||||
#include <NCollection_TListNode.hxx>
|
||||
#include <NCollection_StlIterator.hxx>
|
||||
@ -45,10 +44,8 @@
|
||||
|
||||
template < class TheKeyType,
|
||||
class TheItemType,
|
||||
class Hasher = NCollection_DefaultHasher<TheKeyType> > class NCollection_DataMap
|
||||
|
||||
: public NCollection_BaseCollection<TheItemType>,
|
||||
public NCollection_BaseMap
|
||||
class Hasher = NCollection_DefaultHasher<TheKeyType> >
|
||||
class NCollection_DataMap : public NCollection_BaseMap
|
||||
{
|
||||
// **************** Adaptation of the TListNode to the DATAmap
|
||||
public:
|
||||
@ -65,7 +62,7 @@ template < class TheKeyType,
|
||||
const TheKeyType& Key (void) const
|
||||
{ return myKey; }
|
||||
|
||||
//! Static deleter to be passed to BaseList
|
||||
//! Static deleter to be passed to BaseMap
|
||||
static void delNode (NCollection_ListNode * theNode,
|
||||
Handle(NCollection_BaseAllocator)& theAl)
|
||||
{
|
||||
@ -79,9 +76,7 @@ template < class TheKeyType,
|
||||
|
||||
public:
|
||||
// **************** Implementation of the Iterator interface.
|
||||
class Iterator
|
||||
: public NCollection_BaseCollection<TheItemType>::Iterator,
|
||||
public NCollection_BaseMap::Iterator
|
||||
class Iterator : public NCollection_BaseMap::Iterator
|
||||
{
|
||||
public:
|
||||
//! Empty constructor
|
||||
@ -91,13 +86,13 @@ template < class TheKeyType,
|
||||
Iterator (const NCollection_DataMap& theMap) :
|
||||
NCollection_BaseMap::Iterator(theMap) {}
|
||||
//! Query if the end of collection is reached by iterator
|
||||
virtual Standard_Boolean More(void) const
|
||||
Standard_Boolean More(void) const
|
||||
{ return PMore(); }
|
||||
//! Make a step along the collection
|
||||
virtual void Next(void)
|
||||
void Next(void)
|
||||
{ PNext(); }
|
||||
//! Value inquiry
|
||||
virtual const TheItemType& Value(void) const
|
||||
const TheItemType& Value(void) const
|
||||
{
|
||||
#if !defined No_Exception && !defined No_Standard_NoSuchObject
|
||||
if (!More())
|
||||
@ -106,7 +101,7 @@ template < class TheKeyType,
|
||||
return ((DataMapNode *) myNode)->Value();
|
||||
}
|
||||
//! Value change access
|
||||
virtual TheItemType& ChangeValue(void) const
|
||||
TheItemType& ChangeValue(void) const
|
||||
{
|
||||
#if !defined No_Exception && !defined No_Standard_NoSuchObject
|
||||
if (!More())
|
||||
@ -149,33 +144,22 @@ template < class TheKeyType,
|
||||
//! Constructor
|
||||
NCollection_DataMap (const Standard_Integer NbBuckets=1,
|
||||
const Handle(NCollection_BaseAllocator)& theAllocator = 0L)
|
||||
: NCollection_BaseCollection<TheItemType>(theAllocator),
|
||||
NCollection_BaseMap (NbBuckets, Standard_True) {}
|
||||
: NCollection_BaseMap (NbBuckets, Standard_True, theAllocator) {}
|
||||
|
||||
//! Copy constructor
|
||||
NCollection_DataMap (const NCollection_DataMap& theOther)
|
||||
: NCollection_BaseCollection<TheItemType>(theOther.myAllocator),
|
||||
NCollection_BaseMap (theOther.NbBuckets(), Standard_True)
|
||||
: NCollection_BaseMap (theOther.NbBuckets(), Standard_True, theOther.myAllocator)
|
||||
{ *this = theOther; }
|
||||
|
||||
//! Assign another collection
|
||||
virtual void Assign(const NCollection_BaseCollection<TheItemType>& theOther)
|
||||
{
|
||||
if (this == &theOther)
|
||||
return;
|
||||
Standard_TypeMismatch::Raise ("NCollection_DataMap::Assign impossible");
|
||||
}
|
||||
|
||||
//! Exchange the content of two maps without re-allocations.
|
||||
//! Notice that allocators will be swapped as well!
|
||||
void Exchange (NCollection_DataMap& theOther)
|
||||
{
|
||||
this->exchangeAllocators (theOther);
|
||||
this->exchangeMapsData (theOther);
|
||||
this->exchangeMapsData (theOther);
|
||||
}
|
||||
|
||||
//! = another map
|
||||
NCollection_DataMap& operator= (const NCollection_DataMap& theOther)
|
||||
//! Assignment
|
||||
NCollection_DataMap& Assign (const NCollection_DataMap& theOther)
|
||||
{
|
||||
if (this == &theOther)
|
||||
return *this;
|
||||
@ -188,13 +172,19 @@ template < class TheKeyType,
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Assignment operator
|
||||
NCollection_DataMap& operator= (const NCollection_DataMap& theOther)
|
||||
{
|
||||
return Assign (theOther);
|
||||
}
|
||||
|
||||
//! ReSize
|
||||
void ReSize (const Standard_Integer N)
|
||||
{
|
||||
NCollection_ListNode** newdata = NULL;
|
||||
NCollection_ListNode** dummy = NULL;
|
||||
Standard_Integer newBuck;
|
||||
if (BeginResize (N, newBuck, newdata, dummy, this->myAllocator))
|
||||
if (BeginResize (N, newBuck, newdata, dummy))
|
||||
{
|
||||
if (myData1)
|
||||
{
|
||||
@ -217,7 +207,7 @@ template < class TheKeyType,
|
||||
}
|
||||
}
|
||||
}
|
||||
EndResize (N, newBuck, newdata, dummy, this->myAllocator);
|
||||
EndResize (N, newBuck, newdata, dummy);
|
||||
}
|
||||
}
|
||||
|
||||
@ -357,7 +347,7 @@ template < class TheKeyType,
|
||||
//! Clear data. If doReleaseMemory is false then the table of
|
||||
//! buckets is not released and will be reused.
|
||||
void Clear(const Standard_Boolean doReleaseMemory = Standard_True)
|
||||
{ Destroy (DataMapNode::delNode, this->myAllocator, doReleaseMemory); }
|
||||
{ Destroy (DataMapNode::delNode, doReleaseMemory); }
|
||||
|
||||
//! Clear data and reset allocator
|
||||
void Clear (const Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
@ -372,17 +362,8 @@ template < class TheKeyType,
|
||||
{ Clear(); }
|
||||
|
||||
//! Size
|
||||
virtual Standard_Integer Size(void) const
|
||||
Standard_Integer Size(void) const
|
||||
{ return Extent(); }
|
||||
|
||||
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
|
||||
|
@ -37,7 +37,6 @@
|
||||
#ifndef NCollection_DefineArray1_HeaderFile
|
||||
#define NCollection_DefineArray1_HeaderFile
|
||||
|
||||
#include <NCollection_DefineBaseCollection.hxx>
|
||||
#include <NCollection_Array1.hxx>
|
||||
|
||||
// *********************************************** Template for Array1 class
|
||||
|
@ -26,7 +26,6 @@
|
||||
#ifndef NCollection_DefineArray2_HeaderFile
|
||||
#define NCollection_DefineArray2_HeaderFile
|
||||
|
||||
#include <NCollection_DefineBaseCollection.hxx>
|
||||
#include <NCollection_Array2.hxx>
|
||||
|
||||
// *********************************************** Template for Array2 class
|
||||
|
@ -1,45 +0,0 @@
|
||||
// Created on: 2002-04-09
|
||||
// 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.
|
||||
|
||||
// Purpose: NCollection_BaseCollection is the base abstract class for
|
||||
// all collection templates of this package.
|
||||
// The set of collections is similar to that of TCollection.
|
||||
// Also the methods of classes have mostly the same names for
|
||||
// easy switch from TCollection <-> NCollection containers.
|
||||
// NCollection is a nocdlpack, thus it is compiled without WOK.
|
||||
// BaseCollection allows assigning the collections of different
|
||||
// kinds (the items type being the same) with a few obvious
|
||||
// exclusions - one can not assign any collection to the map
|
||||
// having double data (two keys or a key plus value). Only the
|
||||
// maps of the very same type may be assigned through operator=
|
||||
// Said maps are: DoubleMap,
|
||||
// DataMap,
|
||||
// IndexedDataMap
|
||||
// For the users needing control over the memory usage the
|
||||
// allocators were added (see NCollection_BaseAllocator header)
|
||||
// Others may forget it - BaseAllocator is used by default and
|
||||
// then memory is managed through Standard::Allocate/::Free.
|
||||
|
||||
#ifndef NCollection_DefineBaseCollection_HeaderFile
|
||||
#define NCollection_DefineBaseCollection_HeaderFile
|
||||
|
||||
#include <NCollection_BaseCollection.hxx>
|
||||
|
||||
// *************************************** Template for BaseCollection class
|
||||
|
||||
#define DEFINE_BASECOLLECTION(_ClassName_, TheItemType) \
|
||||
typedef NCollection_BaseCollection<TheItemType > _ClassName_;
|
||||
|
||||
#endif
|
@ -29,7 +29,6 @@
|
||||
#ifndef NCollection_DefineDataMap_HeaderFile
|
||||
#define NCollection_DefineDataMap_HeaderFile
|
||||
|
||||
#include <NCollection_DefineBaseCollection.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
// *********************************************** Class DataMap *************
|
||||
|
@ -21,7 +21,6 @@
|
||||
#ifndef NCollection_DefineDoubleMap_HeaderFile
|
||||
#define NCollection_DefineDoubleMap_HeaderFile
|
||||
|
||||
#include <NCollection_DefineBaseCollection.hxx>
|
||||
#include <NCollection_DoubleMap.hxx>
|
||||
|
||||
// *********************************************** Class DoubleMap ************
|
||||
|
@ -29,6 +29,8 @@
|
||||
class HClassName : public _Array1Type_, \
|
||||
public MMgt_TShared { \
|
||||
public: \
|
||||
DEFINE_STANDARD_ALLOC \
|
||||
DEFINE_NCOLLECTION_ALLOC \
|
||||
inline HClassName (const Standard_Integer theLower, \
|
||||
const Standard_Integer theUpper); \
|
||||
inline HClassName (const _Array1Type_&); \
|
||||
|
@ -29,6 +29,8 @@
|
||||
class HClassName : public _Array2Type_, \
|
||||
public MMgt_TShared { \
|
||||
public: \
|
||||
DEFINE_STANDARD_ALLOC \
|
||||
DEFINE_NCOLLECTION_ALLOC \
|
||||
inline HClassName (const Standard_Integer theRowLower, \
|
||||
const Standard_Integer theRowUpper, \
|
||||
const Standard_Integer theColLower, \
|
||||
|
@ -29,6 +29,8 @@
|
||||
class HClassName : public _SequenceType_, \
|
||||
public MMgt_TShared { \
|
||||
public: \
|
||||
DEFINE_STANDARD_ALLOC \
|
||||
DEFINE_NCOLLECTION_ALLOC \
|
||||
inline HClassName (); \
|
||||
inline HClassName (const _SequenceType_&); \
|
||||
inline const _SequenceType_& Sequence () const; \
|
||||
|
@ -31,7 +31,6 @@
|
||||
#ifndef NCollection_DefineIndexedDataMap_HeaderFile
|
||||
#define NCollection_DefineIndexedDataMap_HeaderFile
|
||||
|
||||
#include <NCollection_DefineBaseCollection.hxx>
|
||||
#include <NCollection_IndexedDataMap.hxx>
|
||||
|
||||
// *********************************************** Class IndexedDataMap ******
|
||||
|
@ -25,7 +25,6 @@
|
||||
#ifndef NCollection_DefineIndexedMap_HeaderFile
|
||||
#define NCollection_DefineIndexedMap_HeaderFile
|
||||
|
||||
#include <NCollection_DefineBaseCollection.hxx>
|
||||
#include <NCollection_IndexedMap.hxx>
|
||||
|
||||
// *********************************************** Class IndexedMap ***********
|
||||
|
@ -37,7 +37,6 @@
|
||||
#ifndef NCollection_DefineMap_HeaderFile
|
||||
#define NCollection_DefineMap_HeaderFile
|
||||
|
||||
#include <NCollection_DefineBaseCollection.hxx>
|
||||
#include <NCollection_Map.hxx>
|
||||
|
||||
// *********************************************** Class Map *****************
|
||||
|
@ -21,7 +21,6 @@
|
||||
#ifndef NCollection_DefineSequence_HeaderFile
|
||||
#define NCollection_DefineSequence_HeaderFile
|
||||
|
||||
#include <NCollection_DefineBaseCollection.hxx>
|
||||
#include <NCollection_Sequence.hxx>
|
||||
|
||||
// **************************************** Template for Sequence class ********
|
||||
|
@ -1,30 +0,0 @@
|
||||
// Created on: 2002-04-23
|
||||
// Created by: Alexander KARTOMIN
|
||||
// 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.
|
||||
|
||||
// Purpose: This Iterator class iterates on BaseList of TListNode and is
|
||||
// instantiated in List/Set/Queue/Stack
|
||||
// Remark: TListIterator is internal class
|
||||
|
||||
#ifndef NCollection_DefineTListIterator_HeaderFile
|
||||
#define NCollection_DefineTListIterator_HeaderFile
|
||||
|
||||
#include <NCollection_DefineBaseCollection.hxx>
|
||||
#include <NCollection_TListIterator.hxx>
|
||||
|
||||
// ********************************** Implementation of the Iterator interface
|
||||
#define DEFINE_TLISTITERATOR(_ClassName_, _BaseCollection_, TheItemType) \
|
||||
typedef NCollection_TListIterator<TheItemType > _ClassName_;
|
||||
|
||||
#endif
|
@ -1,28 +0,0 @@
|
||||
// Created on: 2002-04-23
|
||||
// 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.
|
||||
|
||||
// Purpose: Abstract list node class. Used by BaseList
|
||||
// Remark: Internal class
|
||||
|
||||
#ifndef NCollection_DefineTListNode_HeaderFile
|
||||
#define NCollection_DefineTListNode_HeaderFile
|
||||
|
||||
#include <NCollection_TListNode.hxx>
|
||||
|
||||
// ******************************* Class defining list node - for internal use
|
||||
#define DEFINE_TLISTNODE(_ClassName_, _BaseCollection_, TheItemType) \
|
||||
typedef NCollection_TListNode<TheItemType > _ClassName_;
|
||||
|
||||
#endif
|
@ -19,7 +19,6 @@
|
||||
#ifndef NCollection_DefineVector_HeaderFile
|
||||
#define NCollection_DefineVector_HeaderFile
|
||||
|
||||
#include <NCollection_DefineBaseCollection.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
|
||||
// Class NCollection_Vector (dynamic array of objects)
|
||||
|
@ -17,7 +17,6 @@
|
||||
#define NCollection_DoubleMap_HeaderFile
|
||||
|
||||
#include <NCollection_TypeDef.hxx>
|
||||
#include <NCollection_BaseCollection.hxx>
|
||||
#include <NCollection_BaseMap.hxx>
|
||||
#include <NCollection_TListNode.hxx>
|
||||
#include <Standard_TypeMismatch.hxx>
|
||||
@ -38,9 +37,8 @@
|
||||
template < class TheKey1Type,
|
||||
class TheKey2Type,
|
||||
class Hasher1 = NCollection_DefaultHasher<TheKey1Type>,
|
||||
class Hasher2 = NCollection_DefaultHasher<TheKey2Type> > class NCollection_DoubleMap
|
||||
: public NCollection_BaseCollection<TheKey2Type>,
|
||||
public NCollection_BaseMap
|
||||
class Hasher2 = NCollection_DefaultHasher<TheKey2Type> >
|
||||
class NCollection_DoubleMap : public NCollection_BaseMap
|
||||
{
|
||||
// **************** Adaptation of the TListNode to the DOUBLEmap
|
||||
public:
|
||||
@ -82,22 +80,19 @@ template < class TheKey1Type,
|
||||
|
||||
public:
|
||||
// **************** Implementation of the Iterator interface.
|
||||
class Iterator
|
||||
: public NCollection_BaseCollection<TheKey2Type>::Iterator,
|
||||
public NCollection_BaseMap::Iterator
|
||||
class Iterator : public NCollection_BaseMap::Iterator
|
||||
{
|
||||
public:
|
||||
//! Empty constructor
|
||||
Iterator (void) :
|
||||
NCollection_BaseMap::Iterator() {}
|
||||
Iterator (void) {}
|
||||
//! Constructor
|
||||
Iterator (const NCollection_DoubleMap& theMap) :
|
||||
NCollection_BaseMap::Iterator(theMap) {}
|
||||
//! Query if the end of collection is reached by iterator
|
||||
virtual Standard_Boolean More(void) const
|
||||
Standard_Boolean More(void) const
|
||||
{ return PMore(); }
|
||||
//! Make a step along the collection
|
||||
virtual void Next(void)
|
||||
void Next(void)
|
||||
{ PNext(); }
|
||||
//! Key1 inquiry
|
||||
const TheKey1Type& Key1(void) const
|
||||
@ -118,7 +113,7 @@ template < class TheKey1Type,
|
||||
return ((DoubleMapNode *) myNode)->Key2();
|
||||
}
|
||||
//! Value access
|
||||
virtual const TheKey2Type& Value(void) const
|
||||
const TheKey2Type& Value(void) const
|
||||
{
|
||||
#if !defined No_Exception && !defined No_Standard_NoSuchObject
|
||||
if (!More())
|
||||
@ -127,7 +122,7 @@ template < class TheKey1Type,
|
||||
return ((DoubleMapNode *) myNode)->Value();
|
||||
}
|
||||
//! Value change access - denied
|
||||
virtual TheKey2Type& ChangeValue(void) const
|
||||
TheKey2Type& ChangeValue(void) const
|
||||
{
|
||||
Standard_ImmutableObject::Raise("NCollection_DoubleMap::Iterator::ChangeValue");
|
||||
return * (TheKey2Type *) NULL; // For compiler
|
||||
@ -140,33 +135,22 @@ template < class TheKey1Type,
|
||||
//! Constructor
|
||||
NCollection_DoubleMap (const Standard_Integer NbBuckets=1,
|
||||
const Handle(NCollection_BaseAllocator)& theAllocator = 0L)
|
||||
: NCollection_BaseCollection<TheKey2Type>(theAllocator),
|
||||
NCollection_BaseMap (NbBuckets, Standard_False) {}
|
||||
: NCollection_BaseMap (NbBuckets, Standard_False, theAllocator) {}
|
||||
|
||||
//! Copy constructor
|
||||
NCollection_DoubleMap (const NCollection_DoubleMap& theOther)
|
||||
: NCollection_BaseCollection<TheKey2Type>(theOther.myAllocator),
|
||||
NCollection_BaseMap (theOther.NbBuckets(), Standard_False)
|
||||
: NCollection_BaseMap (theOther.NbBuckets(), Standard_False, theOther.myAllocator)
|
||||
{ *this = theOther; }
|
||||
|
||||
//! Assign another collection
|
||||
virtual void Assign(const NCollection_BaseCollection<TheKey2Type>& theOther)
|
||||
{
|
||||
if (this == &theOther)
|
||||
return;
|
||||
Standard_TypeMismatch::Raise ("NCollection_DoubleMap::Assign impossible");
|
||||
}
|
||||
|
||||
//! Exchange the content of two maps without re-allocations.
|
||||
//! Notice that allocators will be swapped as well!
|
||||
void Exchange (NCollection_DoubleMap& theOther)
|
||||
{
|
||||
this->exchangeAllocators (theOther);
|
||||
this->exchangeMapsData (theOther);
|
||||
this->exchangeMapsData (theOther);
|
||||
}
|
||||
|
||||
//! = another map
|
||||
NCollection_DoubleMap& operator=(const NCollection_DoubleMap& theOther)
|
||||
//! Assignment
|
||||
NCollection_DoubleMap& Assign (const NCollection_DoubleMap& theOther)
|
||||
{
|
||||
if (this == &theOther)
|
||||
return *this;
|
||||
@ -190,13 +174,19 @@ template < class TheKey1Type,
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Assignment operator
|
||||
NCollection_DoubleMap& operator= (const NCollection_DoubleMap& theOther)
|
||||
{
|
||||
return Assign (theOther);
|
||||
}
|
||||
|
||||
//! ReSize
|
||||
void ReSize (const Standard_Integer N)
|
||||
{
|
||||
NCollection_ListNode** ppNewData1 = NULL;
|
||||
NCollection_ListNode** ppNewData2 = NULL;
|
||||
Standard_Integer newBuck;
|
||||
if (BeginResize (N, newBuck, ppNewData1, ppNewData2, this->myAllocator))
|
||||
if (BeginResize (N, newBuck, ppNewData1, ppNewData2))
|
||||
{
|
||||
if (myData1)
|
||||
{
|
||||
@ -221,7 +211,7 @@ template < class TheKey1Type,
|
||||
}
|
||||
}
|
||||
}
|
||||
EndResize (N, newBuck, ppNewData1, ppNewData2, this->myAllocator);
|
||||
EndResize (N, newBuck, ppNewData1, ppNewData2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -450,7 +440,7 @@ template < class TheKey1Type,
|
||||
//! Clear data. If doReleaseMemory is false then the table of
|
||||
//! buckets is not released and will be reused.
|
||||
void Clear(const Standard_Boolean doReleaseMemory = Standard_True)
|
||||
{ Destroy (DoubleMapNode::delNode, this->myAllocator, doReleaseMemory); }
|
||||
{ Destroy (DoubleMapNode::delNode, doReleaseMemory); }
|
||||
|
||||
//! Clear data and reset allocator
|
||||
void Clear (const Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
@ -465,17 +455,8 @@ template < class TheKey1Type,
|
||||
{ Clear(); }
|
||||
|
||||
//! Size
|
||||
virtual Standard_Integer Size(void) const
|
||||
Standard_Integer Size(void) const
|
||||
{ return Extent(); }
|
||||
|
||||
private:
|
||||
// ----------- PRIVATE METHODS -----------
|
||||
|
||||
//! Creates Iterator for use on BaseCollection
|
||||
virtual TYPENAME NCollection_BaseCollection<TheKey2Type>::Iterator&
|
||||
CreateIterator(void) const
|
||||
{ return *(new (this->IterAllocator()) Iterator(*this)); }
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -16,7 +16,6 @@
|
||||
#ifndef NCollection_IndexedDataMap_HeaderFile
|
||||
#define NCollection_IndexedDataMap_HeaderFile
|
||||
|
||||
#include <NCollection_BaseCollection.hxx>
|
||||
#include <NCollection_BaseMap.hxx>
|
||||
#include <NCollection_TListNode.hxx>
|
||||
#include <Standard_TypeMismatch.hxx>
|
||||
@ -50,9 +49,7 @@
|
||||
template < class TheKeyType,
|
||||
class TheItemType,
|
||||
class Hasher = NCollection_DefaultHasher<TheKeyType> >
|
||||
class NCollection_IndexedDataMap
|
||||
: public NCollection_BaseCollection<TheItemType>,
|
||||
public NCollection_BaseMap
|
||||
class NCollection_IndexedDataMap : public NCollection_BaseMap
|
||||
{
|
||||
//! Adaptation of the TListNode to the INDEXEDDatamap
|
||||
private:
|
||||
@ -96,7 +93,7 @@ template < class TheKeyType,
|
||||
|
||||
public:
|
||||
//! Implementation of the Iterator interface.
|
||||
class Iterator : public NCollection_BaseCollection<TheItemType>::Iterator
|
||||
class Iterator
|
||||
{
|
||||
public:
|
||||
//! Empty constructor
|
||||
@ -109,15 +106,15 @@ template < class TheKeyType,
|
||||
myNode (myMap->nodeFromIndex (1)),
|
||||
myIndex (1) {}
|
||||
//! Query if the end of collection is reached by iterator
|
||||
virtual Standard_Boolean More(void) const
|
||||
Standard_Boolean More(void) const
|
||||
{ return (myMap != NULL) && (myIndex <= myMap->Extent()); }
|
||||
//! Make a step along the collection
|
||||
virtual void Next(void)
|
||||
void Next(void)
|
||||
{
|
||||
myNode = myMap->nodeFromIndex (++myIndex);
|
||||
}
|
||||
//! Value access
|
||||
virtual const TheItemType& Value(void) const
|
||||
const TheItemType& Value(void) const
|
||||
{
|
||||
#if !defined No_Exception && !defined No_Standard_NoSuchObject
|
||||
if (!More())
|
||||
@ -126,7 +123,7 @@ template < class TheKeyType,
|
||||
return myNode->Value();
|
||||
}
|
||||
//! ChangeValue access
|
||||
virtual TheItemType& ChangeValue(void) const
|
||||
TheItemType& ChangeValue(void) const
|
||||
{
|
||||
#if !defined No_Exception && !defined No_Standard_NoSuchObject
|
||||
if (!More())
|
||||
@ -144,7 +141,7 @@ template < class TheKeyType,
|
||||
return myNode->Key1();
|
||||
}
|
||||
//! Performs comparison of two iterators.
|
||||
virtual Standard_Boolean IsEqual (const Iterator& theOther) const
|
||||
Standard_Boolean IsEqual (const Iterator& theOther) const
|
||||
{
|
||||
return myMap == theOther.myMap &&
|
||||
myNode == theOther.myNode &&
|
||||
@ -180,34 +177,22 @@ template < class TheKeyType,
|
||||
//! Constructor
|
||||
NCollection_IndexedDataMap (const Standard_Integer NbBuckets=1,
|
||||
const Handle(NCollection_BaseAllocator)& theAllocator = 0L)
|
||||
: NCollection_BaseCollection<TheItemType>(theAllocator),
|
||||
NCollection_BaseMap (NbBuckets, Standard_False) {}
|
||||
: NCollection_BaseMap (NbBuckets, Standard_False, theAllocator) {}
|
||||
|
||||
//! Copy constructor
|
||||
NCollection_IndexedDataMap (const NCollection_IndexedDataMap& theOther)
|
||||
: NCollection_BaseCollection<TheItemType>(theOther.myAllocator),
|
||||
NCollection_BaseMap (theOther.NbBuckets(), Standard_False)
|
||||
: NCollection_BaseMap (theOther.NbBuckets(), Standard_False, theOther.myAllocator)
|
||||
{ *this = theOther; }
|
||||
|
||||
//! Assign another collection
|
||||
virtual void Assign(const NCollection_BaseCollection<TheItemType>& theOther)
|
||||
{
|
||||
if (this == &theOther)
|
||||
return;
|
||||
Standard_TypeMismatch::Raise("NCollection_IndexedDataMap::Assign");
|
||||
}
|
||||
|
||||
//! Exchange the content of two maps without re-allocations.
|
||||
//! Notice that allocators will be swapped as well!
|
||||
void Exchange (NCollection_IndexedDataMap& theOther)
|
||||
{
|
||||
this->exchangeAllocators (theOther);
|
||||
this->exchangeMapsData (theOther);
|
||||
this->exchangeMapsData (theOther);
|
||||
}
|
||||
|
||||
//! = another map
|
||||
NCollection_IndexedDataMap& operator=
|
||||
(const NCollection_IndexedDataMap& theOther)
|
||||
//! Assignment
|
||||
NCollection_IndexedDataMap& Assign (const NCollection_IndexedDataMap& theOther)
|
||||
{
|
||||
if (this == &theOther)
|
||||
return *this;
|
||||
@ -231,13 +216,19 @@ template < class TheKeyType,
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Assignment operator
|
||||
NCollection_IndexedDataMap& operator= (const NCollection_IndexedDataMap& theOther)
|
||||
{
|
||||
return Assign (theOther);
|
||||
}
|
||||
|
||||
//! ReSize
|
||||
void ReSize (const Standard_Integer N)
|
||||
{
|
||||
NCollection_ListNode** ppNewData1 = NULL;
|
||||
NCollection_ListNode** ppNewData2 = NULL;
|
||||
Standard_Integer newBuck;
|
||||
if (BeginResize (N, newBuck, ppNewData1, ppNewData2, this->myAllocator))
|
||||
if (BeginResize (N, newBuck, ppNewData1, ppNewData2))
|
||||
{
|
||||
if (myData1)
|
||||
{
|
||||
@ -262,7 +253,7 @@ template < class TheKeyType,
|
||||
}
|
||||
}
|
||||
}
|
||||
EndResize (N, newBuck, ppNewData1, ppNewData2, this->myAllocator);
|
||||
EndResize (N, newBuck, ppNewData1, ppNewData2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -525,7 +516,7 @@ template < class TheKeyType,
|
||||
//! Clear data. If doReleaseMemory is false then the table of
|
||||
//! buckets is not released and will be reused.
|
||||
void Clear(const Standard_Boolean doReleaseMemory = Standard_True)
|
||||
{ Destroy (IndexedDataMapNode::delNode, this->myAllocator, doReleaseMemory); }
|
||||
{ Destroy (IndexedDataMapNode::delNode, doReleaseMemory); }
|
||||
|
||||
//! Clear data and reset allocator
|
||||
void Clear (const Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
@ -540,17 +531,12 @@ template < class TheKeyType,
|
||||
{ Clear(); }
|
||||
|
||||
//! Size
|
||||
virtual Standard_Integer Size(void) const
|
||||
Standard_Integer Size(void) const
|
||||
{ return Extent(); }
|
||||
|
||||
private:
|
||||
// ----------- PRIVATE METHODS -----------
|
||||
|
||||
//! Creates Iterator for use on BaseCollection
|
||||
virtual TYPENAME NCollection_BaseCollection<TheItemType>::Iterator&
|
||||
CreateIterator(void) const
|
||||
{ return *(new (this->IterAllocator()) Iterator(*this)); }
|
||||
|
||||
//! Find map node associated with specified index.
|
||||
//! Return NULL if not found (exception-free internal implementation).
|
||||
IndexedDataMapNode* nodeFromIndex (const Standard_Integer theKey2) const
|
||||
|
@ -16,7 +16,6 @@
|
||||
#ifndef NCollection_IndexedMap_HeaderFile
|
||||
#define NCollection_IndexedMap_HeaderFile
|
||||
|
||||
#include <NCollection_BaseCollection.hxx>
|
||||
#include <NCollection_BaseMap.hxx>
|
||||
#include <NCollection_TListNode.hxx>
|
||||
#include <NCollection_StlIterator.hxx>
|
||||
@ -42,9 +41,7 @@
|
||||
|
||||
template < class TheKeyType,
|
||||
class Hasher = NCollection_DefaultHasher<TheKeyType> >
|
||||
class NCollection_IndexedMap
|
||||
: public NCollection_BaseCollection<TheKeyType>,
|
||||
public NCollection_BaseMap
|
||||
class NCollection_IndexedMap : public NCollection_BaseMap
|
||||
{
|
||||
// **************** Adaptation of the TListNode to the INDEXEDmap
|
||||
private:
|
||||
@ -87,7 +84,6 @@ template < class TheKeyType,
|
||||
public:
|
||||
// **************** Implementation of the Iterator interface.
|
||||
class Iterator
|
||||
: public NCollection_BaseCollection<TheKeyType>::Iterator
|
||||
{
|
||||
public:
|
||||
//! Empty constructor
|
||||
@ -99,13 +95,13 @@ template < class TheKeyType,
|
||||
myMap((NCollection_IndexedMap *) &theMap),
|
||||
myIndex(1) {}
|
||||
//! Query if the end of collection is reached by iterator
|
||||
virtual Standard_Boolean More(void) const
|
||||
Standard_Boolean More(void) const
|
||||
{ return (myMap != NULL) && (myIndex <= myMap->Extent()); }
|
||||
//! Make a step along the collection
|
||||
virtual void Next(void)
|
||||
void Next(void)
|
||||
{ myIndex++; }
|
||||
//! Value access
|
||||
virtual const TheKeyType& Value(void) const
|
||||
const TheKeyType& Value(void) const
|
||||
{
|
||||
#if !defined No_Exception && !defined No_Standard_NoSuchObject
|
||||
if (!More())
|
||||
@ -114,13 +110,13 @@ template < class TheKeyType,
|
||||
return myMap->FindKey(myIndex);
|
||||
}
|
||||
//! Value change access denied - use Substitute
|
||||
virtual TheKeyType& ChangeValue(void) const
|
||||
TheKeyType& ChangeValue(void) const
|
||||
{
|
||||
Standard_ImmutableObject::Raise ("impossible to ChangeValue");
|
||||
return * (TheKeyType *) NULL; // This for compiler
|
||||
}
|
||||
//! Performs comparison of two iterators.
|
||||
virtual Standard_Boolean IsEqual (const Iterator& theOther) const
|
||||
Standard_Boolean IsEqual (const Iterator& theOther) const
|
||||
{
|
||||
return myMap == theOther.myMap && myIndex == theOther.myIndex;
|
||||
}
|
||||
@ -144,39 +140,23 @@ template < class TheKeyType,
|
||||
|
||||
//! Constructor
|
||||
NCollection_IndexedMap (const Standard_Integer NbBuckets=1,
|
||||
const Handle(NCollection_BaseAllocator)& theAllocator=0L) :
|
||||
NCollection_BaseCollection<TheKeyType>(theAllocator),
|
||||
NCollection_BaseMap (NbBuckets, Standard_False) {}
|
||||
const Handle(NCollection_BaseAllocator)& theAllocator=0L)
|
||||
: NCollection_BaseMap (NbBuckets, Standard_False, theAllocator) {}
|
||||
|
||||
//! Copy constructor
|
||||
NCollection_IndexedMap (const NCollection_IndexedMap& theOther) :
|
||||
NCollection_BaseCollection<TheKeyType>(theOther.myAllocator),
|
||||
NCollection_BaseMap (theOther.NbBuckets(), Standard_False)
|
||||
NCollection_IndexedMap (const NCollection_IndexedMap& theOther)
|
||||
: NCollection_BaseMap (theOther.NbBuckets(), Standard_False, theOther.myAllocator)
|
||||
{ *this = theOther; }
|
||||
|
||||
//! Assign another collection
|
||||
virtual void Assign (const NCollection_BaseCollection<TheKeyType>& theOther)
|
||||
{
|
||||
if (this == &theOther)
|
||||
return;
|
||||
Clear();
|
||||
ReSize (theOther.Size()-1);
|
||||
TYPENAME NCollection_BaseCollection<TheKeyType>::Iterator& anIter =
|
||||
theOther.CreateIterator();
|
||||
for (; anIter.More(); anIter.Next())
|
||||
Add(anIter.Value());
|
||||
}
|
||||
|
||||
//! Exchange the content of two maps without re-allocations.
|
||||
//! Notice that allocators will be swapped as well!
|
||||
void Exchange (NCollection_IndexedMap& theOther)
|
||||
{
|
||||
this->exchangeAllocators (theOther);
|
||||
this->exchangeMapsData (theOther);
|
||||
this->exchangeMapsData (theOther);
|
||||
}
|
||||
|
||||
//! = another map
|
||||
NCollection_IndexedMap& operator= (const NCollection_IndexedMap& theOther)
|
||||
//! Assign
|
||||
NCollection_IndexedMap& Assign (const NCollection_IndexedMap& theOther)
|
||||
{
|
||||
if (this == &theOther)
|
||||
return *this;
|
||||
@ -199,13 +179,19 @@ template < class TheKeyType,
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Assignment operator
|
||||
NCollection_IndexedMap& operator= (const NCollection_IndexedMap& theOther)
|
||||
{
|
||||
return Assign (theOther);
|
||||
}
|
||||
|
||||
//! ReSize
|
||||
void ReSize (const Standard_Integer N)
|
||||
{
|
||||
NCollection_ListNode** ppNewData1 = NULL;
|
||||
NCollection_ListNode** ppNewData2 = NULL;
|
||||
Standard_Integer newBuck;
|
||||
if (BeginResize (N, newBuck, ppNewData1, ppNewData2, this->myAllocator))
|
||||
if (BeginResize (N, newBuck, ppNewData1, ppNewData2))
|
||||
{
|
||||
if (myData1)
|
||||
{
|
||||
@ -233,7 +219,7 @@ template < class TheKeyType,
|
||||
}
|
||||
}
|
||||
}
|
||||
EndResize (N, newBuck, ppNewData1, ppNewData2, this->myAllocator);
|
||||
EndResize (N, newBuck, ppNewData1, ppNewData2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -405,7 +391,7 @@ template < class TheKeyType,
|
||||
//! Clear data. If doReleaseMemory is false then the table of
|
||||
//! buckets is not released and will be reused.
|
||||
void Clear(const Standard_Boolean doReleaseMemory = Standard_True)
|
||||
{ Destroy (IndexedMapNode::delNode, this->myAllocator, doReleaseMemory); }
|
||||
{ Destroy (IndexedMapNode::delNode, doReleaseMemory); }
|
||||
|
||||
//! Clear data and reset allocator
|
||||
void Clear (const Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
@ -420,17 +406,8 @@ template < class TheKeyType,
|
||||
{ Clear(); }
|
||||
|
||||
//! Size
|
||||
virtual Standard_Integer Size(void) const
|
||||
Standard_Integer Size(void) const
|
||||
{ return Extent(); }
|
||||
|
||||
private:
|
||||
// ----------- PRIVATE METHODS -----------
|
||||
|
||||
//! Creates Iterator for use on BaseCollection
|
||||
virtual TYPENAME NCollection_BaseCollection<TheKeyType>::Iterator&
|
||||
CreateIterator(void) const
|
||||
{ return *(new (this->IterAllocator()) Iterator(*this)); }
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -28,9 +28,8 @@
|
||||
* and the last one.
|
||||
* Inherits BaseList, adding the data item to each node.
|
||||
*/
|
||||
template <class TheItemType> class NCollection_List
|
||||
: public NCollection_BaseCollection<TheItemType>,
|
||||
public NCollection_BaseList
|
||||
template <class TheItemType>
|
||||
class NCollection_List : public NCollection_BaseList
|
||||
{
|
||||
public:
|
||||
//! STL-compliant typedef for value type
|
||||
@ -63,57 +62,39 @@ public:
|
||||
|
||||
//! Constructor
|
||||
NCollection_List(const Handle(NCollection_BaseAllocator)& theAllocator=0L) :
|
||||
NCollection_BaseCollection<TheItemType>(theAllocator),
|
||||
NCollection_BaseList() {}
|
||||
NCollection_BaseList(theAllocator) {}
|
||||
|
||||
//! Copy constructor
|
||||
NCollection_List (const NCollection_List& theOther) :
|
||||
NCollection_BaseCollection<TheItemType>(theOther.myAllocator),
|
||||
NCollection_BaseList()
|
||||
{ *this = theOther; }
|
||||
NCollection_BaseList(theOther.myAllocator)
|
||||
{
|
||||
Assign (theOther);
|
||||
}
|
||||
|
||||
//! Size - Number of items
|
||||
virtual Standard_Integer Size (void) const
|
||||
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())
|
||||
{
|
||||
ListNode* pNew = new (this->myAllocator) ListNode(anIter.Value());
|
||||
PAppend(pNew);
|
||||
}
|
||||
}
|
||||
|
||||
//! Replace this list by the items of another list (theOther parameter)
|
||||
void Assign (const NCollection_List& theOther)
|
||||
{
|
||||
if (this != &theOther) {
|
||||
Clear();
|
||||
Clear(theOther.myAllocator);
|
||||
appendList(theOther.PFirst());
|
||||
}
|
||||
}
|
||||
|
||||
//! Replace this list by the items of theOther list
|
||||
//! Replacement operator
|
||||
NCollection_List& operator= (const NCollection_List& theOther)
|
||||
{
|
||||
if (this != &theOther) {
|
||||
Clear (theOther.myAllocator);
|
||||
appendList(theOther.PFirst());
|
||||
}
|
||||
Assign (theOther);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Clear this list
|
||||
void Clear (const Handle(NCollection_BaseAllocator)& theAllocator=0L)
|
||||
{
|
||||
PClear (ListNode::delNode, this->myAllocator);
|
||||
PClear (ListNode::delNode);
|
||||
if (!theAllocator.IsNull())
|
||||
this->myAllocator = theAllocator;
|
||||
}
|
||||
@ -203,12 +184,12 @@ public:
|
||||
|
||||
//! RemoveFirst item
|
||||
void RemoveFirst (void)
|
||||
{ PRemoveFirst (ListNode::delNode, this->myAllocator); }
|
||||
{ PRemoveFirst (ListNode::delNode); }
|
||||
|
||||
//! Remove item
|
||||
void Remove (Iterator& theIter)
|
||||
{
|
||||
PRemove (theIter, ListNode::delNode, this->myAllocator);
|
||||
PRemove (theIter, ListNode::delNode);
|
||||
}
|
||||
|
||||
//! InsertBefore
|
||||
@ -291,11 +272,6 @@ public:
|
||||
private:
|
||||
// ----------- PRIVATE METHODS -----------
|
||||
|
||||
//! Creates Iterator for use on BaseCollection
|
||||
virtual TYPENAME NCollection_BaseCollection<TheItemType>::Iterator&
|
||||
CreateIterator(void) const
|
||||
{ return *(new (this->IterAllocator()) Iterator(*this)); }
|
||||
|
||||
//! append the list headed by the given ListNode
|
||||
void appendList(const NCollection_ListNode * pCur) {
|
||||
while (pCur) {
|
||||
|
@ -17,6 +17,7 @@
|
||||
#define NCollection_ListNode_HeaderFile
|
||||
|
||||
#include <NCollection_BaseAllocator.hxx>
|
||||
#include <NCollection_DefineAlloc.hxx>
|
||||
|
||||
/**
|
||||
* Purpose: This class is used to represent a node in the BaseList and
|
||||
@ -24,7 +25,10 @@
|
||||
*/
|
||||
class NCollection_ListNode
|
||||
{
|
||||
public:
|
||||
public:
|
||||
// define new operator for use with NCollection allocators
|
||||
DEFINE_NCOLLECTION_ALLOC
|
||||
public:
|
||||
//! The only constructor
|
||||
NCollection_ListNode (NCollection_ListNode* theNext)
|
||||
{ myNext = theNext; }
|
||||
@ -39,10 +43,10 @@ class NCollection_ListNode
|
||||
|
||||
private:
|
||||
//! operator= - forbidden
|
||||
NCollection_ListNode& operator=(const NCollection_ListNode& )
|
||||
{return *this;}
|
||||
NCollection_ListNode& operator= (const NCollection_ListNode&);
|
||||
|
||||
//! copy constructor - forbidden
|
||||
NCollection_ListNode (const NCollection_ListNode& ) {}
|
||||
NCollection_ListNode (const NCollection_ListNode&);
|
||||
|
||||
private:
|
||||
NCollection_ListNode * myNext; //!< Pointer to the next node
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
NCollection_LocalArray ()
|
||||
: myPtr (myBuffer) {}
|
||||
|
||||
virtual ~NCollection_LocalArray()
|
||||
~NCollection_LocalArray()
|
||||
{
|
||||
Deallocate();
|
||||
}
|
||||
|
@ -16,7 +16,6 @@
|
||||
#ifndef NCollection_Map_HeaderFile
|
||||
#define NCollection_Map_HeaderFile
|
||||
|
||||
#include <NCollection_BaseCollection.hxx>
|
||||
#include <NCollection_BaseMap.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <NCollection_TListNode.hxx>
|
||||
@ -58,9 +57,8 @@
|
||||
*/
|
||||
|
||||
template < class TheKeyType,
|
||||
class Hasher = NCollection_DefaultHasher<TheKeyType> > class NCollection_Map
|
||||
: public NCollection_BaseCollection<TheKeyType>,
|
||||
public NCollection_BaseMap
|
||||
class Hasher = NCollection_DefaultHasher<TheKeyType> >
|
||||
class NCollection_Map : public NCollection_BaseMap
|
||||
{
|
||||
//! Adaptation of the TListNode to the map notations
|
||||
public:
|
||||
@ -80,9 +78,7 @@ template < class TheKeyType,
|
||||
|
||||
public:
|
||||
//! Implementation of the Iterator interface.
|
||||
class Iterator
|
||||
: public NCollection_BaseCollection<TheKeyType>::Iterator,
|
||||
public NCollection_BaseMap::Iterator
|
||||
class Iterator : public NCollection_BaseMap::Iterator
|
||||
{
|
||||
public:
|
||||
//! Empty constructor
|
||||
@ -92,13 +88,13 @@ template < class TheKeyType,
|
||||
Iterator (const NCollection_Map& theMap) :
|
||||
NCollection_BaseMap::Iterator(theMap) {}
|
||||
//! Query if the end of collection is reached by iterator
|
||||
virtual Standard_Boolean More(void) const
|
||||
Standard_Boolean More(void) const
|
||||
{ return PMore(); }
|
||||
//! Make a step along the collection
|
||||
virtual void Next(void)
|
||||
void Next(void)
|
||||
{ PNext(); }
|
||||
//! Value inquiry
|
||||
virtual const TheKeyType& Value(void) const
|
||||
const TheKeyType& Value(void) const
|
||||
{
|
||||
#if !defined No_Exception && !defined No_Standard_NoSuchObject
|
||||
if (!More())
|
||||
@ -107,7 +103,7 @@ template < class TheKeyType,
|
||||
return ((MapNode *) myNode)->Value();
|
||||
}
|
||||
//! Value change access - denied
|
||||
virtual TheKeyType& ChangeValue(void) const
|
||||
TheKeyType& ChangeValue(void) const
|
||||
{
|
||||
Standard_ImmutableObject::Raise("NCollection_Map::Iterator::ChangeValue");
|
||||
return * (TheKeyType *) NULL; // For compiler
|
||||
@ -137,40 +133,23 @@ template < class TheKeyType,
|
||||
|
||||
//! Constructor
|
||||
NCollection_Map (const Standard_Integer NbBuckets = 1,
|
||||
const Handle(NCollection_BaseAllocator)& theAllocator = 0L)
|
||||
: NCollection_BaseCollection<TheKeyType>(theAllocator),
|
||||
NCollection_BaseMap (NbBuckets, Standard_True) {}
|
||||
const Handle(NCollection_BaseAllocator)& theAllocator = 0L) :
|
||||
NCollection_BaseMap (NbBuckets, Standard_True, theAllocator) {}
|
||||
|
||||
//! Copy constructor
|
||||
NCollection_Map (const NCollection_Map& theOther)
|
||||
: NCollection_BaseCollection<TheKeyType>(theOther.myAllocator),
|
||||
NCollection_BaseMap (theOther.NbBuckets(), Standard_True)
|
||||
NCollection_Map (const NCollection_Map& theOther) :
|
||||
NCollection_BaseMap (theOther.NbBuckets(), Standard_True, theOther.myAllocator)
|
||||
{ *this = theOther; }
|
||||
|
||||
//! Assign another collection
|
||||
virtual void Assign (const NCollection_BaseCollection<TheKeyType>& theOther)
|
||||
{
|
||||
if (this == &theOther)
|
||||
return;
|
||||
|
||||
Clear();
|
||||
ReSize (theOther.Size()-1);
|
||||
TYPENAME NCollection_BaseCollection<TheKeyType>::Iterator& anIter =
|
||||
theOther.CreateIterator();
|
||||
for (; anIter.More(); anIter.Next())
|
||||
Add (anIter.Value());
|
||||
}
|
||||
|
||||
//! Exchange the content of two maps without re-allocations.
|
||||
//! Notice that allocators will be swapped as well!
|
||||
void Exchange (NCollection_Map& theOther)
|
||||
{
|
||||
this->exchangeAllocators (theOther);
|
||||
this->exchangeMapsData (theOther);
|
||||
this->exchangeMapsData (theOther);
|
||||
}
|
||||
|
||||
//! = another map
|
||||
NCollection_Map& operator= (const NCollection_Map& theOther)
|
||||
//! Assign
|
||||
NCollection_Map& Assign (const NCollection_Map& theOther)
|
||||
{
|
||||
if (this == &theOther)
|
||||
return *this;
|
||||
@ -183,13 +162,19 @@ template < class TheKeyType,
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Assign operator
|
||||
NCollection_Map& operator= (const NCollection_Map& theOther)
|
||||
{
|
||||
return Assign(theOther);
|
||||
}
|
||||
|
||||
//! ReSize
|
||||
void ReSize (const Standard_Integer N)
|
||||
{
|
||||
NCollection_ListNode** newdata = 0L;
|
||||
NCollection_ListNode** dummy = 0L;
|
||||
Standard_Integer newBuck;
|
||||
if (BeginResize (N, newBuck, newdata, dummy, this->myAllocator))
|
||||
if (BeginResize (N, newBuck, newdata, dummy))
|
||||
{
|
||||
if (myData1)
|
||||
{
|
||||
@ -212,7 +197,7 @@ template < class TheKeyType,
|
||||
}
|
||||
}
|
||||
}
|
||||
EndResize (N, newBuck, newdata, dummy, this->myAllocator);
|
||||
EndResize (N, newBuck, newdata, dummy);
|
||||
}
|
||||
}
|
||||
|
||||
@ -302,7 +287,7 @@ template < class TheKeyType,
|
||||
//! Clear data. If doReleaseMemory is false then the table of
|
||||
//! buckets is not released and will be reused.
|
||||
void Clear(const Standard_Boolean doReleaseMemory = Standard_True)
|
||||
{ Destroy (MapNode::delNode, this->myAllocator, doReleaseMemory); }
|
||||
{ Destroy (MapNode::delNode, doReleaseMemory); }
|
||||
|
||||
//! Clear data and reset allocator
|
||||
void Clear (const Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
@ -317,7 +302,7 @@ template < class TheKeyType,
|
||||
{ Clear(); }
|
||||
|
||||
//! Size
|
||||
virtual Standard_Integer Size(void) const
|
||||
Standard_Integer Size(void) const
|
||||
{ return Extent(); }
|
||||
|
||||
public:
|
||||
@ -589,15 +574,6 @@ template < class TheKeyType,
|
||||
}
|
||||
|
||||
//!@}
|
||||
|
||||
private:
|
||||
// ----------- PRIVATE METHODS -----------
|
||||
|
||||
//! Creates Iterator for use on BaseCollection
|
||||
virtual TYPENAME NCollection_BaseCollection<TheKeyType>::Iterator&
|
||||
CreateIterator(void) const
|
||||
{ return *(new (this->IterAllocator()) Iterator(*this)); }
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -16,7 +16,6 @@
|
||||
#ifndef NCollection_Sequence_HeaderFile
|
||||
#define NCollection_Sequence_HeaderFile
|
||||
|
||||
#include <NCollection_BaseCollection.hxx>
|
||||
#include <NCollection_BaseSequence.hxx>
|
||||
#include <NCollection_StlIterator.hxx>
|
||||
|
||||
@ -29,9 +28,8 @@
|
||||
* Purpose: Definition of a sequence of elements indexed by
|
||||
* an Integer in range of 1..n
|
||||
*/
|
||||
template <class TheItemType> class NCollection_Sequence
|
||||
: public NCollection_BaseCollection<TheItemType>,
|
||||
public NCollection_BaseSequence
|
||||
template <class TheItemType>
|
||||
class NCollection_Sequence : public NCollection_BaseSequence
|
||||
{
|
||||
public:
|
||||
//! STL-compliant typedef for value type
|
||||
@ -50,9 +48,6 @@ public:
|
||||
const TheItemType& Value () const { return myValue; }
|
||||
//! Variable value access
|
||||
TheItemType& ChangeValue () { return myValue; }
|
||||
//! Memory allocation
|
||||
DEFINE_STANDARD_ALLOC
|
||||
DEFINE_NCOLLECTION_ALLOC
|
||||
|
||||
private:
|
||||
TheItemType myValue;
|
||||
@ -60,8 +55,7 @@ public:
|
||||
|
||||
public:
|
||||
//! Implementation of the Iterator interface.
|
||||
class Iterator : public NCollection_BaseCollection<TheItemType>::Iterator,
|
||||
public NCollection_BaseSequence::Iterator
|
||||
class Iterator : public NCollection_BaseSequence::Iterator
|
||||
{
|
||||
public:
|
||||
//! Empty constructor - for later Init
|
||||
@ -70,18 +64,11 @@ public:
|
||||
Iterator (const NCollection_Sequence& theSeq,
|
||||
const Standard_Boolean isStart = Standard_True)
|
||||
: NCollection_BaseSequence::Iterator (theSeq, isStart) {}
|
||||
//! Assignment
|
||||
Iterator& operator= (const Iterator& theIt)
|
||||
{
|
||||
NCollection_BaseSequence::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)
|
||||
{
|
||||
if (myCurrent)
|
||||
{
|
||||
@ -90,13 +77,13 @@ public:
|
||||
}
|
||||
}
|
||||
//! Constant value access
|
||||
virtual const TheItemType& Value (void) const
|
||||
const TheItemType& Value (void) const
|
||||
{ return ((const Node *)myCurrent)->Value(); }
|
||||
//! Variable value access
|
||||
virtual TheItemType& ChangeValue (void) const
|
||||
TheItemType& ChangeValue (void) const
|
||||
{ return ((Node *)myCurrent)->ChangeValue(); }
|
||||
//! Performs comparison of two iterators.
|
||||
virtual Standard_Boolean IsEqual (const Iterator& theOther) const
|
||||
Standard_Boolean IsEqual (const Iterator& theOther) const
|
||||
{
|
||||
return myCurrent == theOther.myCurrent;
|
||||
}
|
||||
@ -124,18 +111,18 @@ public:
|
||||
// ---------- PUBLIC METHODS ------------
|
||||
|
||||
//! Constructor
|
||||
NCollection_Sequence(const Handle(NCollection_BaseAllocator)& theAllocator=0L)
|
||||
: NCollection_BaseCollection<TheItemType>(theAllocator),
|
||||
NCollection_BaseSequence() {}
|
||||
NCollection_Sequence(const Handle(NCollection_BaseAllocator)& theAllocator=0L) :
|
||||
NCollection_BaseSequence(theAllocator) {}
|
||||
|
||||
//! Copy constructor
|
||||
NCollection_Sequence (const NCollection_Sequence& theOther) :
|
||||
NCollection_BaseCollection<TheItemType>(theOther.myAllocator),
|
||||
NCollection_BaseSequence()
|
||||
{ *this = theOther; }
|
||||
NCollection_BaseSequence(theOther.myAllocator)
|
||||
{
|
||||
Assign (theOther);
|
||||
}
|
||||
|
||||
//! Number of items
|
||||
virtual Standard_Integer Size (void) const
|
||||
Standard_Integer Size (void) const
|
||||
{ return mySize; }
|
||||
|
||||
//! Number of items
|
||||
@ -180,13 +167,13 @@ public:
|
||||
//! Clear the items out, take a new allocator if non null
|
||||
void Clear (const Handle(NCollection_BaseAllocator)& theAllocator=0L)
|
||||
{
|
||||
ClearSeq (delNode, this->myAllocator);
|
||||
ClearSeq (delNode);
|
||||
if (!theAllocator.IsNull())
|
||||
this->myAllocator = theAllocator;
|
||||
}
|
||||
|
||||
//! Replace this sequence by the items of theOther
|
||||
NCollection_Sequence& operator= (const NCollection_Sequence& theOther)
|
||||
NCollection_Sequence& Assign (const NCollection_Sequence& theOther)
|
||||
{
|
||||
if (this == &theOther)
|
||||
return *this;
|
||||
@ -200,30 +187,24 @@ public:
|
||||
return * this;
|
||||
}
|
||||
|
||||
//! Replace this sequence by the items of theOther collection
|
||||
virtual void Assign (const NCollection_BaseCollection<TheItemType>& theOther)
|
||||
//! Replacement operator
|
||||
NCollection_Sequence& operator= (const NCollection_Sequence& theOther)
|
||||
{
|
||||
if (this == &theOther)
|
||||
return;
|
||||
Clear ();
|
||||
TYPENAME NCollection_BaseCollection<TheItemType>::Iterator& anIter =
|
||||
theOther.CreateIterator();
|
||||
for (; anIter.More(); anIter.Next())
|
||||
Append(anIter.Value());
|
||||
return Assign (theOther);
|
||||
}
|
||||
|
||||
//! Remove one item
|
||||
void Remove (Iterator& thePosition)
|
||||
{ RemoveSeq (thePosition, delNode, this->myAllocator); }
|
||||
{ RemoveSeq (thePosition, delNode); }
|
||||
|
||||
//! Remove one item
|
||||
void Remove (const Standard_Integer theIndex)
|
||||
{ RemoveSeq (theIndex, delNode, this->myAllocator); }
|
||||
{ RemoveSeq (theIndex, delNode); }
|
||||
|
||||
//! Remove range of items
|
||||
void Remove (const Standard_Integer theFromIndex,
|
||||
const Standard_Integer theToIndex)
|
||||
{ RemoveSeq (theFromIndex, theToIndex, delNode, this->myAllocator); }
|
||||
{ RemoveSeq (theFromIndex, theToIndex, delNode); }
|
||||
|
||||
//! Append one item
|
||||
void Append (const TheItemType& theItem)
|
||||
@ -367,14 +348,7 @@ public:
|
||||
~NCollection_Sequence (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)); }
|
||||
|
||||
// ---------- FRIEND CLASSES ------------
|
||||
friend class Iterator;
|
||||
|
@ -1,37 +0,0 @@
|
||||
// Created on: 2003-05-04
|
||||
// Created by: Alexander Grigoriev
|
||||
// Copyright (c) 2003-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.
|
||||
|
||||
// DEFINITION OF BASE COLLECTIONS FOR Open Cascade STANDARD TYPES
|
||||
|
||||
#ifndef _NCollection_StdBase_HeaderFile
|
||||
#define _NCollection_StdBase_HeaderFile
|
||||
|
||||
#include <Standard_PrimitiveTypes.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <NCollection_DefineBaseCollection.hxx>
|
||||
|
||||
DEFINE_BASECOLLECTION(NCollection_BaseCollInteger , Standard_Integer)
|
||||
DEFINE_BASECOLLECTION(NCollection_BaseCollReal , Standard_Real)
|
||||
DEFINE_BASECOLLECTION(NCollection_BaseCollCharacter , Standard_Character)
|
||||
DEFINE_BASECOLLECTION(NCollection_BaseCollBoolean , Standard_Boolean)
|
||||
DEFINE_BASECOLLECTION(NCollection_BaseCollAsciiString ,
|
||||
TCollection_AsciiString)
|
||||
DEFINE_BASECOLLECTION(NCollection_BaseCollExtendedString,
|
||||
TCollection_ExtendedString)
|
||||
DEFINE_BASECOLLECTION(NCollection_BaseCollTransient ,
|
||||
Handle(Standard_Transient))
|
||||
|
||||
#endif
|
@ -68,7 +68,7 @@ namespace opencascade
|
||||
//! iterator requires Offset and Differ methods. See NCollection_Vector as
|
||||
//! example of declaring custom STL iterators.
|
||||
template<class Category, class BaseIterator, class ItemType, bool IsConstant>
|
||||
class NCollection_StlIterator : private BaseIterator,
|
||||
class NCollection_StlIterator :
|
||||
public std::iterator<Category, ItemType, ptrdiff_t,
|
||||
typename opencascade::conditional<IsConstant, const ItemType*, ItemType*>::type,
|
||||
typename opencascade::conditional<IsConstant, const ItemType&, ItemType&>::type>
|
||||
@ -80,22 +80,26 @@ public:
|
||||
|
||||
//! Constructor from NCollection iterator
|
||||
NCollection_StlIterator (const BaseIterator& theIterator)
|
||||
: BaseIterator (theIterator)
|
||||
: myIterator (theIterator)
|
||||
{ }
|
||||
|
||||
//! Cast from non-const variant to const one
|
||||
NCollection_StlIterator (const NCollection_StlIterator<Category, BaseIterator, ItemType, false>& theIterator)
|
||||
: BaseIterator (theIterator)
|
||||
: myIterator (theIterator.Iterator())
|
||||
{ }
|
||||
|
||||
//! Assignment of non-const iterator to const one
|
||||
NCollection_StlIterator& operator= (const NCollection_StlIterator<Category, BaseIterator, ItemType, false>& theIterator)
|
||||
{
|
||||
BaseIterator::operator= (theIterator);
|
||||
myIterator = theIterator.myIterator;
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend class NCollection_StlIterator<Category, BaseIterator, ItemType, !IsConstant>;
|
||||
//! Access to NCollection iterator instance
|
||||
const BaseIterator& Iterator () const
|
||||
{
|
||||
return myIterator;
|
||||
}
|
||||
|
||||
protected: //! @name methods related to forward STL iterator
|
||||
|
||||
@ -105,13 +109,13 @@ protected: //! @name methods related to forward STL iterator
|
||||
template<bool Condition>
|
||||
typename opencascade::enable_if<!Condition, ItemType&>::type Reference()
|
||||
{
|
||||
return BaseIterator::ChangeValue();
|
||||
return myIterator.ChangeValue();
|
||||
}
|
||||
|
||||
template<bool Condition>
|
||||
typename opencascade::enable_if<Condition, const ItemType&>::type Reference()
|
||||
{
|
||||
return BaseIterator::Value();
|
||||
return myIterator.Value();
|
||||
}
|
||||
|
||||
public: //! @name methods related to forward STL iterator
|
||||
@ -119,8 +123,8 @@ public: //! @name methods related to forward STL iterator
|
||||
//! Test for equality
|
||||
bool operator== (const NCollection_StlIterator& theOther) const
|
||||
{
|
||||
return BaseIterator::More() == theOther.More() &&
|
||||
(!BaseIterator::More() || BaseIterator::IsEqual (theOther));
|
||||
return myIterator.More() == theOther.myIterator.More() &&
|
||||
(!myIterator.More() || myIterator.IsEqual (theOther.myIterator));
|
||||
}
|
||||
|
||||
//! Test for inequality
|
||||
@ -144,7 +148,7 @@ public: //! @name methods related to forward STL iterator
|
||||
//! Prefix increment
|
||||
NCollection_StlIterator& operator++()
|
||||
{
|
||||
BaseIterator::Next();
|
||||
myIterator.Next();
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -163,7 +167,7 @@ public: //! @name methods related to bidirectional STL iterator
|
||||
{
|
||||
Standard_STATIC_ASSERT((opencascade::is_same<std::bidirectional_iterator_tag,Category>::value ||
|
||||
opencascade::is_same<std::random_access_iterator_tag,Category>::value));
|
||||
BaseIterator::Previous();
|
||||
myIterator.Previous();
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -181,7 +185,7 @@ public: //! @name methods related to random access STL iterator
|
||||
NCollection_StlIterator& operator+= (typename NCollection_StlIterator::difference_type theOffset)
|
||||
{
|
||||
Standard_STATIC_ASSERT((opencascade::is_same<std::random_access_iterator_tag,Category>::value));
|
||||
BaseIterator::Offset (theOffset);
|
||||
myIterator.Offset (theOffset);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -209,7 +213,7 @@ public: //! @name methods related to random access STL iterator
|
||||
typename NCollection_StlIterator::difference_type operator- (const NCollection_StlIterator& theOther) const
|
||||
{
|
||||
Standard_STATIC_ASSERT((opencascade::is_same<std::random_access_iterator_tag,Category>::value));
|
||||
return BaseIterator::Differ (theOther);
|
||||
return myIterator.Differ (theOther.myIterator);
|
||||
}
|
||||
|
||||
//! Get item at offset from current
|
||||
@ -241,6 +245,10 @@ public: //! @name methods related to random access STL iterator
|
||||
{
|
||||
return !(*this < theOther);
|
||||
}
|
||||
|
||||
private:
|
||||
//! NCollection iterator
|
||||
BaseIterator myIterator;
|
||||
};
|
||||
|
||||
#endif // NCollection_StlIterator_HeaderFile
|
||||
|
@ -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(); }
|
||||
};
|
||||
|
||||
|
@ -17,8 +17,6 @@
|
||||
#define NCollection_TListNode_HeaderFile
|
||||
|
||||
#include <NCollection_ListNode.hxx>
|
||||
#include <NCollection_BaseAllocator.hxx>
|
||||
#include <NCollection_DefineAlloc.hxx>
|
||||
|
||||
/**
|
||||
* Purpose: Abstract list node class. Used by BaseList
|
||||
@ -36,9 +34,7 @@ template <class TheItemType> class NCollection_TListNode
|
||||
const TheItemType& Value () const { return myValue; }
|
||||
//! Variable value access
|
||||
TheItemType& ChangeValue () { return myValue; }
|
||||
//! Memory allocation
|
||||
DEFINE_STANDARD_ALLOC
|
||||
DEFINE_NCOLLECTION_ALLOC
|
||||
|
||||
//! Static deleter to be passed to BaseList
|
||||
static void delNode (NCollection_ListNode * theNode,
|
||||
Handle(NCollection_BaseAllocator)& theAl)
|
||||
|
@ -62,7 +62,12 @@
|
||||
|
||||
template <class TheObjType, class TheBndType> class NCollection_UBTree
|
||||
{
|
||||
public:
|
||||
public:
|
||||
//! Memory allocation
|
||||
DEFINE_STANDARD_ALLOC
|
||||
DEFINE_NCOLLECTION_ALLOC
|
||||
|
||||
public:
|
||||
// ---------- PUBLIC TYPES ----------
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,6 @@
|
||||
#define NCollection_Vector_HeaderFile
|
||||
|
||||
#include <NCollection_BaseVector.hxx>
|
||||
#include <NCollection_BaseCollection.hxx>
|
||||
#include <NCollection_StlIterator.hxx>
|
||||
|
||||
//! Class NCollection_Vector (dynamic array of objects)
|
||||
@ -41,9 +40,8 @@
|
||||
//! creation or initialisation of the iterator. Therefore the iteration begins
|
||||
//! at index 0 and stops at the index equal to (remembered_length-1). It is OK
|
||||
//! to enlarge the vector during the iteration.
|
||||
template <class TheItemType> class NCollection_Vector
|
||||
: public NCollection_BaseCollection<TheItemType>,
|
||||
public NCollection_BaseVector
|
||||
template <class TheItemType>
|
||||
class NCollection_Vector : public NCollection_BaseVector
|
||||
{
|
||||
public:
|
||||
//! STL-compliant typedef for value type
|
||||
@ -52,8 +50,7 @@ public:
|
||||
public:
|
||||
|
||||
//! Nested class Iterator
|
||||
class Iterator : public NCollection_BaseCollection<TheItemType>::Iterator,
|
||||
public NCollection_BaseVector::Iterator
|
||||
class Iterator : public NCollection_BaseVector::Iterator
|
||||
{
|
||||
public:
|
||||
|
||||
@ -82,49 +79,49 @@ public:
|
||||
}
|
||||
|
||||
//! Check end
|
||||
virtual Standard_Boolean More() const
|
||||
Standard_Boolean More() const
|
||||
{
|
||||
return moreV();
|
||||
}
|
||||
|
||||
//! Increment operator.
|
||||
virtual void Next()
|
||||
void Next()
|
||||
{
|
||||
nextV();
|
||||
}
|
||||
|
||||
//! Decrement operator.
|
||||
virtual void Previous()
|
||||
void Previous()
|
||||
{
|
||||
prevV();
|
||||
}
|
||||
|
||||
//! Offset operator.
|
||||
virtual void Offset (ptrdiff_t theOffset)
|
||||
void Offset (ptrdiff_t theOffset)
|
||||
{
|
||||
offsetV ((int)theOffset);
|
||||
offsetV (static_cast<int>(theOffset));
|
||||
}
|
||||
|
||||
//! Difference operator.
|
||||
virtual ptrdiff_t Differ (const Iterator& theOther) const
|
||||
ptrdiff_t Differ (const Iterator& theOther) const
|
||||
{
|
||||
return differV (theOther);
|
||||
}
|
||||
|
||||
//! Constant value access
|
||||
virtual const TheItemType& Value() const
|
||||
const TheItemType& Value() const
|
||||
{
|
||||
return ((const TheItemType* )curBlockV()->DataPtr)[myCurIndex];
|
||||
}
|
||||
|
||||
//! Variable value access
|
||||
virtual TheItemType& ChangeValue() const
|
||||
TheItemType& ChangeValue() const
|
||||
{
|
||||
return ((TheItemType* )curBlockV()->DataPtr)[myCurIndex];
|
||||
}
|
||||
|
||||
//! Performs comparison of two iterators.
|
||||
virtual Standard_Boolean IsEqual (const Iterator& theOther) const
|
||||
Standard_Boolean IsEqual (const Iterator& theOther) const
|
||||
{
|
||||
return myVector == theOther.myVector
|
||||
&& myCurIndex == theOther.myCurIndex
|
||||
@ -156,14 +153,13 @@ public: //! @name public methods
|
||||
|
||||
//! Constructor
|
||||
NCollection_Vector (const Standard_Integer theIncrement = 256,
|
||||
const Handle(NCollection_BaseAllocator)& theAlloc = NULL)
|
||||
: NCollection_BaseCollection<TheItemType> (theAlloc),
|
||||
NCollection_BaseVector (NCollection_BaseCollection<TheItemType>::myAllocator, initMemBlocks, sizeof(TheItemType), theIncrement) {}
|
||||
const Handle(NCollection_BaseAllocator)& theAlloc = NULL) :
|
||||
NCollection_BaseVector (theAlloc, initMemBlocks, sizeof(TheItemType), theIncrement)
|
||||
{}
|
||||
|
||||
//! Copy constructor
|
||||
NCollection_Vector (const NCollection_Vector& theOther)
|
||||
: NCollection_BaseCollection<TheItemType> (theOther.myAllocator),
|
||||
NCollection_BaseVector (NCollection_BaseCollection<TheItemType>::myAllocator, initMemBlocks, theOther)
|
||||
NCollection_Vector (const NCollection_Vector& theOther) :
|
||||
NCollection_BaseVector (theOther.myAllocator, initMemBlocks, theOther)
|
||||
{
|
||||
copyData (theOther);
|
||||
}
|
||||
@ -175,14 +171,7 @@ public: //! @name public methods
|
||||
{
|
||||
initMemBlocks (*this, myData[anItemIter], 0, 0);
|
||||
}
|
||||
NCollection_BaseCollection<TheItemType>::myAllocator->Free (myData);
|
||||
}
|
||||
|
||||
//! Operator=
|
||||
NCollection_Vector& operator= (const NCollection_Vector& theOther)
|
||||
{
|
||||
Assign (theOther, Standard_False);
|
||||
return *this;
|
||||
this->myAllocator->Free (myData);
|
||||
}
|
||||
|
||||
//! Total number of items
|
||||
@ -192,7 +181,7 @@ public: //! @name public methods
|
||||
}
|
||||
|
||||
//! Total number of items in the vector
|
||||
virtual Standard_Integer Size() const
|
||||
Standard_Integer Size() const
|
||||
{
|
||||
return myLength;
|
||||
}
|
||||
@ -217,34 +206,21 @@ public: //! @name public methods
|
||||
return (myLength == 0);
|
||||
}
|
||||
|
||||
//! Virtual assignment (any collection to this array)
|
||||
virtual void Assign (const NCollection_BaseCollection<TheItemType>& theOther)
|
||||
{
|
||||
if (this != &theOther)
|
||||
{
|
||||
TYPENAME NCollection_BaseCollection<TheItemType>::Iterator& anIter2 = theOther.CreateIterator();
|
||||
while (anIter2.More())
|
||||
{
|
||||
Append (anIter2.Value());
|
||||
anIter2.Next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//! Assignment to the collection of the same type
|
||||
inline void Assign (const NCollection_Vector& theOther,
|
||||
const Standard_Boolean theOwnAllocator = Standard_True);
|
||||
const Standard_Boolean theOwnAllocator = Standard_True);
|
||||
|
||||
//! Method to create iterators for base collections
|
||||
virtual TYPENAME NCollection_BaseCollection<TheItemType>::Iterator& CreateIterator() const
|
||||
//! Assignment operator
|
||||
NCollection_Vector& operator= (const NCollection_Vector& theOther)
|
||||
{
|
||||
return *(new (this->IterAllocator()) Iterator(*this));
|
||||
Assign (theOther, Standard_False);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Append
|
||||
TheItemType& Append (const TheItemType& theValue)
|
||||
{
|
||||
TheItemType& anAppended = *(TheItemType* )expandV (NCollection_BaseCollection<TheItemType>::myAllocator, myLength);
|
||||
TheItemType& anAppended = *(TheItemType* )expandV (myLength);
|
||||
anAppended = theValue;
|
||||
return anAppended;
|
||||
}
|
||||
@ -300,7 +276,7 @@ public: //! @name public methods
|
||||
const TheItemType& theValue)
|
||||
{
|
||||
Standard_OutOfRange_Raise_if (theIndex < 0, "NCollection_Vector::SetValue");
|
||||
TheItemType* const aVecValue = (TheItemType* )(theIndex < myLength ? findV (theIndex) : expandV (NCollection_BaseCollection<TheItemType>::myAllocator, theIndex));
|
||||
TheItemType* const aVecValue = (TheItemType* )(theIndex < myLength ? findV (theIndex) : expandV (theIndex));
|
||||
*aVecValue = theValue;
|
||||
return *aVecValue;
|
||||
}
|
||||
@ -384,18 +360,18 @@ void NCollection_Vector<TheItemType>::Assign (const NCollection_Vector& theOther
|
||||
{
|
||||
initMemBlocks (*this, myData[anItemIter], 0, 0);
|
||||
}
|
||||
NCollection_BaseCollection<TheItemType>::myAllocator->Free (myData);
|
||||
this->myAllocator->Free (myData);
|
||||
|
||||
// allocate memory blocks with new allocator
|
||||
if (!theOwnAllocator)
|
||||
{
|
||||
NCollection_BaseCollection<TheItemType>::myAllocator = theOther.myAllocator;
|
||||
this->myAllocator = theOther.myAllocator;
|
||||
}
|
||||
myIncrement = theOther.myIncrement;
|
||||
myLength = theOther.myLength;
|
||||
myNBlocks = (myLength == 0) ? 0 : (1 + (myLength - 1)/myIncrement);
|
||||
myCapacity = GetCapacity (myIncrement) + myLength / myIncrement;
|
||||
myData = allocMemBlocks (NCollection_BaseCollection<TheItemType>::myAllocator, myCapacity);
|
||||
myData = allocMemBlocks (myCapacity);
|
||||
|
||||
// copy data
|
||||
copyData (theOther);
|
||||
|
@ -17,17 +17,8 @@
|
||||
#define Prs3d_NListOfSequenceOfPnt_HeaderFile
|
||||
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
#include <NCollection_DefineList.hxx>
|
||||
#include <NCollection_DefineBaseCollection.hxx>
|
||||
#include <NCollection_List.hxx>
|
||||
|
||||
DEFINE_BASECOLLECTION(Prs3d_BaseCollListOfSequenceOfPnt,
|
||||
TColgp_SequenceOfPnt)
|
||||
DEFINE_LIST (Prs3d_NListOfSequenceOfPnt,
|
||||
Prs3d_BaseCollListOfSequenceOfPnt,
|
||||
TColgp_SequenceOfPnt)
|
||||
typedef NCollection_List<TColgp_SequenceOfPnt> Prs3d_NListOfSequenceOfPnt;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#ifndef _SelectMgr_DataMapOfObjectOwners_HeaderFile
|
||||
#define _SelectMgr_DataMapOfObjectOwners_HeaderFile
|
||||
|
||||
#include <NCollection_DefineDataMap.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <SelectMgr_SelectableObject.hxx>
|
||||
#include <SelectMgr_SequenceOfOwner.hxx>
|
||||
|
||||
@ -26,12 +26,7 @@ inline Standard_Boolean IsEqual (const Handle(SelectMgr_SelectableObject)& theH1
|
||||
return (theH1 == theH2);
|
||||
}
|
||||
|
||||
DEFINE_BASECOLLECTION(SelectMgr_CollectionOfSequenceOfOwner, SelectMgr_SequenceOfOwner)
|
||||
DEFINE_DATAMAP(SelectMgr_DataMapOfObjectOwners, SelectMgr_CollectionOfSequenceOfOwner,
|
||||
Handle(SelectMgr_SelectableObject), SelectMgr_SequenceOfOwner)
|
||||
|
||||
typedef SelectMgr_DataMapOfObjectOwners::Iterator
|
||||
SelectMgr_DataMapIteratorOfMapOfObjectOwners;
|
||||
|
||||
typedef NCollection_DataMap<Handle(SelectMgr_SelectableObject), SelectMgr_SequenceOfOwner> SelectMgr_DataMapOfObjectOwners;
|
||||
typedef SelectMgr_DataMapOfObjectOwners::Iterator SelectMgr_DataMapIteratorOfMapOfObjectOwners;
|
||||
|
||||
#endif
|
||||
|
@ -18,10 +18,7 @@
|
||||
#ifndef TObj_Container_HeaderFile
|
||||
#define TObj_Container_HeaderFile
|
||||
|
||||
#include <NCollection_DefineBaseCollection.hxx>
|
||||
#include <NCollection_DefineDataMap.hxx>
|
||||
#include <NCollection_DefineSequence.hxx>
|
||||
#include <NCollection_DefineHSequence.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_HExtendedString.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
@ -29,21 +26,10 @@
|
||||
#include <TObj_Common.hxx>
|
||||
#include <TObj_SequenceOfObject.hxx>
|
||||
|
||||
DEFINE_BASECOLLECTION (TObj_CollectionOfLabel, TDF_Label)
|
||||
typedef NCollection_DataMap<Handle(TCollection_HExtendedString), TDF_Label> TObj_DataMapOfNameLabel;
|
||||
|
||||
DEFINE_BASECOLLECTION(TObj_CollectionOfPointer, Standard_Address)
|
||||
typedef NCollection_DataMap<Handle(TObj_Object), Handle(TObj_HSequenceOfObject)> TObj_DataMapOfObjectHSequenceOcafObjects;
|
||||
|
||||
DEFINE_BASECOLLECTION (TObj_CollectionOfHSeqOfObject,
|
||||
Handle(TObj_HSequenceOfObject))
|
||||
typedef NCollection_DataMap<TCollection_AsciiString, Standard_Address> TObj_DataMapOfStringPointer;
|
||||
|
||||
DEFINE_DATAMAP (TObj_DataMapOfNameLabel, TObj_CollectionOfLabel,
|
||||
Handle(TCollection_HExtendedString), TDF_Label)
|
||||
|
||||
|
||||
DEFINE_DATAMAP (TObj_DataMapOfObjectHSequenceOcafObjects,
|
||||
TObj_CollectionOfHSeqOfObject,
|
||||
Handle(TObj_Object),Handle(TObj_HSequenceOfObject))
|
||||
|
||||
DEFINE_DATAMAP(TObj_DataMapOfStringPointer,TObj_CollectionOfPointer,
|
||||
TCollection_AsciiString,Standard_Address)
|
||||
#endif
|
||||
|
@ -22,8 +22,6 @@
|
||||
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TObj_Partition.hxx>
|
||||
#include <NCollection_DefineBaseCollection.hxx>
|
||||
#include <NCollection_DefineDataMap.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
|
||||
class Handle(TObj_Application);
|
||||
@ -364,7 +362,3 @@ class TObj_Model : public MMgt_TShared
|
||||
//! The Model Handle is defined in a separate header file
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
@ -18,17 +18,9 @@
|
||||
#ifndef TObj_SequenceOfIterator_HeaderFile
|
||||
#define TObj_SequenceOfIterator_HeaderFile
|
||||
|
||||
#include <NCollection_DefineBaseCollection.hxx>
|
||||
#include <NCollection_DefineSequence.hxx>
|
||||
|
||||
#include <NCollection_Sequence.hxx>
|
||||
#include <TObj_ObjectIterator.hxx>
|
||||
|
||||
DEFINE_BASECOLLECTION (TObj_CollectionOfIterator, Handle(TObj_ObjectIterator))
|
||||
DEFINE_SEQUENCE (TObj_SequenceOfIterator, TObj_CollectionOfIterator,
|
||||
Handle(TObj_ObjectIterator))
|
||||
typedef NCollection_Sequence<Handle(TObj_ObjectIterator)> TObj_SequenceOfIterator;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
@ -18,19 +18,14 @@
|
||||
#ifndef TObj_SequenceOfObject_HeaderFile
|
||||
#define TObj_SequenceOfObject_HeaderFile
|
||||
|
||||
#include <NCollection_DefineBaseCollection.hxx>
|
||||
#include <NCollection_DefineSequence.hxx>
|
||||
#include <NCollection_Sequence.hxx>
|
||||
#include <NCollection_DefineHSequence.hxx>
|
||||
|
||||
#include <TObj_Common.hxx>
|
||||
#include <Handle_TObj_Object.hxx>
|
||||
|
||||
DEFINE_BASECOLLECTION (TObj_CollectionOfObject,Handle(TObj_Object))
|
||||
typedef NCollection_Sequence<Handle(TObj_Object)> TObj_SequenceOfObject;
|
||||
|
||||
DEFINE_SEQUENCE (TObj_SequenceOfObject,
|
||||
TObj_CollectionOfObject,Handle(TObj_Object))
|
||||
|
||||
DEFINE_HSEQUENCE (TObj_HSequenceOfObject,
|
||||
TObj_SequenceOfObject)
|
||||
DEFINE_HSEQUENCE (TObj_HSequenceOfObject, TObj_SequenceOfObject)
|
||||
|
||||
#endif
|
||||
|
@ -164,5 +164,5 @@ const TObj_DataMapOfNameLabel& TObj_TNameContainer::Get() const
|
||||
void TObj_TNameContainer::Set(const TObj_DataMapOfNameLabel& theMap)
|
||||
{
|
||||
Backup();
|
||||
myMap = theMap;
|
||||
myMap.Assign (theMap);
|
||||
}
|
||||
|
@ -16,11 +16,9 @@
|
||||
#ifndef _Visual3d_NListOfLayerItem_HeaderFile
|
||||
#define _Visual3d_NListOfLayerItem_HeaderFile
|
||||
|
||||
#include <NCollection_DefineList.hxx>
|
||||
#include <NCollection_List.hxx>
|
||||
#include <Visual3d_LayerItem.hxx>
|
||||
|
||||
DEFINE_LIST (Visual3d_NListOfLayerItem,
|
||||
NCollection_List,
|
||||
Handle(Visual3d_LayerItem))
|
||||
typedef NCollection_List<Handle(Visual3d_LayerItem)> Visual3d_NListOfLayerItem;
|
||||
|
||||
#endif
|
||||
|
@ -36,12 +36,10 @@ inline Standard_Boolean IsEqual(const iXYZ& one, const iXYZ& two)
|
||||
return one.ix == two.ix && one.iy == two.iy && one.iz == two.iz;
|
||||
}
|
||||
|
||||
#include <NCollection_DefineBaseCollection.hxx>
|
||||
DEFINE_BASECOLLECTION(iXYZbase, iXYZ)
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
#include <NCollection_DefineDataMap.hxx>
|
||||
DEFINE_DATAMAP(iXYZIndex, iXYZbase, iXYZ, Standard_Integer)
|
||||
DEFINE_DATAMAP(iXYZBool, iXYZbase, iXYZ, Standard_Byte)
|
||||
typedef NCollection_DataMap<iXYZ, Standard_Integer> iXYZIndex;
|
||||
typedef NCollection_DataMap<iXYZ, Standard_Byte> iXYZBool;
|
||||
|
||||
// Defines
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <Standard_OStream.hxx>
|
||||
#include <Standard_IStream.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <NCollection_IncAllocator.hxx>
|
||||
#include <Standard_Mutex.hxx>
|
||||
|
||||
struct VrmlData_InBuffer;
|
||||
|
Loading…
x
Reference in New Issue
Block a user