VR-Forces 4.6 Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
include
vrfobjcore
recursiveStateRepositoryIterator.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/attachmentManager.h
"
23
#include "
vrfobjcore/simObjectStateRepository.h
"
24
32
#include "
vrfobjcore/vrfobjcoreDefines.h
"
33
class
DT_DLL_vrfobjcore
DtRecursiveStateRepositoryIterator
:
public
DtIteratorBase
<DtSimObjectStateRepository>
34
{
35
36
private
:
38
DtRecursiveStateRepositoryIterator
();
39
41
DtRecursiveStateRepositoryIterator
(
42
const
DtRecursiveStateRepositoryIterator
& orig);
43
45
const
DtRecursiveStateRepositoryIterator
&
operator=
(
46
const
DtRecursiveStateRepositoryIterator
& orig);
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
{
62
DtIteratorBase<DtSimObjectStateRepository>::reset
();
63
}
64
65
return
DtIteratorBase<DtSimObjectStateRepository>::first
();
66
}
67
69
DtSimObjectStateRepository
*
current
()
const
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;
83
DtRecursiveStateRepositoryIterator
* wThis =
84
(
DtRecursiveStateRepositoryIterator
*)
this
;
85
wThis->
myChildIterator
= NULL;
86
}
87
}
88
89
if
(myCursor)
90
{
91
return
(
DtSimObjectStateRepository
*) myCursor->data();
92
}
93
95
return
NULL;
96
}
97
100
DtSimObjectStateRepository
*
next
()
101
{
102
DtSimObjectStateRepository
* currRep;
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
{
161
DtIteratorBase<DtSimObjectStateRepository>::reset
();
162
163
if
(myChildIterator)
164
{
165
delete
myChildIterator;
166
myChildIterator = NULL;
167
}
168
}
169
170
protected
:
171
DtRecursiveStateRepositoryIterator
*
myChildIterator
;
172
};
173
174
#endif
Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (
www.mak.com
)