[Compbench-devel] CompBenchmarks++/libcompbenchmarks/Base Config.cpp, 1.10, 1.11 Config.h, 1.9, 1.1
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-05-28 18:08:07
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Base In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv16310 Modified Files: Config.cpp Config.h Log Message: Path(...) improved. Store/restore methods moved. Some improvements to obsolete usage through CBM::System. Index: Config.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Base/Config.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Config.h 1 May 2007 15:05:00 -0000 1.9 --- Config.h 28 May 2007 18:08:00 -0000 1.10 *************** *** 35,42 **** XMLNode *paths; ! /** Planned benchmarks' description. ! * \sa root */ ! XMLNode *plan; /** Boolean to check if configuration was changed. --- 35,43 ---- XMLNode *paths; ! /** Path to XML defaults. ! * ! * Holds nodes defining default values and parameters. */ ! XMLNode *defaults; /** Boolean to check if configuration was changed. *************** *** 89,96 **** Config(std::string _filename); ! /** Get XML plan node ! * Used by CBM::Plan to get status of planified benchmarks and contexts. ! * \return XML Node holding plan configuration and settings */ ! virtual XMLNode *planNode(void); /** Get package status. --- 90,97 ---- Config(std::string _filename); ! ! virtual void setDefaultPlan(std::string _filename); ! ! virtual std::string getDefaultPlan(void); /** Get package status. *************** *** 174,186 **** virtual std::string str(void); - /** Set a new Plan node. - * - * A plan holds all options to apply to selected compilers for a bunch of - * benchmarks. This method set these data. - * \param _plan New plan settings - * \sa CBM::Plan - */ - virtual void setPlan(XMLNode *_plan); - /** Detect changes. * --- 175,178 ---- Index: Config.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Base/Config.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Config.cpp 15 Feb 2007 18:55:46 -0000 1.10 --- Config.cpp 28 May 2007 18:08:00 -0000 1.11 *************** *** 12,15 **** --- 12,16 ---- #include <UI/UI.h> + #include <unistd.h> #include <config.h> *************** *** 50,69 **** } ! paths=root->getNode("paths"); ! if (!paths) { ! paths=root->addNode("paths"); changes=1; } ! plan=root->getNode("plan"); ! if (!plan) { ! plan=root->addNode("plan"); changes=1; } } ! CBM::XMLNode *Config::planNode(void) { ! return(plan); } --- 51,105 ---- } ! defaults=root->getNode("defaults"); ! if (!defaults) { ! defaults=root->addNode("defaults"); changes=1; } ! paths=defaults->getNode("paths"); ! if (!paths) { ! paths=defaults->addNode("paths"); changes=1; } } ! ! void Config::setDefaultPlan(std::string _filename) { ! XMLNode *dp = defaults->getNode("default-plan"); ! XMLAttribute *A; ! std::string absfn; ! ! absfn=cbmSystem->fileAbsoluteName(_filename); ! ! if (!dp) { ! dp=defaults->addNode("default-plan"); ! } ! ! A=dp->getAttribute("file"); ! if (!A) { ! A=new CBM::XMLAttribute("file", ! absfn); ! dp->add(A); ! } else { ! A->setValue(absfn); ! } ! changes=1; ! } ! ! std::string Config::getDefaultPlan(void) ! { ! XMLNode *dp = defaults->getNode("default-plan"); ! XMLAttribute *A; ! std::string r; ! ! if (!dp) ! return(""); ! ! A=dp->getAttribute("file"); ! if (!A) ! return(""); ! else ! return(A->Value()); } *************** *** 203,206 **** --- 239,243 ---- std::string pid; + pid=id[(int)dir]; for(i=0;i<n;i++) { *************** *** 347,355 **** std::string Config::Path(CBM::System::Dir dir) { ! XMLNode *N = pathNode(dir); CBM::XMLAttribute *A; ! A=N->getAttribute("value"); ! return(A->Value()); } --- 384,402 ---- std::string Config::Path(CBM::System::Dir dir) { ! XMLNode *N; CBM::XMLAttribute *A; + std::string r; + char *tmp; ! if (dir==CBM::System::CurrentWD) { ! tmp=get_current_dir_name(); ! r=tmp; ! free(tmp); ! return(r); ! } else { ! N=pathNode(dir); ! A=N->getAttribute("value"); ! return(A->Value()); ! } } *************** *** 359,374 **** } - void Config::setPlan(CBM::XMLNode *_plan) - { - if (plan!=_plan) { - if (plan) - delete(plan); - plan=_plan; - } - - changes=1; - root->add(_plan); - } - int Config::Changes(void) { --- 406,409 ---- |