diff include/Cerium/SceneGraphArray.h @ 0:04e28d8d3c6f

first commit
author Daiki KINJYO <e085722@ie.u-ryukyu.ac.jp>
date Mon, 08 Nov 2010 01:23:25 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/Cerium/SceneGraphArray.h	Mon Nov 08 01:23:25 2010 +0900
@@ -0,0 +1,43 @@
+#ifndef INCUDED_SCENE_GRAPH_ARRAY
+#define INCUDED_SCENE_GRAPH_ARRAY
+
+#include "SceneGraph.h"
+
+// 下ですぐ #undef してます
+#define MAX_SIZE 32
+
+class SceneGraphArray {
+public:
+    SceneGraph buf[MAX_SIZE];
+    int size;
+    int pad[3];
+
+    SceneGraphArray(void) : size(0) {}
+
+    /**
+     * array の初期化
+     */
+    void init(void) {
+	size = 0;
+    }
+
+    /**
+     * buf から SceneGraph buffer を返す
+     *
+     * @retval SceneGraph if size < MAX_SIZE
+     * @retval NULL if size >= MAX_SIZE
+     */
+    SceneGraphPtr getNext(void) {
+	if (size >= MAX_SIZE) {
+	    return NULL;
+	} else {
+	    return &buf[size++];
+	}
+    }
+};
+
+typedef SceneGraphArray *SceneGraphArrayPtr;
+
+#undef MAX_SIZE
+
+#endif