PixelLightAPI  .
FibonacciHeapIterator.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: FibonacciHeapIterator.h                        *
00003  *
00004  *  Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  *  GNU Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLCORE_CONTAINER_FIBONACCIHEAPITERATOR_H__
00024 #define __PLCORE_CONTAINER_FIBONACCIHEAPITERATOR_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLCore/Container/Stack.h"
00032 #include "PLCore/Container/IteratorImpl.h"
00033 
00034 
00035 //[-------------------------------------------------------]
00036 //[ Namespace                                             ]
00037 //[-------------------------------------------------------]
00038 namespace PLCore {
00039 
00040 
00041 //[-------------------------------------------------------]
00042 //[ Forward declarations                                  ]
00043 //[-------------------------------------------------------]
00044 template <class KeyType, class ValueType, class Comparer> class FibonacciHeap;
00045 
00046 
00047 //[-------------------------------------------------------]
00048 //[ Classes                                               ]
00049 //[-------------------------------------------------------]
00050 /**
00051 *  @brief
00052 *    Fibonacci heap iterator class
00053 */
00054 template <class KeyType, class ValueType, class Comparer>
00055 class FibonacciHeapIterator : public IteratorImpl<ValueType> {
00056 
00057 
00058     //[-------------------------------------------------------]
00059     //[ Friends                                               ]
00060     //[-------------------------------------------------------]
00061     friend class FibonacciHeap<KeyType, ValueType, Comparer>;
00062 
00063 
00064     //[-------------------------------------------------------]
00065     //[ Private functions                                     ]
00066     //[-------------------------------------------------------]
00067     private:
00068         /**
00069         *  @brief
00070         *    Constructor
00071         *
00072         *  @param[in] cHeapOwner
00073         *    Fibonacci heap to operate on
00074         *  @param[in] nIndex
00075         *    Start index, if >= GetNumOfElements() the index is set to the last valid index
00076         */
00077         FibonacciHeapIterator(const FibonacciHeap<KeyType, ValueType, Comparer> &cHeapOwner, uint32 nIndex);
00078 
00079         /**
00080         *  @brief
00081         *    Constructor
00082         *
00083         *  @param[in] cHeapOwner
00084         *    Fibonacci heap to operate on
00085         *
00086         *  @note
00087         *    - The iterator will start at the last element
00088         */
00089         FibonacciHeapIterator(const FibonacciHeap<KeyType, ValueType, Comparer> &cHeapOwner);
00090 
00091         /**
00092         *  @brief
00093         *    Copy constructor
00094         *
00095         *  @param[in] cSource
00096         *    Source to copy from
00097         */
00098         FibonacciHeapIterator(const FibonacciHeapIterator<KeyType, ValueType, Comparer> &cSource);
00099 
00100         /**
00101         *  @brief
00102         *    Destructor
00103         */
00104         virtual ~FibonacciHeapIterator();
00105 
00106 
00107     //[-------------------------------------------------------]
00108     //[ Private data                                          ]
00109     //[-------------------------------------------------------]
00110     private:
00111         const FibonacciHeap<KeyType, ValueType, Comparer>                  *m_pHeapOwner;       /**< Fibonacci heap to operate on (always valid!) */
00112         Stack<typename FibonacciHeap<KeyType, ValueType, Comparer>::Tree*>  m_lstParent;        /**< Parent stack */
00113         typename FibonacciHeap<KeyType, ValueType, Comparer>::Tree         *m_pNextTree;        /**< Next tree, can be a null pointer */
00114         typename FibonacciHeap<KeyType, ValueType, Comparer>::Tree         *m_pPreviousTree;    /**< Previous tree, can be a null pointer */
00115 
00116 
00117     //[-------------------------------------------------------]
00118     //[ Private virtual IteratorImpl functions                ]
00119     //[-------------------------------------------------------]
00120     private:
00121         virtual IteratorImpl<ValueType> *Clone() const override;
00122         virtual bool HasNext() const override;
00123         virtual ValueType &Next() override;
00124         virtual bool HasPrevious() const override;
00125         virtual ValueType &Previous() override;
00126 
00127 
00128 };
00129 
00130 
00131 //[-------------------------------------------------------]
00132 //[ Namespace                                             ]
00133 //[-------------------------------------------------------]
00134 } // PLCore
00135 
00136 
00137 //[-------------------------------------------------------]
00138 //[ Implementation                                        ]
00139 //[-------------------------------------------------------]
00140 #include "PLCore/Container/FibonacciHeapIterator.inl"
00141 
00142 
00143 #endif // __PLCORE_CONTAINER_FIBONACCIHEAPITERATOR_H__


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:08:53
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported