October 28th, 2002, 10:48 am
If performance is your core objective, but you want database driven updates then you might considermachine written code.you can write code of the form:char *varname[N] ={"VolSmirk","thing", "other thing"};double val;fp = fopen("Parameters.h","w");for (i=0 ; i != N; i++){ GetDBVar (varname, & var); fprintf ("#define %s (%g)\n", varname,var);}fclose(fp);This means your code will be very fast on loading, requiring no database neogitiation, or indeed noconnection to the parameter table.The brackets in the fprintf are just my defensive programming.You might equally write fprintf ("const double %s (%g)\n", varname,var);If all your params are of know type. The #define has the "advantage" of not caring about types.The classy way to write this (bad pun) is to declare a Param class, and have an extra field in your database that knows about types.