Mercurial > hg > Members > kono > Cerium
annotate TaskManager/Test/test_render/SceneGraphIterator.cpp @ 202:3f4c6a75d7e0
fix SceneGraphIterator::hasNext(), next()
add variable SceneGraph::sgid, flag_drawbale
author | gongo@gendarme.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Mon, 26 Jan 2009 16:58:35 +0900 |
parents | b257e27d995c |
children | 2a0fad8a817d |
rev | line source |
---|---|
201 | 1 #include "SceneGraphIterator.h" |
2 | |
3 void | |
4 SceneGraphIterator::set(SceneGraphPtr _list) | |
5 { | |
6 list = cur = _list; | |
7 } | |
8 | |
9 /** | |
10 * 次の SceneGraph があるか返す | |
11 * | |
12 * @retval 1 next がある | |
13 * @retval 0 next がない | |
14 */ | |
15 int | |
16 SceneGraphIterator::hasNext(void) | |
17 { | |
18 return (cur->next) ? 1 : 0; | |
19 } | |
20 | |
21 /** | |
22 * 指定した名前をもつ SceneGraph が以降存在するか | |
23 * | |
202
3f4c6a75d7e0
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
201
diff
changeset
|
24 * @param id 検索したい SceneGraph の ID |
201 | 25 * @retval 1 next がある |
26 * @retval 0 next がない | |
27 */ | |
28 int | |
202
3f4c6a75d7e0
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
201
diff
changeset
|
29 SceneGraphIterator::hasNext(int id) |
201 | 30 { |
31 SceneGraphPtr p; | |
32 | |
33 for (p = cur->next; p; p = p->next) { | |
202
3f4c6a75d7e0
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
201
diff
changeset
|
34 if (p->sgid == id) { |
201 | 35 return 1; |
36 } | |
37 } | |
38 | |
39 return 0; | |
40 } | |
41 | |
42 /** | |
43 * iterator を次に進める | |
44 */ | |
45 void | |
46 SceneGraphIterator::next(void) | |
47 { | |
48 cur = cur->next; | |
49 } | |
50 | |
51 /** | |
202
3f4c6a75d7e0
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
201
diff
changeset
|
52 * iterator を指定した ID を持つ SceneGraph まで進める |
201 | 53 * SceneGraph が無い場合、NULL にする |
202
3f4c6a75d7e0
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
201
diff
changeset
|
54 * |
3f4c6a75d7e0
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
201
diff
changeset
|
55 * @param id 検索したい SceneGraph の ID |
201 | 56 */ |
57 void | |
202
3f4c6a75d7e0
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
201
diff
changeset
|
58 SceneGraphIterator::next(int id) |
201 | 59 { |
60 SceneGraphPtr p; | |
61 | |
62 for (p = cur->next; p; p = p->next) { | |
202
3f4c6a75d7e0
fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
201
diff
changeset
|
63 if (p->sgid == id) { |
201 | 64 break; |
65 } | |
66 } | |
67 | |
68 cur = p; | |
69 } | |
70 | |
71 /** | |
72 * 参照中の SceneGraph を削除する | |
73 */ | |
74 void | |
75 SceneGraphIterator::remove(void) | |
76 { | |
77 cur->remove(); | |
78 } | |
79 | |
80 /** | |
81 * 参照中の SceneGraph を返す | |
82 * | |
83 * @return current SceneGraph | |
84 */ | |
85 SceneGraphPtr | |
86 SceneGraphIterator::get(void) | |
87 { | |
88 return cur; | |
89 } |