#include <layered_ordering_table.h>
Definition at line 43 of file layered_ordering_table.h.
Public Member Functions | |
void | begin (bool forwardTraversal=true) |
CLayeredOrderingTable () | |
ctor | |
T * | get () |
uint32 | getSize () |
void | init (uint32 nNbEntries) |
void | insert (uint layer, T *pValue, uint32 nEntryPos=0) |
void | next () |
void | reset (uint maxElementToInsert) |
Private Types | |
typedef std::vector< T * > | TTypePtVect |
Private Attributes | |
uint8 | _CurrLayer |
bool | _ForwardTraversal |
uint | _IndexInLayer1 |
COrderingTable< T > | _Layer0 |
TTypePtVect | _Layer1 |
COrderingTable< T > | _Layer2 |
|
Definition at line 106 of file layered_ordering_table.h. |
|
ctor
Definition at line 119 of file layered_ordering_table.h.
00119 : _IndexInLayer1(0), _CurrLayer(0), _ForwardTraversal(true){ 00120 00121 } |
|
Traversal operations LayeredOrderingTable<Face> ot; ot.begin(); while( ot.get() != NULL ) { Face *pF = ot.get(); // Do the treatment you want here ot.next(); }
Definition at line 171 of file layered_ordering_table.h. References NL3D::CLayeredOrderingTable< T >::_CurrLayer, NL3D::CLayeredOrderingTable< T >::_ForwardTraversal, NL3D::CLayeredOrderingTable< T >::_IndexInLayer1, NL3D::CLayeredOrderingTable< T >::_Layer0, NL3D::CLayeredOrderingTable< T >::_Layer1, and NL3D::CLayeredOrderingTable< T >::_Layer2.
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 } |
|
Get the currently selected element. Definition at line 220 of file layered_ordering_table.h. References NL3D::CLayeredOrderingTable< T >::_CurrLayer, NL3D::CLayeredOrderingTable< T >::_IndexInLayer1, NL3D::CLayeredOrderingTable< T >::_Layer0, NL3D::CLayeredOrderingTable< T >::_Layer1, NL3D::CLayeredOrderingTable< T >::_Layer2, and nlassert.
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 } |
|
Just return the number of entries in the ordering tables Definition at line 133 of file layered_ordering_table.h. References NL3D::CLayeredOrderingTable< T >::_Layer0, NL3D::CLayeredOrderingTable< T >::_Layer2, nlassert, and uint32.
|
|
Initialization. The ordering tables have a range from 0 to nNbEntries-1 Definition at line 125 of file layered_ordering_table.h. References NL3D::CLayeredOrderingTable< T >::_Layer0, NL3D::CLayeredOrderingTable< T >::_Layer2, and uint32.
|
|
Insert an element in the ordering table
Definition at line 150 of file layered_ordering_table.h. References NL3D::CLayeredOrderingTable< T >::_Layer0, NL3D::CLayeredOrderingTable< T >::_Layer1, NL3D::CLayeredOrderingTable< T >::_Layer2, nlassert, uint, and uint32.
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 } |
|
Move selection pointer to the next element Definition at line 242 of file layered_ordering_table.h. References NL3D::CLayeredOrderingTable< T >::_CurrLayer, NL3D::CLayeredOrderingTable< T >::_ForwardTraversal, NL3D::CLayeredOrderingTable< T >::_IndexInLayer1, NL3D::CLayeredOrderingTable< T >::_Layer0, NL3D::CLayeredOrderingTable< T >::_Layer1, and NL3D::CLayeredOrderingTable< T >::_Layer2.
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 } |
|
Put all the layers to empty
Definition at line 141 of file layered_ordering_table.h. References NL3D::CLayeredOrderingTable< T >::_Layer0, NL3D::CLayeredOrderingTable< T >::_Layer1, NL3D::CLayeredOrderingTable< T >::_Layer2, and uint.
|
|
Definition at line 111 of file layered_ordering_table.h. Referenced by NL3D::CLayeredOrderingTable< T >::begin(), NL3D::CLayeredOrderingTable< T >::get(), and NL3D::CLayeredOrderingTable< T >::next(). |
|
Definition at line 112 of file layered_ordering_table.h. Referenced by NL3D::CLayeredOrderingTable< T >::begin(), and NL3D::CLayeredOrderingTable< T >::next(). |
|
Definition at line 110 of file layered_ordering_table.h. Referenced by NL3D::CLayeredOrderingTable< T >::begin(), NL3D::CLayeredOrderingTable< T >::get(), and NL3D::CLayeredOrderingTable< T >::next(). |
|
|
|