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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
201
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
1 #include "SceneGraphIterator.h"
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
2
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
3 void
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
4 SceneGraphIterator::set(SceneGraphPtr _list)
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
5 {
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
6 list = cur = _list;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
7 }
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
8
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
9 /**
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
10 * 次の SceneGraph があるか返す
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
11 *
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
12 * @retval 1 next がある
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
13 * @retval 0 next がない
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
14 */
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
15 int
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
16 SceneGraphIterator::hasNext(void)
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
17 {
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
18 return (cur->next) ? 1 : 0;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
19 }
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
20
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
21 /**
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
22 * 指定した名前をもつ SceneGraph が以降存在するか
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
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
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
25 * @retval 1 next がある
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
26 * @retval 0 next がない
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
27 */
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
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
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
30 {
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
31 SceneGraphPtr p;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
32
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
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
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
35 return 1;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
36 }
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
37 }
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
38
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
39 return 0;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
40 }
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
41
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
42 /**
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
43 * iterator を次に進める
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
44 */
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
45 void
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
46 SceneGraphIterator::next(void)
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
47 {
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
48 cur = cur->next;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
49 }
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
50
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
51 /**
202
3f4c6a75d7e0 fix SceneGraphIterator::hasNext(), next()
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 201
diff changeset
52 * iterator を指定した ID を持つ SceneGraph まで進める
201
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
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
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
56 */
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
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
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
59 {
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
60 SceneGraphPtr p;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
61
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
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
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
64 break;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
65 }
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
66 }
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
67
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
68 cur = p;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
69 }
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
70
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
71 /**
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
72 * 参照中の SceneGraph を削除する
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
73 */
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
74 void
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
75 SceneGraphIterator::remove(void)
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
76 {
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
77 cur->remove();
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
78 }
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
79
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
80 /**
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
81 * 参照中の SceneGraph を返す
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
82 *
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
83 * @return current SceneGraph
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
84 */
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
85 SceneGraphPtr
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
86 SceneGraphIterator::get(void)
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
87 {
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
88 return cur;
b257e27d995c add SceneGraphIterator
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
89 }