VR-Forces 4.0.4 Class Documentation
include/vrfutil/munitRsrcIter.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 2004 MaK Technologies, Inc.
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: munitRsrcIter.h,v $ $Revision: 1.3 $ $State: Exp $
00007 Created: 5/13/04 MEM
00008 *******************************************************************************/
00009 
00012 
00018 
00019 #ifndef DtMunitionResourceIterator_H_
00020 #define DtMunitionResourceIterator_H_
00021 
00022 #include "vrfutil/munRsrc.h"
00023 #include "vrfutil/rsrcTypes.h"
00024 #include "vrfutil/recRscrIter.h"
00025 
00026 
00032 #include "vrfutil/vrfutilDefines.h"
00033 class DT_DLL_vrfutil DtMunitionResourceIterator : public DtRecursiveResourceIterator
00034 {
00035 private:
00037    DtMunitionResourceIterator();
00038 
00040    DtMunitionResourceIterator(
00041       const DtMunitionResourceIterator& orig);
00042 
00044    const DtMunitionResourceIterator& operator=(
00045       const DtMunitionResourceIterator& orig);
00046 
00047 public:
00048 
00050    DtMunitionResourceIterator(const DtList& list) :
00051       DtRecursiveResourceIterator(list) {};
00052 
00054    virtual ~DtMunitionResourceIterator() { };
00055 
00058    DtMunitionResource* first()
00059       {
00060          return firstMatch(DtRecursiveResourceIterator::first(), true,DtTrue); 
00061       }
00062 
00064    DtMunitionResource* current() const
00065       {
00066          return (DtMunitionResource*)DtRecursiveResourceIterator::current();
00067       }
00068 
00073    DtMunitionResource* next(bool move=true, bool recurse=false)
00074       {
00075          return firstMatch(DtRecursiveResourceIterator::next(move,recurse), move,recurse);
00076       }
00077 
00080    DtMunitionResource* firstMatch(DtSimResource* initial, 
00081       bool move = true, bool recurse=false)
00082       {
00083          DtSimResource* current = initial;
00084          DtSimResource* next = NULL;
00085 
00086          while (current)
00087          {
00088             if (current->type()==DtMunitionResourceType)
00089             {
00090                break;
00091             }
00092 
00093             DtSimResource* next = DtRecursiveResourceIterator::next(false,recurse);
00094 
00095             if (next == initial)       //we've checked 'em all, and we haven't found a match
00096             {
00097                current = NULL;
00098                break;
00099             }
00100 
00101             if (myChildIterator)
00102             {
00103                current=DtRecursiveResourceIterator::current();
00104             }
00105             else
00106             {
00107                current = DtRecursiveResourceIterator::next(move,recurse);
00108             }
00109          }
00110 
00111          return (DtMunitionResource*)current;
00112 
00113       }
00114 
00115 protected:
00116 
00117 };
00118 
00119 #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)