b311480e |
1 | // Created on: 2002-04-23 |
2 | // Created by: Alexander KARTOMIN |
973c2be1 |
3 | // Copyright (c) 2002-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
7fd59977 |
15 | |
16 | #ifndef NCollection_TListIterator_HeaderFile |
17 | #define NCollection_TListIterator_HeaderFile |
18 | |
19 | #include <NCollection_BaseCollection.hxx> |
20 | #include <NCollection_BaseList.hxx> |
21 | #include <NCollection_TListNode.hxx> |
22 | |
7fd59977 |
23 | /** |
24 | * Purpose: This Iterator class iterates on BaseList of TListNode and is |
25 | * instantiated in List/Set/Queue/Stack |
26 | * Remark: TListIterator is internal class |
27 | */ |
28 | template <class TheItemType> class NCollection_TListIterator |
29 | : public NCollection_BaseCollection<TheItemType>::Iterator, |
30 | public NCollection_BaseList::Iterator |
31 | { |
32 | public: |
33 | //! Empty constructor - for later Init |
34 | NCollection_TListIterator (void) : |
35 | NCollection_BaseList::Iterator () {} |
36 | //! Constructor with initialisation |
37 | NCollection_TListIterator (const NCollection_BaseList& theList) : |
38 | NCollection_BaseList::Iterator (theList) {} |
39 | //! Assignment |
40 | NCollection_TListIterator& operator= (const NCollection_TListIterator& theIt) |
41 | { |
42 | NCollection_BaseList::Iterator& me = * this; |
43 | me.operator= (theIt); |
44 | return * this; |
45 | } |
46 | //! Check end |
47 | virtual Standard_Boolean More (void) const |
48 | { return (myCurrent!=NULL); } |
49 | //! Make step |
50 | virtual void Next (void) |
51 | { |
52 | myPrevious = myCurrent; |
53 | myCurrent = myCurrent->Next(); |
54 | } |
55 | //! Constant Value access |
56 | virtual const TheItemType& Value (void) const |
57 | { return ((const NCollection_TListNode<TheItemType>*) myCurrent)->Value(); } |
58 | //! Variable Value access |
59 | virtual TheItemType& ChangeValue (void) const |
60 | { return ((NCollection_TListNode<TheItemType> *)myCurrent)->ChangeValue(); } |
7fd59977 |
61 | }; |
62 | |
7fd59977 |
63 | #endif |