Prototype progress

Published March 04, 2006
Advertisement
I've thrown together a simple meta-object. Very simple usage syntax so far, should be easy to get to grips with.

Example:

// create an entitygamedb::DataEntity ent;// assign an attributeent.set_attribute( gamedb::Attribute( "String", gamedb::Value( new gamedb::ValueData_String( "Hello" ) ) ) );// Attribute retreivalgamedb::Attribute attr_n = ent.get_attribute( "String" );gamedb::Value val = attr_n.get_value();gamedb::ValueData_String *vd = (gamedb::ValueData_String*)val.get_data();// printstd::cout << vd->get_data();


The ugliness of the setting/retreival will be hidden by helper functions, eventually. You will notice a couple of concepts in play here. First, we have Attribute. An attribute is a effectively a 'named' value. A Value is dynamically typed and must be assigned an instance of ValueData. I've made a few ValueData helpers, specifically those that handle the main native types (int, float, std::string, Function and DataEntity (eg: Entity).

This seems to work nicely (again, helpers will be nice), so tomorrow I can get on with the business of the 'database' side of it and get some simple queries running.
Previous Entry Weekend
Next Entry Progress Slow
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement