#include <Select3D_SensitiveTriangulation.hxx>
#include <SelectBasics_SensitiveEntity.hxx>
#include <TCollection_AsciiString.hxx>
+#include <NCollection_Map.hxx>
+
#ifdef OCC9026
#include <SelectMgr_DataMapIteratorOfDataMapOfIntegerSensitive.hxx>
#endif
#include <SelectMgr_Selection.hxx>
+#include <SelectMgr_SequenceOfOwner.hxx>
#include <OSD_Environment.hxx>
-#include <SelectMgr_DataMapOfObjectOwners.hxx>
#include <Geom_Transformation.hxx>
#include <AIS_Selection.hxx>
if( Sel.IsNull() ) return;
#endif
- Handle (PrsMgr_PresentationManager3d) PM = myMainPM;
+ typedef NCollection_DataMap <Handle(SelectMgr_SelectableObject), NCollection_Handle<SelectMgr_SequenceOfOwner> > SelectMgr_DataMapOfObjectOwners;
SelectMgr_DataMapOfObjectOwners aMap;
+
+ Handle (PrsMgr_PresentationManager3d) PM = myMainPM;
// to avoid problems when there is a loop searching for selected objects...
#if !defined OCC189 && !defined USE_MAP
if ( Ownr->IsAutoHilight() )
Ownr->HilightWithColor(PM,myCTX->SelectionColor(),HM);
else if ( aMap.IsBound (SO) )
- aMap.ChangeFind(SO).Append ( Ownr );
+ aMap(SO)->Append ( Ownr );
else {
- SelectMgr_SequenceOfOwner aSeq;
- aSeq.Append ( Ownr );
+ NCollection_Handle<SelectMgr_SequenceOfOwner> aSeq = new SelectMgr_SequenceOfOwner;
+ aSeq->Append ( Ownr );
aMap.Bind ( SO, aSeq );
}
}
}
- for ( SelectMgr_DataMapIteratorOfMapOfObjectOwners aMapIter(aMap);
+ for ( SelectMgr_DataMapOfObjectOwners::Iterator aMapIter(aMap);
aMapIter.More(); aMapIter.Next() )
- aMapIter.Key()->HilightSelected ( myMainPM, aMapIter.Value() );
+ {
+ aMapIter.Key()->HilightSelected (myMainPM, *aMapIter.Value());
+ }
if (updateviewer)
{
if( Sel.IsNull() ) return;
#endif
Handle (PrsMgr_PresentationManager3d) PM = myMainPM;
- SelectMgr_DataMapOfObjectOwners anObjMap;
- SelectMgr_SequenceOfOwner anOwnSeq;
+ NCollection_Map<Handle(SelectMgr_SelectableObject)> anObjMap;
#if !defined OCC189 && !defined USE_MAP
const TColStd_Array1OfTransient& Obj = Sel->Objects()->Array1();
#ifdef BUC60876
Handle(SelectMgr_SelectableObject) SO = Ownr->Selectable();
Handle(AIS_InteractiveObject) IO = *((Handle(AIS_InteractiveObject)*)&SO);
- anObjMap.Bind ( IO, anOwnSeq );
+ anObjMap.Add (IO);
- HM = GetHiMod(IO);
+ HM = GetHiMod(IO);
#endif
Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(Ownr);
if(BROwnr.IsNull() || !BROwnr->ComesFromDecomposition()){
}
}
- for ( SelectMgr_DataMapIteratorOfMapOfObjectOwners anIter1 ( anObjMap );
+ for (NCollection_Map<Handle(SelectMgr_SelectableObject)>::Iterator anIter1 ( anObjMap );
anIter1.More(); anIter1.Next() )
+ {
if ( !anIter1.Key()->IsAutoHilight() )
anIter1.Key()->ClearSelected();
+ }
if(updateviewer){
#ifdef BUC60774
---Purpose: this map will allows to get a directory object from a name.
private class PresentationDirectory instantiates DataMap from TCollection
- ---Purpose: this map will allows to get a directory object from a name.
(ExtendedString from TCollection,
Document from CDM,
ExtendedString from TCollection);
+ ---Purpose: this map will allows to get a directory object from a name.
private pointer DocumentPointer to Document from CDM;
private class Reference;
-- The class instantiations :
--- class Array1OfHArray1OfInteger instantiates
--- Array1 from TCollection (HArray1OfInteger from TColStd);
--- class Array1OfHArray1OfReal instantiates
--- Array1 from TCollection (HArray1OfReal from TColStd);
--- class Array1OfHArray1OfXY instantiates
--- Array1 from TCollection (HArray1OfXY from TColgp);
--- class Array1OfHArray1OfXYZ instantiates
--- Array1 from TCollection (HArray1OfXYZ from TColgp);
class Array2OfHArray1OfReal instantiates
Array2 from TCollection (HArray1OfReal from TColStd);
--- class Array1OfHArray1OfIGESEntity instantiates
--- Array1 from TCollection (HArray1OfIGESEntity from IGESData);
class Array1OfLineFontEntity instantiates
Array1 from TCollection (LineFontEntity from IGESData);
class HArray1OfHArray1OfInteger instantiates
- -- HArray1 from TCollection (HArray1OfInteger from TColStd,Array1OfHArray1OfInteger);
JaggedArray from Interface (HArray1OfInteger from TColStd);
+ -- HArray1 from TCollection (HArray1OfInteger from TColStd,Array1OfHArray1OfInteger);
class HArray1OfHArray1OfReal instantiates
- -- HArray1 from TCollection (HArray1OfReal from TColStd,Array1OfHArray1OfReal);
JaggedArray from Interface (HArray1OfReal from TColStd);
+ -- HArray1 from TCollection (HArray1OfReal from TColStd,Array1OfHArray1OfReal);
class HArray1OfHArray1OfXY instantiates
- -- HArray1 from TCollection (HArray1OfXY from TColgp, Array1OfHArray1OfXY);
JaggedArray from Interface (HArray1OfXY from TColgp);
+ -- HArray1 from TCollection (HArray1OfXY from TColgp, Array1OfHArray1OfXY);
class HArray1OfHArray1OfXYZ instantiates
- -- HArray1 from TCollection (HArray1OfXYZ from TColgp, Array1OfHArray1OfXYZ);
JaggedArray from Interface (HArray1OfXYZ from TColgp);
+ -- HArray1 from TCollection (HArray1OfXYZ from TColgp, Array1OfHArray1OfXYZ);
class HArray2OfHArray1OfReal instantiates HArray2 from TCollection
(HArray1OfReal from TColStd,Array2OfHArray1OfReal);
class HArray1OfHArray1OfIGESEntity instantiates
- -- HArray1 from TCollection (HArray1OfIGESEntity from IGESData,Array1OfHArray1OfIGESEntity);
JaggedArray from Interface (HArray1OfIGESEntity from IGESData);
+ -- HArray1 from TCollection (HArray1OfIGESEntity from IGESData,Array1OfHArray1OfIGESEntity);
class HArray1OfLineFontEntity instantiates HArray1 from TCollection
(LineFontEntity from IGESData,Array1OfLineFontEntity);
-- -- Instantiations -- --
- private class SequenceOfCheck instantiates -- for HSequence
+ private class SequenceOfCheck instantiates
Sequence from TCollection (Check);
- private class HSequenceOfCheck instantiates -- Transient
+ private class HSequenceOfCheck instantiates
HSequence from TCollection (Check,SequenceOfCheck);
- class Array1OfFileParameter instantiates -- for ParamList :
+ class Array1OfFileParameter instantiates
Array1 from TCollection (FileParameter);
--- class HArray1OfFileParameter instantiates -- Array, Transient
--- HArray1 from TCollection (FileParameter,Array1OfFileParameter);
-- Useful Instantiations to define Data
if (aMapBndNodes.Contains(n1) && aMapBndNodes.Contains(n2))
continue;
if (!myMapFaceLinks.Contains(iF)) {
- //myMapFaceLinks.Add(iF, TColStd_SequenceOfInteger());
- TColStd_SequenceOfInteger tmpSeq;
+ Handle(TColStd_HSequenceOfInteger) tmpSeq = new TColStd_HSequenceOfInteger;
myMapFaceLinks.Add(iF, tmpSeq);
}
- TColStd_SequenceOfInteger& aSeq = myMapFaceLinks.ChangeFromKey(iF);
- aSeq.Append(n1);
- aSeq.Append(n2);
+ Handle(TColStd_HSequenceOfInteger)& aSeq = myMapFaceLinks.ChangeFromKey(iF);
+ aSeq->Append(n1);
+ aSeq->Append(n2);
}
}
}
Standard_Integer& theNode1,
Standard_Integer& theNode2) const
{
- const TColStd_SequenceOfInteger& aSeq = myMapFaceLinks(theFaceIndex);
+ const Handle(TColStd_HSequenceOfInteger)& aSeq = myMapFaceLinks(theFaceIndex);
Standard_Integer aInd = (theLinkIndex-1)*2 + 1;
- theNode1 = aSeq(aInd);
- theNode2 = aSeq(aInd+1);
+ theNode1 = aSeq->Value(aInd);
+ theNode2 = aSeq->Value(aInd+1);
}
//=======================================================================
#include <TopoDS_Shape.hxx>
#include <NCollection_IndexedDataMap.hxx>
-#include <TColStd_SequenceOfInteger.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
#include <TColStd_SequenceOfReal.hxx>
#include <Draw_Interpretor.hxx>
//! returns the number free links on a face with the given index
Standard_Integer NbFreeLinks(const Standard_Integer theIndex) const
- { return myMapFaceLinks(theIndex).Length() / 2; }
+ { return myMapFaceLinks(theIndex)->Length() / 2; }
//! gets the numbers of nodes of a free link with the given index
//! in the face with the given index
private:
TopoDS_Shape myShape;
- NCollection_IndexedDataMap<Standard_Integer,TColStd_SequenceOfInteger>
+ NCollection_IndexedDataMap<Standard_Integer,Handle(TColStd_HSequenceOfInteger)>
myMapFaceLinks;
TColStd_SequenceOfInteger myErrors;
if ( myHilighter.IsNull() )
return;
- SelectMgr_SequenceOfOwner theOwners;
- //new functionality
-
- //if ( myHilightPrs.IsNull() )
- // myHilightPrs = new Prs3d_Presentation ( PM->StructureManager() );
-
Handle( Prs3d_Presentation ) aHilightPrs;
aHilightPrs = GetHilightPresentation( PM );
#ifndef NCollection_Array1_HeaderFile
#define NCollection_Array1_HeaderFile
-#ifndef No_Exception
#include <Standard_DimensionMismatch.hxx>
#include <Standard_OutOfMemory.hxx>
#include <Standard_OutOfRange.hxx>
-#endif
#include <NCollection_DefineAlloc.hxx>
#include <NCollection_StlIterator.hxx>
myUpperBound (theUpper),
myDeletable (Standard_True)
{
-#if !defined No_Exception && !defined No_Standard_RangeError
- if (theUpper < theLower)
- Standard_RangeError::Raise ("NCollection_Array1::Create");
-#endif
+ Standard_RangeError_Raise_if (theUpper < theLower, "NCollection_Array1::Create");
TheItemType* pBegin = new TheItemType[Length()];
-#if !defined No_Exception && !defined No_Standard_OutOfMemory
- if (!pBegin)
- Standard_OutOfMemory::Raise ("NCollection_Array1 : Allocation failed");
-#endif
+ Standard_OutOfMemory_Raise_if (!pBegin, "NCollection_Array1 : Allocation failed");
myData = pBegin - theLower;
}
myDeletable (Standard_True)
{
TheItemType* pBegin = new TheItemType[Length()];
-#if !defined No_Exception && !defined No_Standard_OutOfMemory
- if (!pBegin)
- Standard_OutOfMemory::Raise ("NCollection_Array1 : Allocation failed");
-#endif
+ Standard_OutOfMemory_Raise_if (!pBegin, "NCollection_Array1 : Allocation failed");
myData = pBegin - myLowerBound;
*this = theOther;
myUpperBound (theUpper),
myDeletable (Standard_False)
{
-#if !defined No_Exception && !defined No_Standard_RangeError
- if (theUpper < theLower)
- Standard_RangeError::Raise ("NCollection_Array1::Array1");
-#endif
+ Standard_RangeError_Raise_if (theUpper < theLower, "NCollection_Array1::Create");
myData = (TheItemType *) &theBegin - theLower;
}
{
if (&theOther == this)
return *this;
-#if !defined No_Exception && !defined No_Standard_DimensionMismatch
- if (Length() != theOther.Length())
- Standard_DimensionMismatch::Raise ("NCollection_Array1::operator=");
-#endif
+ Standard_DimensionMismatch_Raise_if (Length() != theOther.Length(), "NCollection_Array1::operator=");
TheItemType * pMyItem = &myData[myLowerBound];
TheItemType * const pEndItem = &(theOther.myData)[theOther.myUpperBound];
TheItemType * pItem = &(theOther.myData)[theOther.myLowerBound];
//! Constant value access
const TheItemType& Value (const Standard_Integer theIndex) const
{
-#if !defined No_Exception && !defined No_Standard_OutOfRange
- if (theIndex < myLowerBound || theIndex > myUpperBound)
- Standard_OutOfRange::Raise ("NCollection_Array1::Value");
-#endif
+ Standard_OutOfRange_Raise_if (theIndex < myLowerBound || theIndex > myUpperBound, "NCollection_Array1::Value");
return myData[theIndex];
}
//! Variable value access
TheItemType& ChangeValue (const Standard_Integer theIndex)
{
-#if !defined No_Exception && !defined No_Standard_OutOfRange
- if (theIndex < myLowerBound || theIndex > myUpperBound)
- Standard_OutOfRange::Raise ("NCollection_Array1::ChangeValue");
-#endif
+ Standard_OutOfRange_Raise_if (theIndex < myLowerBound || theIndex > myUpperBound, "NCollection_Array1::ChangeValue");
return myData[theIndex];
}
void SetValue (const Standard_Integer theIndex,
const TheItemType& theItem)
{
-#if !defined No_Exception && !defined No_Standard_OutOfRange
- if (theIndex < myLowerBound || theIndex > myUpperBound)
- Standard_OutOfRange::Raise ("NCollection_Array1::SetValue");
-#endif
+ Standard_OutOfRange_Raise_if (theIndex < myLowerBound || theIndex > myUpperBound, "NCollection_Array1::SetValue");
myData[theIndex] = theItem;
}
#ifndef NCollection_Array2_HeaderFile
#define NCollection_Array2_HeaderFile
-#ifndef No_Exception
#include <Standard_DimensionMismatch.hxx>
#include <Standard_OutOfMemory.hxx>
#include <Standard_OutOfRange.hxx>
-#endif
#include <NCollection_DefineAlloc.hxx>
{
if (&theOther == this)
return *this;
-#if !defined No_Exception && !defined No_Standard_DimensionMismatch
- if (Length() != theOther.Length())
- Standard_DimensionMismatch::Raise ("NCollection_Array2::operator=");
-#endif
+ Standard_DimensionMismatch_Raise_if (Length() != theOther.Length(), "NCollection_Array2::operator=");
TheItemType * pMyItem = myStart;
TheItemType * pItem = theOther.myStart;
const Standard_Integer iSize = Length();
const TheItemType& Value (const Standard_Integer theRow,
const Standard_Integer theCol) const
{
-#if !defined No_Exception && !defined No_Standard_OutOfRange
- if (theRow < myLowerRow || theRow > myUpperRow ||
- theCol < myLowerCol || theCol > myUpperCol)
- Standard_OutOfRange::Raise ("NCollection_Array2::Value");
-#endif
+ Standard_OutOfRange_Raise_if (theRow < myLowerRow || theRow > myUpperRow ||
+ theCol < myLowerCol || theCol > myUpperCol, "NCollection_Array2::Value");
return myData[theRow][theCol];
}
TheItemType& ChangeValue (const Standard_Integer theRow,
const Standard_Integer theCol)
{
-#if !defined No_Exception && !defined No_Standard_OutOfRange
- if (theRow < myLowerRow || theRow > myUpperRow ||
- theCol < myLowerCol || theCol > myUpperCol)
- Standard_OutOfRange::Raise ("NCollection_Array2::ChangeValue");
-#endif
+ Standard_OutOfRange_Raise_if (theRow < myLowerRow || theRow > myUpperRow ||
+ theCol < myLowerCol || theCol > myUpperCol, "NCollection_Array2::ChangeValue");
return myData[theRow][theCol];
}
const Standard_Integer theCol,
const TheItemType& theItem)
{
-#if !defined No_Exception && !defined No_Standard_OutOfRange
- if (theRow < myLowerRow || theRow > myUpperRow ||
- theCol < myLowerCol || theCol > myUpperCol)
- Standard_OutOfRange::Raise ("NCollection_Array2::SetValue");
-#endif
+ Standard_OutOfRange_Raise_if (theRow < myLowerRow || theRow > myUpperRow ||
+ theCol < myLowerCol || theCol > myUpperCol, "NCollection_Array2::SetValue");
myData[theRow][theCol] = theItem;
}
{
const Standard_Integer iRowSize = myUpperCol - myLowerCol + 1;
const Standard_Integer iColSize = myUpperRow - myLowerRow + 1;
-#if !defined No_Exception && !defined No_Standard_RangeError
- if (iRowSize <= 0 || iColSize <= 0)
- Standard_RangeError::Raise ("NCollection_Array2::Allocate");
-#endif
+ Standard_RangeError_Raise_if (iRowSize <= 0 || iColSize <= 0, "NCollection_Array2::Allocate");
if (myDeletable) {
// allocation of the data in the array
myStart = new TheItemType[iRowSize * iColSize];
-#if !defined No_Exception && !defined No_Standard_OutOfMemory
- if (!myStart)
- Standard_OutOfMemory::Raise ("NCollection_Array2 : Allocation failed");
-#endif
+ Standard_OutOfMemory_Raise_if (!myStart, "NCollection_Array2 : Allocation failed");
}
// else myStart is set to the beginning of the given array
TheItemType** pTable = new TheItemType* [iColSize];
-#if !defined No_Exception && !defined No_Standard_OutOfMemory
- if (!pTable)
- Standard_OutOfMemory::Raise ("NCollection_Array2 : Allocation failed");
-#endif
+ Standard_OutOfMemory_Raise_if (!pTable, "NCollection_Array2 : Allocation failed");
// Items of pTable point to the '0'th items in the rows of the array
TheItemType* pRow = myStart - myLowerCol;
myIncrement (theOther.myIncrement),
myLength (theOther.myLength),
myCapacity (GetCapacity(myIncrement) + theOther.myLength / theOther.myIncrement),
- myNBlocks (1 + (theOther.myLength - 1)/theOther.myIncrement),
+ myNBlocks (theOther.myLength == 0 ? 0 : 1 + (theOther.myLength - 1)/theOther.myIncrement),
myInitBlocks (theInitBlocks)
{
myAllocator = (theAllocator.IsNull() ? NCollection_BaseAllocator::CommonBaseAllocator() : theAllocator);
DataMapNode (const TheKeyType& theKey,
const TheItemType& theItem,
NCollection_ListNode* theNext) :
- NCollection_TListNode<TheItemType> (theItem, theNext)
- { myKey = theKey; }
+ NCollection_TListNode<TheItemType> (theItem, theNext),
+ myKey(theKey)
+ {}
+
//! Key
const TheKeyType& Key (void) const
{ return myKey; }
//! Value inquiry
const TheItemType& Value(void) const
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (!More())
- Standard_NoSuchObject::Raise("NCollection_DataMap::Iterator::Value");
-#endif
+ Standard_NoSuchObject_Raise_if(!More(), "NCollection_DataMap::Iterator::Value");
return ((DataMapNode *) myNode)->Value();
}
//! Value change access
TheItemType& ChangeValue(void) const
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (!More())
- Standard_NoSuchObject::Raise("NCollection_DataMap::Iterator::ChangeValue");
-#endif
+ Standard_NoSuchObject_Raise_if(!More(), "NCollection_DataMap::Iterator::ChangeValue");
return ((DataMapNode *) myNode)->ChangeValue();
}
//! Key
const TheKeyType& Key (void) const
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (!More())
- Standard_NoSuchObject::Raise("NCollection_DataMap::Iterator::Key");
-#endif
+ Standard_NoSuchObject_Raise_if(!More(), "NCollection_DataMap::Iterator::Key");
return ((DataMapNode *) myNode)->Key();
}
};
//! Find
const TheItemType& Find(const TheKeyType& theKey) const
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (IsEmpty())
- Standard_NoSuchObject::Raise ("NCollection_DataMap::Find");
-#endif
+ Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_DataMap::Find");
DataMapNode* p = (DataMapNode*) myData1[Hasher::HashCode(theKey,NbBuckets())];
while (p)
{
//! ChangeFind
TheItemType& ChangeFind (const TheKeyType& theKey)
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (IsEmpty())
- Standard_NoSuchObject::Raise ("NCollection_DataMap::Find");
-#endif
+ Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_DataMap::Find");
DataMapNode* p = (DataMapNode*) myData1[Hasher::HashCode(theKey,NbBuckets())];
while (p)
{
//function : HashCode_Proxy
//purpose : Function is required to call the global function HashCode.
//=======================================================================
+
+template <class TheKeyType>
+inline Standard_Integer HashCode_Proxy (const TheKeyType& theKey,
+ const Standard_Integer Upper)
+{
+ return HashCode (theKey, Upper);
+}
+
+//=======================================================================
+//function : IsEqual
+//purpose : Default implementation of IsEqual via operator ==
+//=======================================================================
+
template <class TheKeyType>
- static Standard_Integer HashCode_Proxy(const TheKeyType& theKey,
- const Standard_Integer Upper) {
- return HashCode(theKey, Upper);
+inline Standard_Boolean IsEqual (const TheKeyType& theKey1,
+ const TheKeyType& theKey2)
+{
+ return theKey1 == theKey2;
}
//=======================================================================
//function : IsEqual_Proxy
//purpose : Function is required to call the global function IsEqual.
//=======================================================================
+
template <class TheKeyType>
- static Standard_Boolean IsEqual_Proxy(const TheKeyType& theKey1,
- const TheKeyType& theKey2) {
- return IsEqual(theKey1, theKey2);
+inline Standard_Boolean IsEqual_Proxy (const TheKeyType& theKey1,
+ const TheKeyType& theKey2)
+{
+ return IsEqual (theKey1, theKey2);
}
// Declaration of Array1 class managed by Handle
#define DEFINE_HARRAY1(HClassName, _Array1Type_) \
-\
-class HClassName : public _Array1Type_, \
- public MMgt_TShared { \
+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_&); \
- inline const _Array1Type_& Array1 () const; \
- inline _Array1Type_& ChangeArray1 (); \
- DEFINE_STANDARD_RTTI (HClassName) \
+ HClassName (const Standard_Integer theLower, \
+ const Standard_Integer theUpper) : \
+ _Array1Type_ (theLower,theUpper) {} \
+ HClassName (const Standard_Integer theLower, \
+ const Standard_Integer theUpper, \
+ const _Array1Type_::value_type& theValue) : \
+ _Array1Type_ (theLower,theUpper) { Init (theValue); } \
+ HClassName (const _Array1Type_& theOther) : _Array1Type_(theOther) {} \
+ const _Array1Type_& Array1 () const { return *this; } \
+ _Array1Type_& ChangeArray1 () { return *this; } \
+ DEFINE_STANDARD_RTTI (HClassName) \
}; \
- \
-DEFINE_STANDARD_HANDLE (HClassName, MMgt_TShared) \
- \
-inline HClassName::HClassName (const Standard_Integer theLower, \
- const Standard_Integer theUpper) : \
- _Array1Type_ (theLower,theUpper), \
- MMgt_TShared() {} \
- \
-inline HClassName::HClassName (const _Array1Type_& theOther) : \
- _Array1Type_(theOther), \
- MMgt_TShared() {} \
- \
-inline const _Array1Type_& HClassName::Array1 () const \
-{ return * (const _Array1Type_ *) this; } \
- \
-inline _Array1Type_& HClassName::ChangeArray1 () \
-{ return * (_Array1Type_ *) this; } \
+DEFINE_STANDARD_HANDLE (HClassName, MMgt_TShared)
#define IMPLEMENT_HARRAY1(HClassName) \
IMPLEMENT_STANDARD_HANDLE (HClassName, MMgt_TShared) \
// Declaration of Array2 class managed by Handle
#define DEFINE_HARRAY2(HClassName, _Array2Type_) \
-\
-class HClassName : public _Array2Type_, \
- public MMgt_TShared { \
+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, \
- const Standard_Integer theColUpper);\
- inline HClassName (const _Array2Type_&); \
- inline const _Array2Type_& Array2 () const; \
- inline _Array2Type_& ChangeArray2(); \
- DEFINE_STANDARD_RTTI (HClassName) \
+ HClassName (const Standard_Integer theRowLow, \
+ const Standard_Integer theRowUpp, \
+ const Standard_Integer theColLow, \
+ const Standard_Integer theColUpp) : \
+ _Array2Type_ (theRowLow, theRowUpp, theColLow, theColUpp) {} \
+ HClassName (const Standard_Integer theRowLow, \
+ const Standard_Integer theRowUpp, \
+ const Standard_Integer theColLow, \
+ const Standard_Integer theColUpp, \
+ const _Array2Type_::value_type& theValue) : \
+ _Array2Type_ (theRowLow, theRowUpp, theColLow, theColUpp) \
+ { Init (theValue); } \
+ HClassName (const _Array2Type_& theOther) : _Array2Type_(theOther) {} \
+ const _Array2Type_& Array2 () const { return *this; } \
+ _Array2Type_& ChangeArray2 () { return *this; } \
+ DEFINE_STANDARD_RTTI (HClassName) \
}; \
- \
-DEFINE_STANDARD_HANDLE (HClassName, MMgt_TShared) \
- \
-inline HClassName::HClassName (const Standard_Integer theRowLow, \
- const Standard_Integer theRowUpp, \
- const Standard_Integer theColLow, \
- const Standard_Integer theColUpp) : \
- _Array2Type_ (theRowLow, theRowUpp, theColLow, theColUpp), \
- MMgt_TShared() {} \
- \
-inline HClassName::HClassName (const _Array2Type_& theOther) : \
- _Array2Type_(theOther), \
- MMgt_TShared() {} \
- \
-inline const _Array2Type_& HClassName::Array2 () const \
-{ return * (const _Array2Type_ *) this; } \
- \
-inline _Array2Type_& HClassName::ChangeArray2 () \
-{ return * (_Array2Type_ *) this; } \
+DEFINE_STANDARD_HANDLE (HClassName, MMgt_TShared)
#define IMPLEMENT_HARRAY2(HClassName) \
IMPLEMENT_STANDARD_HANDLE (HClassName, MMgt_TShared) \
// Declaration of Sequence class managed by Handle
#define DEFINE_HSEQUENCE(HClassName, _SequenceType_) \
-\
-class HClassName : public _SequenceType_, \
- public MMgt_TShared { \
+DEFINE_STANDARD_HANDLE (HClassName, MMgt_TShared) \
+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; \
- inline _SequenceType_& ChangeSequence (); \
- DEFINE_STANDARD_RTTI (HClassName) \
-}; \
- \
-DEFINE_STANDARD_HANDLE (HClassName, MMgt_TShared) \
- \
-inline HClassName::HClassName () : \
- _SequenceType_(), \
- MMgt_TShared() {} \
- \
-inline HClassName::HClassName (const _SequenceType_& anOther) : \
- _SequenceType_(anOther), \
- MMgt_TShared() {} \
- \
-inline const _SequenceType_& HClassName::Sequence () const \
-{ return * (const _SequenceType_ *) this; } \
- \
-inline _SequenceType_& HClassName::ChangeSequence () \
-{ return * (_SequenceType_ *) this; } \
+ HClassName () {} \
+ HClassName (const _SequenceType_& theOther) : _SequenceType_(theOther) {} \
+ const _SequenceType_& Sequence () const { return *this; } \
+ void Append (const _SequenceType_::value_type& theItem) { \
+ _SequenceType_::Append (theItem); \
+ } \
+ void Append (_SequenceType_& theSequence) { \
+ _SequenceType_::Append (theSequence); \
+ } \
+ _SequenceType_& ChangeSequence () { return *this; } \
+ void Append (const Handle(HClassName)& theOther) { \
+ _SequenceType_::Append (theOther->ChangeSequence()); \
+ } \
+ DEFINE_STANDARD_RTTI (HClassName) \
+};
#define IMPLEMENT_HSEQUENCE(HClassName) \
IMPLEMENT_STANDARD_HANDLE (HClassName, MMgt_TShared) \
const TheKey2Type& theKey2,
NCollection_ListNode* theNext1,
NCollection_ListNode* theNext2) :
- NCollection_TListNode<TheKey2Type> (theKey2, theNext1)
+ NCollection_TListNode<TheKey2Type> (theKey2, theNext1),
+ myKey1(theKey1),
+ myNext2((DoubleMapNode*)theNext2)
{
- myKey1 = theKey1;
- myNext2 = (DoubleMapNode *) theNext2;
}
//! Key1
const TheKey1Type& Key1 (void)
//! Key1 inquiry
const TheKey1Type& Key1(void) const
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (!More())
- Standard_NoSuchObject::Raise ("NCollection_DoubleMap::Iterator::Key1");
-#endif
+ Standard_NoSuchObject_Raise_if (!More(), "NCollection_DoubleMap::Iterator::Key1");
return ((DoubleMapNode *) myNode)->Key1();
}
//! Key2 inquiry
const TheKey2Type& Key2(void) const
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (!More())
- Standard_NoSuchObject::Raise ("NCollection_DoubleMap::Iterator::Key2");
-#endif
+ Standard_NoSuchObject_Raise_if (!More(), "NCollection_DoubleMap::Iterator::Key2");
return ((DoubleMapNode *) myNode)->Key2();
}
//! Value access
const TheKey2Type& Value(void) const
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (!More())
- Standard_NoSuchObject::Raise ("NCollection_DoubleMap::Iterator::Value");
-#endif
+ Standard_NoSuchObject_Raise_if (!More(), "NCollection_DoubleMap::Iterator::Value");
return ((DoubleMapNode *) myNode)->Value();
}
//! Value change access - denied
//! Find1
const TheKey2Type& Find1(const TheKey1Type& theKey1) const
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (IsEmpty())
- Standard_NoSuchObject::Raise ("NCollection_DoubleMap::Find1");
-#endif
+ Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_DoubleMap::Find1");
DoubleMapNode * pNode1 =
(DoubleMapNode *) myData1[Hasher1::HashCode(theKey1,NbBuckets())];
while (pNode1)
//! Find2
const TheKey1Type& Find2(const TheKey2Type& theKey2) const
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (IsEmpty())
- Standard_NoSuchObject::Raise ("NCollection_DoubleMap::Find2");
-#endif
+ Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_DoubleMap::Find2");
DoubleMapNode * pNode2 =
(DoubleMapNode *) myData2[Hasher2::HashCode(theKey2,NbBuckets())];
while (pNode2)
#include <NCollection_StlIterator.hxx>
#include <NCollection_DefaultHasher.hxx>
-#if !defined No_Exception && !defined No_Standard_OutOfRange
#include <Standard_OutOfRange.hxx>
-#endif
/**
* Purpose: An indexed map is used to store keys and to bind
const TheItemType& theItem,
NCollection_ListNode* theNext1,
NCollection_ListNode* theNext2) :
- NCollection_TListNode<TheItemType>(theItem,theNext1)
+ NCollection_TListNode<TheItemType>(theItem,theNext1),
+ myKey1(theKey1),
+ myKey2(theKey2),
+ myNext2((IndexedDataMapNode*)theNext2)
{
- myKey1 = theKey1;
- myKey2 = theKey2;
- myNext2 = (IndexedDataMapNode *) theNext2;
}
//! Key1
TheKeyType& Key1 (void)
//! Value access
const TheItemType& Value(void) const
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (!More())
- Standard_NoSuchObject::Raise("NCollection_IndexedDataMap::Iterator::Value");
-#endif
+ Standard_NoSuchObject_Raise_if(!More(), "NCollection_IndexedDataMap::Iterator::Value");
return myNode->Value();
}
//! ChangeValue access
TheItemType& ChangeValue(void) const
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (!More())
- Standard_NoSuchObject::Raise("NCollection_IndexedDataMap::Iterator::ChangeValue");
-#endif
+ Standard_NoSuchObject_Raise_if(!More(), "NCollection_IndexedDataMap::Iterator::ChangeValue");
return myNode->ChangeValue();
}
//! Key
const TheKeyType& Key() const
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (!More())
- Standard_NoSuchObject::Raise("NCollection_DataMap::Iterator::Key");
-#endif
+ Standard_NoSuchObject_Raise_if(!More(), "NCollection_IndexedDataMap::Iterator::Key");
return myNode->Key1();
}
//! Performs comparison of two iterators.
const TheKeyType& theKey1,
const TheItemType& theItem)
{
-#if !defined No_Exception && !defined No_Standard_OutOfRange
- if (theIndex < 1 || theIndex > Extent())
- Standard_OutOfRange::Raise ("NCollection_IndexedDataMap::Substitute");
-#endif
+ Standard_OutOfRange_Raise_if (theIndex < 1 || theIndex > Extent(), "NCollection_IndexedDataMap::Substitute");
+
IndexedDataMapNode * p;
// check if theKey1 is not already in the map
Standard_Integer iK1 = Hasher::HashCode (theKey1, NbBuckets());
//! RemoveLast
void RemoveLast (void)
{
-#if !defined No_Exception && !defined No_Standard_OutOfRange
- if (Extent() == 0)
- Standard_OutOfRange::Raise ("NCollection_IndexedDataMap::RemoveLast");
-#endif
+ Standard_OutOfRange_Raise_if (Extent() == 0, "NCollection_IndexedDataMap::RemoveLast");
+
IndexedDataMapNode * p, * q;
// Find the node for the last index and remove it
Standard_Integer iK2 = ::HashCode (Extent(), NbBuckets());
//! FindKey
const TheKeyType& FindKey (const Standard_Integer theKey2) const
{
-#if !defined No_Exception && !defined No_Standard_OutOfRange
- if (theKey2 < 1 || theKey2 > Extent())
- Standard_OutOfRange::Raise ("NCollection_IndexedDataMap::FindKey");
-#endif
+ Standard_OutOfRange_Raise_if (theKey2 < 1 || theKey2 > Extent(), "NCollection_IndexedDataMap::FindKey");
+
IndexedDataMapNode* aNode = nodeFromIndex (theKey2);
if (aNode == NULL)
{
//! FindFromIndex
const TheItemType& FindFromIndex (const Standard_Integer theKey2) const
{
-#if !defined No_Exception && !defined No_Standard_OutOfRange
- if (theKey2 < 1 || theKey2 > Extent())
- Standard_OutOfRange::Raise ("NCollection_IndexedDataMap::FindFromIndex");
-#endif
+ Standard_OutOfRange_Raise_if (theKey2 < 1 || theKey2 > Extent(), "NCollection_IndexedDataMap::FindFromIndex");
+
IndexedDataMapNode* aNode = nodeFromIndex (theKey2);
if (aNode == NULL)
{
//! ChangeFromIndex
TheItemType& ChangeFromIndex (const Standard_Integer theKey2)
{
-#if !defined No_Exception && !defined No_Standard_OutOfRange
- if (theKey2 < 1 || theKey2 > Extent())
- Standard_OutOfRange::Raise("NCollection_IndexedDataMap::ChangeFromIndex");
-#endif
+ Standard_OutOfRange_Raise_if (theKey2 < 1 || theKey2 > Extent(), "NCollection_IndexedDataMap::ChangeFromIndex");
+
IndexedDataMapNode* aNode = nodeFromIndex (theKey2);
if (aNode == NULL)
{
//! FindFromKey
const TheItemType& FindFromKey(const TheKeyType& theKey1) const
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (IsEmpty())
- Standard_NoSuchObject::Raise ("NCollection_IndexedDataMap::FindFromKey");
-#endif
+ Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_IndexedDataMap::FindFromKey");
+
IndexedDataMapNode * pNode1 =
(IndexedDataMapNode *) myData1[Hasher::HashCode(theKey1,NbBuckets())];
while (pNode1)
//! ChangeFromKey
TheItemType& ChangeFromKey (const TheKeyType& theKey1)
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (IsEmpty())
- Standard_NoSuchObject::Raise("NCollection_IndexedDataMap::ChangeFromKey");
-#endif
+ Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_IndexedDataMap::ChangeFromKey");
+
IndexedDataMapNode * pNode1 =
(IndexedDataMapNode *) myData1[Hasher::HashCode(theKey1,NbBuckets())];
while (pNode1)
#include <NCollection_DefaultHasher.hxx>
-#if !defined No_Exception && !defined No_Standard_OutOfRange
#include <Standard_OutOfRange.hxx>
-#endif
/**
* Purpose: An indexed map is used to store keys and to bind
const Standard_Integer theKey2,
NCollection_ListNode* theNext1,
NCollection_ListNode* theNext2) :
- NCollection_TListNode<TheKeyType> (theKey1, theNext1)
+ NCollection_TListNode<TheKeyType> (theKey1, theNext1),
+ myKey2(theKey2),
+ myNext2((IndexedMapNode*)theNext2)
{
- myKey2 = theKey2;
- myNext2 = (IndexedMapNode *) theNext2;
}
//! Key1
TheKeyType& Key1 (void)
//! Value access
const TheKeyType& Value(void) const
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (!More())
- Standard_NoSuchObject::Raise("NCollection_IndexedMap::Iterator::Value");
-#endif
+ Standard_NoSuchObject_Raise_if(!More(), "NCollection_IndexedMap::Iterator::Value");
return myMap->FindKey(myIndex);
}
//! Value change access denied - use Substitute
void Substitute (const Standard_Integer theIndex,
const TheKeyType& theKey1)
{
-#if !defined No_Exception && !defined No_Standard_OutOfRange
- if (theIndex < 1 || theIndex > Extent())
- Standard_OutOfRange::Raise ("NCollection_IndexedMap::Substitute");
-#endif
+ Standard_OutOfRange_Raise_if (theIndex < 1 || theIndex > Extent(), "NCollection_IndexedMap::Substitute");
+
IndexedMapNode * p;
// check if theKey1 is not already in the map
Standard_Integer iK1 = Hasher::HashCode (theKey1, NbBuckets());
//! RemoveLast
void RemoveLast (void)
{
-#if !defined No_Exception && !defined No_Standard_OutOfRange
- if (Extent() == 0)
- Standard_OutOfRange::Raise ("NCollection_IndexedMap::RemoveLast");
-#endif
+ Standard_OutOfRange_Raise_if (Extent() == 0, "NCollection_IndexedMap::RemoveLast");
+
IndexedMapNode * p, * q;
// Find the node for the last index and remove it
Standard_Integer iK2 = ::HashCode (Extent(), NbBuckets());
//! FindKey
const TheKeyType& FindKey (const Standard_Integer theKey2) const
{
-#if !defined No_Exception && !defined No_Standard_OutOfRange
- if (theKey2 < 1 || theKey2 > Extent())
- Standard_OutOfRange::Raise ("NCollection_IndexedMap::FindKey");
-#endif
+ Standard_OutOfRange_Raise_if (theKey2 < 1 || theKey2 > Extent(), "NCollection_IndexedMap::FindKey");
+
IndexedMapNode * pNode2 =
(IndexedMapNode *) myData2[::HashCode(theKey2,NbBuckets())];
while (pNode2)
#include <NCollection_TListIterator.hxx>
#include <NCollection_StlIterator.hxx>
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
#include <Standard_NoSuchObject.hxx>
-#endif
/**
* Purpose: Simple list to link items together keeping the first
//! First item
const TheItemType& First (void) const
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (IsEmpty())
- Standard_NoSuchObject::Raise ("NCollection_List::First");
-#endif
+ Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_List::First");
return ((const ListNode *) PFirst())->Value();
}
+ //! First item (non-const)
+ TheItemType& First (void)
+ {
+ Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_List::First");
+ return ((ListNode *) PFirst())->ChangeValue();
+ }
+
//! Last item
const TheItemType& Last (void) const
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (IsEmpty())
- Standard_NoSuchObject::Raise ("NCollection_List::Last");
-#endif
+ Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_List::Last");
return ((const ListNode *) PLast())->Value();
}
+ //! Last item (non-const)
+ TheItemType& Last (void)
+ {
+ Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_List::Last");
+ return ((ListNode *) PLast())->ChangeValue();
+ }
+
//! Append one item at the end
TheItemType& Append (const TheItemType& theItem)
{
else
{
// No - this list has different memory scope
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (!theIter.More())
- Standard_NoSuchObject::Raise ("NCollection_List::InsertAfter");
-#endif
+ Standard_NoSuchObject_Raise_if (!theIter.More(), "NCollection_List::InsertAfter");
+
Iterator anIter;
anIter.myPrevious = theIter.myCurrent;
anIter.myCurrent = theIter.myCurrent->Next();
#include <NCollection_DefaultHasher.hxx>
#include <Standard_ImmutableObject.hxx>
-
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
#include <Standard_NoSuchObject.hxx>
-#endif
/**
* Purpose: Single hashed Map. This Map is used to store and
//! Value inquiry
const TheKeyType& Value(void) const
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (!More())
- Standard_NoSuchObject::Raise ("NCollection_Map::Iterator::Value");
-#endif
+ Standard_NoSuchObject_Raise_if (!More(), "NCollection_Map::Iterator::Value");
return ((MapNode *) myNode)->Value();
}
//! Value change access - denied
return * (TheKeyType *) NULL; // For compiler
}
//! Key
- const TheKeyType& Key (void)
+ const TheKeyType& Key (void) const
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (!More())
- Standard_NoSuchObject::Raise ("NCollection_Map::Iterator::Key");
-#endif
+ Standard_NoSuchObject_Raise_if (!More(), "NCollection_Map::Iterator::Key");
return ((MapNode *) myNode)->Value();
}
};
#include <NCollection_BaseSequence.hxx>
#include <NCollection_StlIterator.hxx>
-#ifndef No_Exception
#include <Standard_OutOfRange.hxx>
#include <Standard_NoSuchObject.hxx>
-#endif
/**
* Purpose: Definition of a sequence of elements indexed by
void InsertAfter (const Standard_Integer theIndex,
const TheItemType& theItem)
{
-#if !defined No_Exception && !defined No_Standard_OutOfRange
- if (theIndex < 0 || theIndex > mySize)
- Standard_OutOfRange::Raise ("NCollection_Sequence::InsertAfter");
-#endif
+ Standard_OutOfRange_Raise_if (theIndex < 0 || theIndex > mySize, "NCollection_Sequence::InsertAfter");
PInsertAfter (theIndex, new (this->myAllocator) Node (theItem));
}
//! First item access
const TheItemType& First () const
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (mySize == 0)
- Standard_NoSuchObject::Raise ("NCollection_Sequence::First");
-#endif
+ Standard_NoSuchObject_Raise_if (mySize == 0, "NCollection_Sequence::First");
return ((const Node *) myFirstItem) -> Value();
}
//! First item access
TheItemType& ChangeFirst()
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (mySize == 0)
- Standard_NoSuchObject::Raise ("NCollection_Sequence::ChangeFirst");
-#endif
+ Standard_NoSuchObject_Raise_if (mySize == 0, "NCollection_Sequence::ChangeFirst");
return ((Node* )myFirstItem)->ChangeValue();
}
//! Last item access
const TheItemType& Last () const
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (mySize == 0)
- Standard_NoSuchObject::Raise ("NCollection_Sequence::Last");
-#endif
+ Standard_NoSuchObject_Raise_if (mySize == 0, "NCollection_Sequence::Last");
return ((const Node *) myLastItem) -> Value();
}
//! Last item access
TheItemType& ChangeLast()
{
-#if !defined No_Exception && !defined No_Standard_NoSuchObject
- if (mySize == 0)
- Standard_NoSuchObject::Raise ("NCollection_Sequence::ChangeLast");
-#endif
+ Standard_NoSuchObject_Raise_if (mySize == 0, "NCollection_Sequence::ChangeLast");
return ((Node* )myLastItem)->ChangeValue();
}
//! Constant item access by theIndex
const TheItemType& Value (const Standard_Integer theIndex) const
{
-#if !defined No_Exception && !defined No_Standard_OutOfRange
- if (theIndex <= 0 || theIndex > mySize)
- Standard_OutOfRange::Raise ("NCollection_Sequence::Value");
-#endif
+ Standard_OutOfRange_Raise_if (theIndex <= 0 || theIndex > mySize, "NCollection_Sequence::Value");
+
NCollection_Sequence * const aLocalTHIS = (NCollection_Sequence *) this;
aLocalTHIS -> myCurrentItem = Find (theIndex);
aLocalTHIS -> myCurrentIndex = theIndex;
//! Variable item access by theIndex
TheItemType& ChangeValue (const Standard_Integer theIndex)
{
-#if !defined No_Exception && !defined No_Standard_OutOfRange
- if (theIndex <= 0 || theIndex > mySize)
- Standard_OutOfRange::Raise ("NCollection_Sequence::ChangeValue");
-#endif
+ Standard_OutOfRange_Raise_if (theIndex <= 0 || theIndex > mySize, "NCollection_Sequence::ChangeValue");
+
myCurrentItem = Find (theIndex);
myCurrentIndex = theIndex;
return ((Node *) myCurrentItem) -> ChangeValue();
myPrevious = myCurrent;
myCurrent = myCurrent->Next();
}
+
//! Constant Value access
const TheItemType& Value (void) const
{ return ((const NCollection_TListNode<TheItemType>*) myCurrent)->Value(); }
- //! Variable Value access
+
+ //! Non-const Value access
+ TheItemType& Value (void)
+ { return ((NCollection_TListNode<TheItemType>*) myCurrent)->ChangeValue(); }
+
+ //! Non-const Value access
TheItemType& ChangeValue (void) const
{ return ((NCollection_TListNode<TheItemType> *)myCurrent)->ChangeValue(); }
};
//! Constructor
NCollection_TListNode (const TheItemType& theItem,
NCollection_ListNode* theNext=NULL) :
- NCollection_ListNode (theNext) { myValue = theItem; }
+ NCollection_ListNode (theNext), myValue(theItem) { }
//! Constant value access
const TheItemType& Value () const { return myValue; }
//! Variable value access
#ifndef Prs3d_NListOfSequenceOfPnt_HeaderFile
#define Prs3d_NListOfSequenceOfPnt_HeaderFile
-#include <TColgp_SequenceOfPnt.hxx>
+#include <TColgp_HSequenceOfPnt.hxx>
#include <NCollection_List.hxx>
-typedef NCollection_List<TColgp_SequenceOfPnt> Prs3d_NListOfSequenceOfPnt;
+typedef NCollection_List<Handle(TColgp_HSequenceOfPnt)> Prs3d_NListOfSequenceOfPnt;
#endif
Prs3d_NListOfSequenceOfPnt aWireCurves;
Prs3d_NListOfSequenceOfPnt aFreeCurves;
Prs3d_NListOfSequenceOfPnt anUnFreeCurves;
- TColgp_SequenceOfPnt aShapePoints;
const Standard_Integer anIsoU = theDrawer->UIsoAspect()->Number();
const Standard_Integer anIsoV = theDrawer->VIsoAspect()->Number();
Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
for (anIt.Init (anUIsoCurves); anIt.More(); anIt.Next())
{
- aNbVertices += anIt.Value().Length();
+ aNbVertices += anIt.Value()->Length();
}
Handle(Graphic3d_ArrayOfPolylines) anUIsoArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
for (anIt.Init (anUIsoCurves); anIt.More(); anIt.Next())
{
- TColgp_SequenceOfPnt aPoints;
- aPoints.Assign (anIt.Value());
- anUIsoArray->AddBound (aPoints.Length());
- for (Standard_Integer anI = 1; anI <= aPoints.Length(); ++anI)
+ const Handle(TColgp_HSequenceOfPnt)& aPoints = anIt.Value();
+ anUIsoArray->AddBound (aPoints->Length());
+ for (Standard_Integer anI = 1; anI <= aPoints->Length(); ++anI)
{
- anUIsoArray->AddVertex (aPoints.Value (anI));
+ anUIsoArray->AddVertex (aPoints->Value (anI));
}
}
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
aGroup->AddPrimitiveArray (anUIsoArray);
}
+ // NOTE: THIS BLOCK WILL NEVER EXECUTE AS aVIsoCurves IS NOT FILLED!!
if (aVIsoCurves.Size() > 0)
{
aNbBounds = aVIsoCurves.Size();
Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
for (anIt.Init (aVIsoCurves); anIt.More(); anIt.Next())
{
- aNbVertices += anIt.Value().Length();
+ aNbVertices += anIt.Value()->Length();
}
Handle(Graphic3d_ArrayOfPolylines) VIsoArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
for (anIt.Init (aVIsoCurves); anIt.More(); anIt.Next())
{
- TColgp_SequenceOfPnt aPoints;
- aPoints.Assign (anIt.Value());
- VIsoArray->AddBound (aPoints.Length());
- for (int anI = 1; anI <= aPoints.Length(); anI++)
+ const Handle(TColgp_HSequenceOfPnt)& aPoints = anIt.Value();
+ VIsoArray->AddBound (aPoints->Length());
+ for (int anI = 1; anI <= aPoints->Length(); anI++)
{
- VIsoArray->AddVertex (aPoints.Value (anI));
+ VIsoArray->AddVertex (aPoints->Value (anI));
}
}
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
try
{
OCC_CATCH_SIGNALS
- TColgp_SequenceOfPnt aPoints;
- if (!AddPolygon (anEdge, aDeflection, aPoints))
+ const Handle(TColgp_HSequenceOfPnt)& aPoints = new TColgp_HSequenceOfPnt;
+ if (!AddPolygon (anEdge, aDeflection, aPoints->ChangeSequence()))
{
if (BRep_Tool::IsGeometric (anEdge))
{
BRepAdaptor_Curve aCurve (anEdge);
myCurveAlgo.Add (thePresentation, aCurve, aDeflection, theDrawer,
- aPoints, Standard_False);
+ aPoints->ChangeSequence(), Standard_False);
aWireCurves.Append (aPoints);
}
}
try
{
OCC_CATCH_SIGNALS
- TColgp_SequenceOfPnt aPoints;
- if (!AddPolygon (anEdge, aDeflection, aPoints))
+ const Handle(TColgp_HSequenceOfPnt)& aPoints = new TColgp_HSequenceOfPnt;
+ if (!AddPolygon (anEdge, aDeflection, aPoints->ChangeSequence()))
{
if (BRep_Tool::IsGeometric (anEdge))
{
BRepAdaptor_Curve aCurve (anEdge);
myCurveAlgo.Add (thePresentation, aCurve, aDeflection, theDrawer,
- aPoints, Standard_False);
+ aPoints->ChangeSequence(), Standard_False);
aFreeCurves.Append (aPoints);
}
}
try
{
OCC_CATCH_SIGNALS
- TColgp_SequenceOfPnt aPoints;
- if (!AddPolygon (anEdge, aDeflection, aPoints))
+ const Handle(TColgp_HSequenceOfPnt)& aPoints = new TColgp_HSequenceOfPnt;
+ if (!AddPolygon (anEdge, aDeflection, aPoints->ChangeSequence()))
{
if (BRep_Tool::IsGeometric (anEdge))
{
BRepAdaptor_Curve aCurve (anEdge);
- myCurveAlgo.Add (thePresentation, aCurve, aDeflection, theDrawer, aPoints, Standard_False);
+ myCurveAlgo.Add (thePresentation, aCurve, aDeflection, theDrawer, aPoints->ChangeSequence(), Standard_False);
anUnFreeCurves.Append (aPoints);
}
}
Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
for (anIt.Init (aWireCurves); anIt.More(); anIt.Next())
{
- aNbVertices += anIt.Value().Length();
+ aNbVertices += anIt.Value()->Length();
}
Handle(Graphic3d_ArrayOfPolylines) WireArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
for (anIt.Init (aWireCurves); anIt.More(); anIt.Next())
{
- TColgp_SequenceOfPnt aPoints;
- aPoints.Assign (anIt.Value());
- WireArray->AddBound (aPoints.Length());
- for (anI = 1; anI <= aPoints.Length(); ++anI)
+ const Handle(TColgp_HSequenceOfPnt)& aPoints = anIt.Value();
+ WireArray->AddBound (aPoints->Length());
+ for (anI = 1; anI <= aPoints->Length(); ++anI)
{
- WireArray->AddVertex (aPoints.Value (anI));
+ WireArray->AddVertex (aPoints->Value (anI));
}
}
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
for (anIt.Init (aFreeCurves); anIt.More(); anIt.Next())
{
- aNbVertices += anIt.Value().Length();
+ aNbVertices += anIt.Value()->Length();
}
Handle(Graphic3d_ArrayOfPolylines) aFreeArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
for (anIt.Init(aFreeCurves); anIt.More(); anIt.Next())
{
- TColgp_SequenceOfPnt aPoints;
- aPoints.Assign (anIt.Value());
- aFreeArray->AddBound (aPoints.Length());
- for (anI = 1; anI <= aPoints.Length(); ++anI)
+ const Handle(TColgp_HSequenceOfPnt)& aPoints = anIt.Value();
+ aFreeArray->AddBound (aPoints->Length());
+ for (anI = 1; anI <= aPoints->Length(); ++anI)
{
- aFreeArray->AddVertex (aPoints.Value (anI));
+ aFreeArray->AddVertex (aPoints->Value (anI));
}
}
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
for (anIt.Init (anUnFreeCurves); anIt.More(); anIt.Next())
{
- aNbVertices += anIt.Value().Length();
+ aNbVertices += anIt.Value()->Length();
}
Handle(Graphic3d_ArrayOfPolylines) anUnFreeArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
for (anIt.Init (anUnFreeCurves); anIt.More(); anIt.Next())
{
- TColgp_SequenceOfPnt aPoints;
- aPoints.Assign (anIt.Value());
- anUnFreeArray->AddBound (aPoints.Length());
- for (anI = 1; anI <= aPoints.Length(); ++anI)
+ const Handle(TColgp_HSequenceOfPnt)& aPoints = anIt.Value();
+ anUnFreeArray->AddBound (aPoints->Length());
+ for (anI = 1; anI <= aPoints->Length(); ++anI)
{
- anUnFreeArray->AddVertex (aPoints.Value (anI));
+ anUnFreeArray->AddVertex (aPoints->Value (anI));
}
}
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
}
// Points
+ TColgp_SequenceOfPnt aShapePoints;
for (aTool.InitVertex(); aTool.MoreVertex(); aTool.NextVertex())
{
aShapePoints.Append (BRep_Tool::Pnt (aTool.GetVertex()));
#include <gp_Pnt.hxx>
+#include <NCollection_Vector.hxx>
+
#define ItemType gp_Pnt
#define Key1Type Standard_Real
#define Key2Type Standard_Integer
return 0;
}
+//=======================================================================
+//function : QANColTestVector
+//purpose :
+//=======================================================================
+static Standard_Integer QANColTestVector (Draw_Interpretor&, Standard_Integer, const char**)
+{
+ // test method Append and copying of empty vector
+ NCollection_Vector<int> aVec;
+ NCollection_Vector<int> aVec2 (aVec);
+ NCollection_Vector<int> aVec3;
+ aVec3 = aVec;
+
+ aVec.Append(5);
+ if (aVec(0) != 5)
+ std::cout << "Error: wrong value in original vector!" << endl;
+ aVec2.Append(5);
+ if (aVec2(0) != 5)
+ std::cout << "Error: wrong value in copy-constructed vector!" << endl;
+ aVec3.Append(5);
+ if (aVec3(0) != 5)
+ std::cout << "Error: wrong value in copied vector!" << endl;
+ std::cout << "Test OK" << endl;
+
+ return 0;
+}
+
//=======================================================================
//function : QANColTestSequence
//purpose :
theCommands.Add("QANColTestIndexedDataMap", "QANColTestIndexedDataMap", __FILE__, QANColTestIndexedDataMap, group);
theCommands.Add("QANColTestList", "QANColTestList", __FILE__, QANColTestList, group);
theCommands.Add("QANColTestSequence", "QANColTestSequence", __FILE__, QANColTestSequence, group);
-
- return;
+ theCommands.Add("QANColTestVector", "QANColTestVector", __FILE__, QANColTestVector, group);
}
-SelectMgr_DataMapOfObjectOwners.hxx
SelectMgr_CompareResults.hxx
\ No newline at end of file
+++ /dev/null
-// Created on: 2003-10-16
-// Created by: Alexander Solovyov
-// 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.
-
-#ifndef _SelectMgr_DataMapOfObjectOwners_HeaderFile
-#define _SelectMgr_DataMapOfObjectOwners_HeaderFile
-
-#include <NCollection_DataMap.hxx>
-#include <SelectMgr_SelectableObject.hxx>
-#include <SelectMgr_SequenceOfOwner.hxx>
-
-inline Standard_Boolean IsEqual (const Handle(SelectMgr_SelectableObject)& theH1,
- const Handle(SelectMgr_SelectableObject)& theH2)
-{
- return (theH1 == theH2);
-}
-
-typedef NCollection_DataMap<Handle(SelectMgr_SelectableObject), SelectMgr_SequenceOfOwner> SelectMgr_DataMapOfObjectOwners;
-typedef SelectMgr_DataMapOfObjectOwners::Iterator SelectMgr_DataMapIteratorOfMapOfObjectOwners;
-
-#endif
GeomAdaptor_Curve GC(BC);
FindLimits(GC, aLimit,b1, b2);
if (b2-b1>Precision::Confusion()) {
- TColgp_SequenceOfPnt Points;
- StdPrs_DeflectionCurve::Add(aPresentation, GC, b1, b2, Deflection, Points, anAngle, Standard_False);
+ Handle(TColgp_HSequenceOfPnt) Points = new TColgp_HSequenceOfPnt;
+ StdPrs_DeflectionCurve::Add (aPresentation, GC, b1, b2, Deflection,
+ Points->ChangeSequence(), anAngle, Standard_False);
Curves.Append(Points);
}
}
anIso.Load(GeomAbs_IsoV,Coord,b1,b2);
FindLimits(anIso, aLimit,b1, b2);
if (b2-b1>Precision::Confusion()) {
- TColgp_SequenceOfPnt Points;
- StdPrs_DeflectionCurve::Add(aPresentation, anIso, b1, b2, Deflection, Points, anAngle, Standard_False);
+ Handle(TColgp_HSequenceOfPnt) Points = new TColgp_HSequenceOfPnt;
+ StdPrs_DeflectionCurve::Add (aPresentation, anIso, b1, b2, Deflection,
+ Points->ChangeSequence(), anAngle, Standard_False);
Curves.Append(Points);
}
}
if(b1 == RealFirst() || b2 == RealLast())
continue;
- TColgp_SequenceOfPnt aPoints;
+ Handle(TColgp_HSequenceOfPnt) aPoints = new TColgp_HSequenceOfPnt;
if (!aGeomBSurface.IsNull())
{
if (anIsoBuild.IsXLine(anI))
//Note that the isos are the part of the shape, it will be displayed after a computation the whole shape
//NbPoints = 30 - default parameter for computation of such curves
- StdPrs_Curve::Add(thePresentation,GeomAdaptor_Curve(aBCurve), b1, b2, theDeflection, aPoints, 30, Standard_False);
+ StdPrs_Curve::Add (thePresentation, GeomAdaptor_Curve(aBCurve), b1, b2, theDeflection,
+ aPoints->ChangeSequence(), 30, Standard_False);
theCurves.Append(aPoints);
}
else
anIsoCurve.Load(GeomAbs_IsoU,anIsoCoord,b1,b2);
else
anIsoCurve.Load(GeomAbs_IsoV,anIsoCoord,b1,b2);
- StdPrs_Curve::Add(thePresentation,anIsoCurve, theDeflection, theDrawer, aPoints, Standard_False);
+ StdPrs_Curve::Add (thePresentation, anIsoCurve, theDeflection, theDrawer,
+ aPoints->ChangeSequence(), Standard_False);
theCurves.Append(aPoints);
}
}
Prs3d_NListOfSequenceOfPnt freeCurves;
Prs3d_NListOfSequenceOfPnt UIsoCurves;
Prs3d_NListOfSequenceOfPnt VIsoCurves;
- TColgp_SequenceOfPnt Pnts;
Standard_Boolean UClosed = aSurface->IsUClosed();
Standard_Boolean VClosed = aSurface->IsVClosed();
if ( !UClosed )
{
anIso.Load(GeomAbs_IsoU,U1,V1,V2);
- StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, Standard_False);
- freeCurves.Append(Pnts);
- Pnts.Clear();
+ Handle(TColgp_HSequenceOfPnt) aPntsU1 = new TColgp_HSequenceOfPnt;
+ StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, aPntsU1->ChangeSequence(), Standard_False);
+ freeCurves.Append(aPntsU1);
anIso.Load(GeomAbs_IsoU,U2,V1,V2);
- StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, Standard_False);
- freeCurves.Append(Pnts);
- Pnts.Clear();
+ Handle(TColgp_HSequenceOfPnt) aPntsU2 = new TColgp_HSequenceOfPnt;
+ StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, aPntsU2->ChangeSequence(), Standard_False);
+ freeCurves.Append(aPntsU2);
}
if ( !VClosed )
{
anIso.Load(GeomAbs_IsoV,V1,U1,U2);
- StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, Standard_False);
- freeCurves.Append(Pnts);
- Pnts.Clear();
+ Handle(TColgp_HSequenceOfPnt) aPntsV1 = new TColgp_HSequenceOfPnt;
+ StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, aPntsV1->ChangeSequence(), Standard_False);
+ freeCurves.Append(aPntsV1);
anIso.Load(GeomAbs_IsoV,V2,U1,U2);
- StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, Standard_False);
- freeCurves.Append(Pnts);
- Pnts.Clear();
+ Handle(TColgp_HSequenceOfPnt) aPntsV2 = new TColgp_HSequenceOfPnt;
+ StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, aPntsV2->ChangeSequence(), Standard_False);
+ freeCurves.Append(aPntsV2);
}
}
//
Standard_Real du= UClosed ? (U2-U1)/fin : (U2-U1)/(1+fin);
for (Standard_Integer i=1; i<=fin;i++){
anIso.Load(GeomAbs_IsoU,U1+du*i,V1,V2);
- StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, Standard_False);
+ Handle(TColgp_HSequenceOfPnt) Pnts = new TColgp_HSequenceOfPnt;
+ StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts->ChangeSequence(), Standard_False);
UIsoCurves.Append(Pnts);
- Pnts.Clear();
}
}
fin = aDrawer->VIsoAspect()->Number();
Standard_Real dv= VClosed ?(V2-V1)/fin : (V2-V1)/(1+fin);
for (Standard_Integer i=1; i<=fin;i++){
anIso.Load(GeomAbs_IsoV,V1+dv*i,U1,U2);
- StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts, Standard_False);
+ Handle(TColgp_HSequenceOfPnt) Pnts = new TColgp_HSequenceOfPnt;
+ StdPrs_Curve::Add(aPresentation,anIso,TheDeflection, aDrawer, Pnts->ChangeSequence(), Standard_False);
VIsoCurves.Append(Pnts);
- Pnts.Clear();
}
}
nbBounds = UIsoCurves.Size();
Prs3d_NListIteratorOfListOfSequenceOfPnt It;
for( It.Init(UIsoCurves); It.More(); It.Next())
- nbVertices += It.Value().Length();
+ nbVertices += It.Value()->Length();
Handle(Graphic3d_ArrayOfPolylines) UIsoArray =
new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
for( It.Init(UIsoCurves); It.More(); It.Next()) {
- TColgp_SequenceOfPnt Pnts;
- Pnts.Assign(It.Value());
- UIsoArray->AddBound(Pnts.Length());
- for(int i=1; i<=Pnts.Length(); i++)
- UIsoArray->AddVertex(Pnts.Value(i));
+ const Handle(TColgp_HSequenceOfPnt)& Pnts = It.Value();
+ UIsoArray->AddBound(Pnts->Length());
+ for(int i=1; i<=Pnts->Length(); i++)
+ UIsoArray->AddVertex(Pnts->Value(i));
}
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->UIsoAspect()->Aspect());
nbBounds = VIsoCurves.Size();
Prs3d_NListIteratorOfListOfSequenceOfPnt It;
for( It.Init(VIsoCurves); It.More(); It.Next())
- nbVertices += It.Value().Length();
+ nbVertices += It.Value()->Length();
Handle(Graphic3d_ArrayOfPolylines) VIsoArray =
new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
for( It.Init(VIsoCurves); It.More(); It.Next()) {
- TColgp_SequenceOfPnt Pnts;
- Pnts.Assign(It.Value());
- VIsoArray->AddBound(Pnts.Length());
- for(int i=1; i<=Pnts.Length(); i++)
- VIsoArray->AddVertex(Pnts.Value(i));
+ const Handle(TColgp_HSequenceOfPnt)& Pnts = It.Value();
+ VIsoArray->AddBound(Pnts->Length());
+ for(int i=1; i<=Pnts->Length(); i++)
+ VIsoArray->AddVertex(Pnts->Value(i));
}
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->VIsoAspect()->Aspect());
nbBounds = freeCurves.Size();
Prs3d_NListIteratorOfListOfSequenceOfPnt It;
for( It.Init(freeCurves); It.More(); It.Next())
- nbVertices += It.Value().Length();
+ nbVertices += It.Value()->Length();
Handle(Graphic3d_ArrayOfPolylines) freeArray =
new Graphic3d_ArrayOfPolylines(nbVertices,nbBounds);
for( It.Init(freeCurves); It.More(); It.Next()) {
- TColgp_SequenceOfPnt Pnts;
- Pnts.Assign(It.Value());
- freeArray->AddBound(Pnts.Length());
- for(int i=1; i<=Pnts.Length(); i++)
- freeArray->AddVertex(Pnts.Value(i));
+ const Handle(TColgp_HSequenceOfPnt)& Pnts = It.Value();
+ freeArray->AddBound(Pnts->Length());
+ for(int i=1; i<=Pnts->Length(); i++)
+ freeArray->AddVertex(Pnts->Value(i));
}
Handle(Graphic3d_Group) TheGroup = Prs3d_Root::NewGroup(aPresentation);
TheGroup->SetPrimitivesAspect(aDrawer->FreeBoundaryAspect()->Aspect());