VR-Forces 4.0.4 Class Documentation
include/vrfobjcore/keyedObjIter.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 2005 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: keyedObjIter.h,v $ $Revision: 1.8 $ $State: Exp $
00007 *******************************************************************************/
00008 
00011 
00020 
00021 #ifndef DtKeyedSimObjectIterator_H_
00022 #define DtKeyedSimObjectIterator_H_
00023 
00024 #include "vrfobjcore/vrfObjMgr.h"
00025 
00026 template<class T> class DtBaseSimObjectIterator : public DtIteratorBase<T>
00027 {
00028 private:
00029 
00030    //Default constructor.  Do not use.
00031    DtBaseSimObjectIterator();
00032 
00033    const DtBaseSimObjectIterator& operator=(
00034       const DtBaseSimObjectIterator& orig);
00035 
00036 public:
00037 
00041    DtBaseSimObjectIterator(const DtList& list, DtVrfObjectManager*
00042       simObjectManager) : DtIteratorBase<T>(list), mySimObjectManager(simObjectManager) {};
00043 
00045    DtBaseSimObjectIterator(const DtBaseSimObjectIterator& orig) :
00046       DtIteratorBase<T>(orig),
00047       mySimObjectManager(orig.mySimObjectManager) {};
00048 
00050    virtual ~DtBaseSimObjectIterator() {};
00051 
00052    T* first(bool move = true) 
00053    { 
00054       return dataToObject(this->internalFirst(move)); 
00055    };
00056    T* next(bool move = true) 
00057    { 
00058       return dataToObject(this->internalNext(move)); 
00059    };
00060    T* prev(bool move = true) 
00061    { 
00062       return dataToObject(this->internalPrev(move)); 
00063    };
00064    T* last(bool move = true) 
00065    { 
00066       return dataToObject(this->internalLast(move)); 
00067    };
00068    T* wrapNext(bool move = true) 
00069    { 
00070       return dataToObject(this->internalWrapNext(move)); 
00071    };
00072    T* wrapPrev(bool move = true) 
00073    { 
00074       return dataToObject(this->internalWrapPrev(move)); 
00075    };
00076 
00077 protected:
00078    T* dataToObject(void* data) const
00079       {
00080          DtEntityIdentifier* keyP = (DtEntityIdentifier*) data;
00081          if (keyP)
00082          {
00083             return (T*)mySimObjectManager->lookup(*keyP);
00084          }
00085 
00086          return NULL;
00087       }
00088 
00089 protected:
00090    DtVrfObjectManager* mySimObjectManager;
00091 };
00092 
00093 typedef DtBaseSimObjectIterator<DtVrfObject> DtKeyedSimObjectIterator;
00094 
00095 #endif

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)