Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-13 09:17:16

0001 // Created on: 2002-04-23
0002 // Created by: Alexander KARTOMIN
0003 // Copyright (c) 2002-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef NCollection_TListIterator_HeaderFile
0017 #define NCollection_TListIterator_HeaderFile
0018 
0019 #include <NCollection_BaseList.hxx>
0020 #include <NCollection_TListNode.hxx>
0021 
0022 /**
0023  * Purpose:     This Iterator class iterates on BaseList of TListNode and is
0024  *              instantiated in List/Set/Queue/Stack
0025  * Remark:      TListIterator is internal class
0026  */
0027 template <class TheItemType>
0028 class NCollection_TListIterator : public NCollection_BaseList::Iterator
0029 {
0030 public:
0031   //! Empty constructor - for later Init
0032   NCollection_TListIterator() noexcept
0033       : NCollection_BaseList::Iterator()
0034   {
0035   }
0036 
0037   //! Constructor with initialisation
0038   NCollection_TListIterator(const NCollection_BaseList& theList) noexcept
0039       : NCollection_BaseList::Iterator(theList)
0040   {
0041   }
0042 
0043   //! Check end
0044   bool More() const noexcept { return (myCurrent != nullptr); }
0045 
0046   //! Make step
0047   void Next() noexcept
0048   {
0049     myPrevious = myCurrent;
0050     myCurrent  = myCurrent->Next();
0051   }
0052 
0053   //! Constant Value access
0054   const TheItemType& Value() const noexcept
0055   {
0056     return ((const NCollection_TListNode<TheItemType>*)myCurrent)->Value();
0057   }
0058 
0059   //! Non-const Value access
0060   TheItemType& Value() noexcept
0061   {
0062     return ((NCollection_TListNode<TheItemType>*)myCurrent)->ChangeValue();
0063   }
0064 
0065   //! Non-const Value access
0066   TheItemType& ChangeValue() const noexcept
0067   {
0068     return ((NCollection_TListNode<TheItemType>*)myCurrent)->ChangeValue();
0069   }
0070 };
0071 
0072 #endif