annotate Renderer/test_render/SceneGraphIterator.cpp @ 503:516d5c91d5b4 draft double-linked-task-list

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