Warning, file /include/opencascade/NCollection_BaseList.hxx was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 #ifndef NCollection_BaseList_HeaderFile
0026 #define NCollection_BaseList_HeaderFile
0027
0028 #include <Standard_NoSuchObject.hxx>
0029 #include <NCollection_DefineAlloc.hxx>
0030 #include <NCollection_ListNode.hxx>
0031
0032 typedef void (* NCollection_DelListNode)
0033 (NCollection_ListNode*, Handle(NCollection_BaseAllocator)& theAl);
0034
0035
0036 class NCollection_BaseList
0037 {
0038 public:
0039
0040 DEFINE_STANDARD_ALLOC
0041 DEFINE_NCOLLECTION_ALLOC
0042
0043 public:
0044 class Iterator
0045 {
0046 public:
0047
0048 Iterator (void) :
0049 myCurrent (NULL),
0050 myPrevious(NULL) {}
0051
0052 Iterator (const NCollection_BaseList& theList) :
0053 myCurrent (theList.myFirst),
0054 myPrevious(NULL) {}
0055
0056 void Init (const NCollection_BaseList& theList)
0057 {
0058 myCurrent = theList.myFirst;
0059 myPrevious = NULL;
0060 }
0061
0062 void Initialize (const NCollection_BaseList& theList)
0063 {
0064 Init(theList);
0065 }
0066
0067 Standard_Boolean More (void) const
0068 { return (myCurrent!=NULL); }
0069
0070
0071 Standard_Boolean operator== (const Iterator& theIt) const
0072 {
0073 return myCurrent == theIt.myCurrent;
0074 }
0075
0076
0077 Standard_Boolean IsEqual (const Iterator& theOther) const
0078 {
0079 return *this == theOther;
0080 }
0081 protected:
0082 void Init (const NCollection_BaseList& theList,
0083 NCollection_ListNode * const thePrev)
0084 {
0085 myCurrent = thePrev ? thePrev -> Next() :
0086 (NCollection_ListNode *)theList.PLast();
0087 myPrevious = thePrev;
0088 }
0089 public:
0090 NCollection_ListNode * myCurrent;
0091 NCollection_ListNode * myPrevious;
0092 friend class NCollection_BaseList;
0093 };
0094
0095 public:
0096
0097
0098
0099 Standard_Integer Extent (void) const
0100 { return myLength; }
0101
0102
0103
0104 Standard_Boolean IsEmpty (void) const
0105 { return (myFirst == NULL); }
0106
0107
0108
0109 const Handle(NCollection_BaseAllocator)& Allocator() const
0110 { return myAllocator; }
0111
0112
0113
0114 virtual ~NCollection_BaseList (void)
0115 {}
0116
0117 protected:
0118
0119
0120
0121
0122 NCollection_BaseList (const Handle(NCollection_BaseAllocator)& theAllocator=0L) :
0123 myFirst(NULL),
0124 myLast(NULL),
0125 myLength(0)
0126 {
0127 myAllocator = (theAllocator.IsNull() ? NCollection_BaseAllocator::CommonBaseAllocator() : theAllocator);
0128 }
0129
0130
0131
0132 Standard_EXPORT void PClear (NCollection_DelListNode fDel);
0133
0134
0135
0136 const NCollection_ListNode* PFirst (void) const
0137 { return myFirst; }
0138
0139
0140
0141 const NCollection_ListNode* PLast (void) const
0142 { return myLast; }
0143
0144
0145
0146 Standard_EXPORT void PAppend (NCollection_ListNode* theNode);
0147
0148
0149
0150 void PAppend (NCollection_ListNode* theNode,
0151 Iterator& theIt)
0152 {
0153 NCollection_ListNode * aPrev = myLast;
0154 PAppend (theNode);
0155 theIt.Init (* this, aPrev);
0156 }
0157
0158
0159
0160 Standard_EXPORT void PAppend (NCollection_BaseList& theOther);
0161
0162
0163
0164 Standard_EXPORT void PPrepend (NCollection_ListNode* theNode);
0165
0166
0167
0168 Standard_EXPORT void PPrepend (NCollection_BaseList& theOther);
0169
0170
0171
0172 Standard_EXPORT void PRemoveFirst
0173 (NCollection_DelListNode fDel);
0174
0175
0176
0177 Standard_EXPORT void PRemove
0178 (Iterator& theIter,
0179 NCollection_DelListNode fDel);
0180
0181
0182
0183 Standard_EXPORT void PInsertBefore (NCollection_ListNode* theNode,
0184 Iterator& theIter);
0185
0186
0187
0188 Standard_EXPORT void PInsertBefore (NCollection_BaseList& theOther,
0189 Iterator& theIter);
0190
0191
0192
0193 Standard_EXPORT void PInsertAfter (NCollection_ListNode* theNode,
0194 Iterator& theIter);
0195
0196
0197
0198 Standard_EXPORT void PInsertAfter (NCollection_BaseList& theOther,
0199 Iterator& theIter);
0200
0201
0202
0203 Standard_EXPORT void PReverse ();
0204
0205 protected:
0206
0207 Handle(NCollection_BaseAllocator) myAllocator;
0208 NCollection_ListNode * myFirst;
0209 NCollection_ListNode * myLast;
0210 Standard_Integer myLength;
0211
0212
0213 friend class Iterator;
0214 };
0215
0216 #endif