From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- .../nel/layered__ordering__table_8h-source.html | 347 +++++++++++++++++++++ 1 file changed, 347 insertions(+) create mode 100644 docs/doxygen/nel/layered__ordering__table_8h-source.html (limited to 'docs/doxygen/nel/layered__ordering__table_8h-source.html') diff --git a/docs/doxygen/nel/layered__ordering__table_8h-source.html b/docs/doxygen/nel/layered__ordering__table_8h-source.html new file mode 100644 index 00000000..81c60250 --- /dev/null +++ b/docs/doxygen/nel/layered__ordering__table_8h-source.html @@ -0,0 +1,347 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
+
+ + +
+ + +
+Docs + +
+  + + + + + +
Documentation 
+ +
+Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  
+

layered_ordering_table.h

Go to the documentation of this file.
00001 
+00007 /* Copyright, 2000, 2001 Nevrax Ltd.
+00008  *
+00009  * This file is part of NEVRAX NEL.
+00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
+00011  * it under the terms of the GNU General Public License as published by
+00012  * the Free Software Foundation; either version 2, or (at your option)
+00013  * any later version.
+00014 
+00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
+00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
+00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+00018  * General Public License for more details.
+00019 
+00020  * You should have received a copy of the GNU General Public License
+00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
+00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+00023  * MA 02111-1307, USA.
+00024  */
+00025 
+00026 #ifndef NL_LAYERED_ORDERING_TABLE_H
+00027 #define NL_LAYERED_ORDERING_TABLE_H
+00028 
+00029 #include "nel/misc/types_nl.h"
+00030 #include "3d/ordering_table.h"
+00031 
+00032 namespace NL3D {
+00033 
+00034 
+00042 template <class T>
+00043 class CLayeredOrderingTable
+00044 {
+00045 public: 
+00046 
+00048         CLayeredOrderingTable();
+00049 
+00054         void init( uint32 nNbEntries );
+00055 
+00059         uint32 getSize();
+00060 
+00065         void reset(uint maxElementToInsert);
+00066 
+00072         void insert( uint layer, T *pValue, uint32 nEntryPos = 0 );
+00073 
+00088         inline void begin(bool forwardTraversal = true);
+00089 
+00093         inline T* get();
+00094 
+00098         inline void next();
+00099 
+00100 // =================
+00101 // =================
+00102 // IMPLEMENTATION.
+00103 // =================
+00104 // =================
+00105 private:
+00106         typedef std::vector<T *> TTypePtVect;
+00107         COrderingTable<T>               _Layer0;        
+00108         TTypePtVect                             _Layer1;
+00109         COrderingTable<T>               _Layer2;        
+00110         uint                                    _IndexInLayer1;
+00111         uint8                                   _CurrLayer;
+00112         bool                                    _ForwardTraversal;
+00113 };
+00114 
+00115 
+00118 template <class T>
+00119 CLayeredOrderingTable<T>::CLayeredOrderingTable()  : _IndexInLayer1(0), _CurrLayer(0), _ForwardTraversal(true){
+00120 
+00121 }
+00122 
+00123 //==================================================================
+00124 template <class T>
+00125 void CLayeredOrderingTable<T>::init( uint32 nNbEntries )
+00126 {
+00127         _Layer0.init(nNbEntries);
+00128         _Layer2.init(nNbEntries);
+00129 }
+00130 
+00131 //==================================================================
+00132 template <class T>
+00133 uint32 CLayeredOrderingTable<T>::getSize()
+00134 {
+00135         nlassert(_Layer0.getSize() == _Layer2.getSize());
+00136         return _Layer0.getSize();
+00137 }
+00138 
+00139 //==================================================================
+00140 template <class T>
+00141 void CLayeredOrderingTable<T>::reset(uint maxElementToInsert)
+00142 {
+00143         _Layer0.reset(maxElementToInsert);
+00144         _Layer2.reset(maxElementToInsert);
+00145         _Layer1.clear();
+00146 }
+00147 
+00148 //==================================================================
+00149 template <class T>
+00150 void CLayeredOrderingTable<T>::insert( uint layer, T *pValue, uint32 nEntryPos /* = 0 */)
+00151 {
+00152         switch (layer)
+00153         {
+00154                 case 0:                 
+00155                         _Layer0.insert(nEntryPos, pValue);
+00156                 break;
+00157                 case 1:                 
+00158                         _Layer1.push_back(pValue);
+00159                 break;
+00160                 case 2:                 
+00161                         _Layer2.insert(nEntryPos, pValue);
+00162                 break;
+00163                 default:
+00164                         nlassert(0); // invalid layer
+00165                 break;
+00166         }
+00167 }
+00168 
+00169 //==================================================================
+00170 template <class T>
+00171 inline void CLayeredOrderingTable<T>::begin(bool forwardTraversal /*= true*/)
+00172 {
+00173         _ForwardTraversal = forwardTraversal;
+00174         if (forwardTraversal)
+00175         {                               
+00176                 _Layer0.begin();
+00177                 if (!_Layer0.get())
+00178                 {
+00179                         if (_Layer1.size() != 0)
+00180                         {
+00181                                 _CurrLayer = 1;
+00182                                 _IndexInLayer1 = 0;
+00183                         }
+00184                         else
+00185                         {
+00186                                 _CurrLayer = 2;
+00187                                 _Layer2.begin();
+00188                         }
+00189                 }
+00190                 else
+00191                 {
+00192                         _CurrLayer = 0;
+00193                 }
+00194         }
+00195         else
+00196         {               
+00197                 _Layer2.begin();
+00198                 if (!_Layer2.get())
+00199                 {
+00200                         if (_Layer1.size() != 0)
+00201                         {
+00202                                 _CurrLayer = 1;
+00203                                 _IndexInLayer1 = 0;
+00204                         }
+00205                         else
+00206                         {
+00207                                 _CurrLayer = 0;
+00208                                 _Layer0.begin();
+00209                         }
+00210                 }
+00211                 else
+00212                 {
+00213                         _CurrLayer = 2;
+00214                 }
+00215         }
+00216 }
+00217 
+00218 //==================================================================
+00219 template <class T>
+00220 inline T* CLayeredOrderingTable<T>::get()
+00221 {
+00222         switch(_CurrLayer)
+00223         {
+00224                 case 0:                 
+00225                         return _Layer0.get();
+00226                 break;
+00227                 case 1:                 
+00228                         return _Layer1[_IndexInLayer1];
+00229                 break;
+00230                 case 2:                 
+00231                         return _Layer2.get();
+00232                 break;
+00233                 default:
+00234                         nlassert(0);
+00235                 break;
+00236         }
+00237         return NULL; // avoid warning
+00238 }
+00239 
+00240 //==================================================================
+00241 template <class T>
+00242 inline void CLayeredOrderingTable<T>::next()
+00243 {
+00244         if (_ForwardTraversal)
+00245         {               
+00246                 switch(_CurrLayer)
+00247                 {
+00248                         case 0:
+00249                                 _Layer0.next();
+00250                                 if (_Layer0.get() == NULL)
+00251                                 {
+00252                                         if (_Layer1.size() != 0)
+00253                                         {
+00254                                                 _CurrLayer = 1;
+00255                                                 _IndexInLayer1 = 0;
+00256                                         }
+00257                                         else
+00258                                         {
+00259                                                 _CurrLayer = 2;
+00260                                                 _Layer2.begin();
+00261                                         }
+00262                                 }
+00263 
+00264                         break;
+00265                         case 1:
+00266                                 ++ _IndexInLayer1;
+00267                                 if (_IndexInLayer1 == _Layer1.size())
+00268                                 {
+00269                                         _CurrLayer = 2;
+00270                                         _Layer2.begin();
+00271                                 }
+00272                         break;
+00273                         case 2:
+00274                                 _Layer2.next();
+00275                         break;
+00276                 }
+00277         }
+00278         else
+00279         {               
+00280                 switch(_CurrLayer)
+00281                 {
+00282                 
+00283                         case 2:
+00284                                 _Layer2.next();
+00285                                 if (_Layer2.get() == NULL)
+00286                                 {
+00287                                         if (_Layer1.size() != 0)
+00288                                         {
+00289                                                 _CurrLayer = 1;
+00290                                                 _IndexInLayer1 = 0;
+00291                                         }
+00292                                         else
+00293                                         {
+00294                                                 _CurrLayer = 0;
+00295                                                 _Layer0.begin();
+00296                                         }
+00297                                 }
+00298 
+00299                         break;
+00300                         case 1:
+00301                                 ++ _IndexInLayer1;
+00302                                 if (_IndexInLayer1 == _Layer1.size())
+00303                                 {
+00304                                         _CurrLayer = 0;
+00305                                         _Layer0.begin();
+00306                                 }
+00307                         break;
+00308                         case 0:
+00309                                 _Layer0.next();
+00310                         break;
+00311                 }
+00312         }
+00313 }
+00314 
+00315 
+00316 
+00317 
+00318 
+00319 } // NL3D
+00320 
+00321 
+00322 #endif // NL_LAYERED_ORDERING_TABLE_H
+00323 
+00324 /* End of layered_ordering_table.h */
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1