VR-Forces 4.1 Class Documentation
recSRIter.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2001 MaK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: recSRIter.h,v $ $Revision: 1.7 $ $State: Exp $
7 *******************************************************************************/
8 
11 
17 
18 #ifndef DtRecursiveStateRepositoryIterator_H_
19 #define DtRecursiveStateRepositoryIterator_H_
20 
21 #include "vrfutil/iteratorBase.h"
22 #include "vrfobjcore/attachMgr.h"
23 #include "vrfobjcore/simObjSR.h"
24 
33 class DT_DLL_vrfobjcore DtRecursiveStateRepositoryIterator : public DtIteratorBase<DtSimObjectStateRepository>
34 {
35 
36 private:
39 
43 
47 
48 public:
50  DtRecursiveStateRepositoryIterator(const DtList& list) :
51  DtIteratorBase<DtSimObjectStateRepository>(list), myChildIterator(NULL) {};
52 
54  virtual ~DtRecursiveStateRepositoryIterator() { delete myChildIterator; };
55 
58  DtSimObjectStateRepository* first(bool reset = true)
59  {
60  if (reset)
61  {
63  }
64 
66  }
67 
70  {
71  if (myChildIterator)
72  {
73  DtSimObjectStateRepository* currRep = myChildIterator->current();
74 
75  if (currRep)
76  {
77  return currRep;
78  }
79 
80  else
81  {
82  delete myChildIterator;
85  wThis->myChildIterator = NULL;
86  }
87  }
88 
89  if (myCursor)
90  {
91  return (DtSimObjectStateRepository*) myCursor->data();
92  }
93 
95  return NULL;
96  }
97 
101  {
103 
105  if (myChildIterator)
106  {
107  currRep = myChildIterator->next();
108 
109  if (currRep)
110  {
111  return currRep;
112  }
113 
114  else
115  {
116  delete myChildIterator;
117  myChildIterator = NULL;
118  }
119  }
120 
121  else
122  {
123  DtSimObjectStateRepository* currRep = current();
124 
125  if (!currRep)
126  {
127  return NULL;
128  }
129 
130  if (currRep->attachments() && currRep->attachments()->numAttachments())
131  {
133  myChildIterator = new DtRecursiveStateRepositoryIterator(currRep->attachments()->elements());
134  if (myChildIterator)
135  {
136  return myChildIterator->first();
137  }
138 
139  else
140  {
142  return NULL;
143  }
144  }
145  }
146 
149  if (myCursor)
150  {
151  myCursor = myCursor->next();
152  }
153 
154  return current();
155  }
156 
159  void reset()
160  {
162 
163  if (myChildIterator)
164  {
165  delete myChildIterator;
166  myChildIterator = NULL;
167  }
168  }
169 
170 protected:
172 };
173 
174 #endif

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)