PixelLightAPI  .
Iterable.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: Iterable.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_ITERABLE_H__
00024 #define __PLCORE_CONTAINER_ITERABLE_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLCore/PLCore.h"
00032 #include "PLCore/Container/Iterator.h"
00033 #include "PLCore/Container/ConstIterator.h"
00034 
00035 
00036 //[-------------------------------------------------------]
00037 //[ Namespace                                             ]
00038 //[-------------------------------------------------------]
00039 namespace PLCore {
00040 
00041 
00042 //[-------------------------------------------------------]
00043 //[ Forward declarations                                  ]
00044 //[-------------------------------------------------------]
00045 template <class ValueType> class Iterator;
00046 
00047 
00048 //[-------------------------------------------------------]
00049 //[ Classes                                               ]
00050 //[-------------------------------------------------------]
00051 /**
00052 *  @brief
00053 *    Abstract iterable (aggregate) class
00054 *
00055 *  @see
00056 *    - Iterator for further details and an usage example
00057 */
00058 template <class ValueType>
00059 class Iterable {
00060 
00061 
00062     //[-------------------------------------------------------]
00063     //[ Public static variables                               ]
00064     //[-------------------------------------------------------]
00065     public:
00066         static ValueType Null;  /**< 'Null'-object, do NEVER EVER manipulate this object! */
00067 
00068 
00069     //[-------------------------------------------------------]
00070     //[ Public virtual Iterable functions                     ]
00071     //[-------------------------------------------------------]
00072     public:
00073         /**
00074         *  @brief
00075         *    Destructor
00076         */
00077         virtual ~Iterable<ValueType>() {};
00078 
00079         /**
00080         *  @brief
00081         *    Returns an iterator operating on the derived data structure
00082         *
00083         *  @param[in] nIndex
00084         *    Start index, if >= 'total number of elements' the index is set to the last valid index
00085         *
00086         *  @return
00087         *    Iterator operating on the derived
00088         */
00089         virtual Iterator<ValueType> GetIterator(uint32 nIndex = 0) const = 0;
00090 
00091         /**
00092         *  @brief
00093         *    Returns a constant iterator operating on the derived data structure
00094         *
00095         *  @param[in] nIndex
00096         *    Start index, if >= 'total number of elements' the index is set to the last valid index
00097         *
00098         *  @return
00099         *    Constant iterator operating on the derived
00100         */
00101         virtual ConstIterator<ValueType> GetConstIterator(uint32 nIndex = 0) const = 0;
00102 
00103         /**
00104         *  @brief
00105         *    Returns an iterator operating on the derived data structure and starting at the end
00106         *
00107         *  @return
00108         *    Iterator operating on the derived,
00109         *
00110         *  @remarks
00111         *    Use this function to get an iterator if you want to iterate in reversed order starting
00112         *    at the end last element.
00113         */
00114         virtual Iterator<ValueType> GetEndIterator() const = 0;
00115 
00116         /**
00117         *  @brief
00118         *    Returns a constant iterator operating on the derived data structure and starting at the end
00119         *
00120         *  @return
00121         *    Constant iterator operating on the derived,
00122         *
00123         *  @remarks
00124         *    Use this function to get a constant iterator if you want to iterate in reversed order
00125         *    starting at the end last element.
00126         */
00127         virtual ConstIterator<ValueType> GetConstEndIterator() const = 0;
00128 
00129 
00130 };
00131 
00132 
00133 //[-------------------------------------------------------]
00134 //[ Public static variables                               ]
00135 //[-------------------------------------------------------]
00136 template <class ValueType> ValueType Iterable<ValueType>::Null;
00137 
00138 
00139 //[-------------------------------------------------------]
00140 //[ Namespace                                             ]
00141 //[-------------------------------------------------------]
00142 } // PLCore
00143 
00144 
00145 #endif // __PLCORE_CONTAINER_ITERABLE_H__


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