| Revision 2 (by moose, 2006/06/13 10:15:01) |
|---|
#define BEGIN_NS(arg) namespace arg { #define END_NS } #define DYNAMO_NS BEGIN_NS(Dynamo) namespace Render { struct Capabilities { enum { VertexBufferObject = 1, // allegro_gl_extensions_GL.ARB_vertex_buffer_object VertexArray = 2, // allegro_gl_extensions_GL.EXT_vertex_array }; }; struct Info { const char *name; const char *desc; }; class Data; class List { public: void addObject(Object *obj, Data *dat) { object_vector.push_back(obj); data_map[obj] = dat; } Object *operator[](int i) { return object_vector[i]; } Object *object(int i) { return object_vector[i]; } Data *data(Object *obj) { return data_map[obj]; } unsigned int count() { return object_vector.size(); } bool init() { if(!self) new List(); if(self) return true; return false; } private: List() { self = this; } ~List() {} static std::vector<Object *> object_vector; static std::map<Object *, Data *> data_map; static List *self; }; List *List::self = 0; class Interface { public: Interface() : Interface(Interface *); virtual ~Interface(); virtual static Info getInfo() = 0; virtual Interface * private: std::list<Object *> objects; }; class VertexBufferObject : public Interface { public: private: }; class Factory : public Factory::Interface<Interface> { public: virtual Interface *factoryInstance(); virtual C *createInterface(); private: }; list<Interface *> ifacelist; namespace Detect { class Interface { public: virtual Render::Interface *detect() = 0; private: Detect() { log("begin"); } ~Detect() { log("end"); } }; class VertexBufferObject : public Interface { public: virtual bool detect(); private: }; } }