view Renderer/Engine/SceneGraphArray.h @ 2069:26aa08c9a1de draft default tip

cuda example fix
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 12 Feb 2017 10:04:55 +0900
parents 786e800abfb4
children
line wrap: on
line source

#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) {}
    SceneGraphArray(void);

    /**
     * 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