NLPACS::CLocalRetriever::CIterator Class Reference

#include <local_retriever.h>


Detailed Description

An iterator to go through chains without bothering about ordered chains and those kind of f*cking stuffs
Author:
Benjamin Legros

Nevrax France

Date:
2003

Definition at line 190 of file local_retriever.h.

Public Member Functions

 CIterator (const CLocalRetriever *retriever, uint chain)
 Constructor.

bool end () const
 Test end.

CVector get3d () const
CVector2s operator * () const
CIteratoroperator++ ()

Protected Attributes

uint16 _Chain
 Chain Id.

sint16 _IndexInOChain
 The current vertex in ochain.

sint16 _MaxIndexInOChain
 Max index in ochain.

bool _OChainForward
 Is ochain forward?

uint16 _OChainIndex
 The current ochain in chain.

const CLocalRetriever_Retriever
 The referent retriever.


Private Member Functions

void setupIndex ()
 Setup index in ochain.


Friends

class CLocalRetriever


Constructor & Destructor Documentation

NLPACS::CLocalRetriever::CIterator::CIterator const CLocalRetriever retriever,
uint  chain
[inline]
 

Constructor.

Definition at line 215 of file local_retriever.h.

References _Chain, _OChainIndex, _Retriever, setupIndex(), and uint.

00216                 {
00217                         _Retriever = retriever;
00218                         _Chain = chain;
00219                         _OChainIndex = 0;
00220                         setupIndex();
00221                 }


Member Function Documentation

bool NLPACS::CLocalRetriever::CIterator::end void   )  const [inline]
 

Test end.

Definition at line 265 of file local_retriever.h.

References _Chain, _OChainIndex, _Retriever, NLPACS::CLocalRetriever::getChain(), and NLPACS::CChain::getSubChains().

Referenced by get3d(), and operator *().

00266                 {
00267                         return (_OChainIndex >= _Retriever->getChain(_Chain).getSubChains().size());
00268                 }

CVector NLPACS::CLocalRetriever::CIterator::get3d  )  const [inline]
 

Definition at line 257 of file local_retriever.h.

References _Chain, _IndexInOChain, _OChainIndex, _Retriever, end(), NLPACS::CLocalRetriever::getChain(), NLPACS::CLocalRetriever::getFullOrderedChain(), and NLPACS::CChain::getSubChain().

00258                 {
00259                         if (end())
00260                                 return CVector::Null;
00261                         return _Retriever->getFullOrderedChain(_Retriever->getChain(_Chain).getSubChain(_OChainIndex))[_IndexInOChain];
00262                 }

CVector2s NLPACS::CLocalRetriever::CIterator::operator *  )  const [inline]
 

Definition at line 250 of file local_retriever.h.

References _Chain, _IndexInOChain, _OChainIndex, _Retriever, end(), NLPACS::CLocalRetriever::getChain(), NLPACS::CLocalRetriever::getOrderedChain(), and NLPACS::CChain::getSubChain().

00251                 {
00252                         if (end())
00253                                 return CVector2s();
00254                         return _Retriever->getOrderedChain(_Retriever->getChain(_Chain).getSubChain(_OChainIndex))[_IndexInOChain];
00255                 }

CIterator& NLPACS::CLocalRetriever::CIterator::operator++  )  [inline]
 

Definition at line 223 of file local_retriever.h.

References _Chain, _IndexInOChain, _MaxIndexInOChain, _OChainForward, _OChainIndex, _Retriever, NLPACS::CLocalRetriever::getChain(), NLPACS::CChain::getSubChains(), setupIndex(), and sint.

00224                 {
00225                         const CChain    &chain = _Retriever->getChain(_Chain);
00226                         if (_OChainIndex >= chain.getSubChains().size())
00227                                 return *this;
00228 
00229                         if (_OChainForward)
00230                         {
00231                                 ++_IndexInOChain;
00232                                 if (((sint)_OChainIndex < (sint)chain.getSubChains().size()-1 && _IndexInOChain == _MaxIndexInOChain) || _IndexInOChain > _MaxIndexInOChain)
00233                                 {
00234                                         ++_OChainIndex;
00235                                         setupIndex();
00236                                 }
00237                         }
00238                         else
00239                         {
00240                                 --_IndexInOChain;
00241                                 if (((sint)_OChainIndex < (sint)chain.getSubChains().size()-1 && _IndexInOChain == 0) || _IndexInOChain < 0)
00242                                 {
00243                                         ++_OChainIndex;
00244                                         setupIndex();
00245                                 }
00246                         }
00247                         return *this;
00248                 }

void NLPACS::CLocalRetriever::CIterator::setupIndex  )  [inline, private]
 

Setup index in ochain.

Definition at line 272 of file local_retriever.h.

References _Chain, _IndexInOChain, _MaxIndexInOChain, _OChainForward, _OChainIndex, _Retriever, NLPACS::CLocalRetriever::getChain(), NLPACS::CLocalRetriever::getOrderedChain(), NLPACS::CChain::getSubChain(), NLPACS::CChain::getSubChains(), NLPACS::COrderedChain::getVertices(), and NLPACS::COrderedChain::isForward().

Referenced by CIterator(), and operator++().

00273                 {
00274                         const CChain                    &chain = _Retriever->getChain(_Chain);
00275                         if (_OChainIndex >= chain.getSubChains().size())
00276                                 return;
00277                         const COrderedChain             &ochain = _Retriever->getOrderedChain(chain.getSubChain(_OChainIndex));
00278                         _OChainForward = ochain.isForward();
00279                         _MaxIndexInOChain = ochain.getVertices().size()-1;
00280                         _IndexInOChain = (_OChainForward ? 0 : _MaxIndexInOChain);
00281                 }


Friends And Related Function Documentation

friend class CLocalRetriever [friend]
 

Definition at line 192 of file local_retriever.h.


Field Documentation

uint16 NLPACS::CLocalRetriever::CIterator::_Chain [protected]
 

Chain Id.

Definition at line 199 of file local_retriever.h.

Referenced by CIterator(), end(), get3d(), operator *(), operator++(), and setupIndex().

sint16 NLPACS::CLocalRetriever::CIterator::_IndexInOChain [protected]
 

The current vertex in ochain.

Definition at line 205 of file local_retriever.h.

Referenced by get3d(), operator *(), operator++(), and setupIndex().

sint16 NLPACS::CLocalRetriever::CIterator::_MaxIndexInOChain [protected]
 

Max index in ochain.

Definition at line 208 of file local_retriever.h.

Referenced by operator++(), and setupIndex().

bool NLPACS::CLocalRetriever::CIterator::_OChainForward [protected]
 

Is ochain forward?

Definition at line 211 of file local_retriever.h.

Referenced by operator++(), and setupIndex().

uint16 NLPACS::CLocalRetriever::CIterator::_OChainIndex [protected]
 

The current ochain in chain.

Definition at line 202 of file local_retriever.h.

Referenced by CIterator(), end(), get3d(), operator *(), operator++(), and setupIndex().

const CLocalRetriever* NLPACS::CLocalRetriever::CIterator::_Retriever [protected]
 

The referent retriever.

Definition at line 196 of file local_retriever.h.

Referenced by CIterator(), end(), get3d(), operator *(), operator++(), and setupIndex().


The documentation for this class was generated from the following file:
Generated on Tue Mar 16 14:16:34 2004 for NeL by doxygen 1.3.6