[Compbench-devel] CompBenchmarks++/libcompbenchmarks/Plan Plan.cpp, 1.10, 1.11 Plan.h, 1.7, 1.8
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-05-30 17:04:13
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Plan In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv15023 Modified Files: Plan.cpp Plan.h Log Message: removeBatch() now returns status (integer). Major changes in XML I/O (e.g. each Plan holds its own filename and there's no need anymore to hold a CBM::System wide CBM::Plan object). Index: Plan.h =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Plan/Plan.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Plan.h 23 May 2007 15:29:46 -0000 1.7 --- Plan.h 30 May 2007 17:04:03 -0000 1.8 *************** *** 9,14 **** #define H_CBM_PLAN 1 ! #include <vector> ! #include <string> #ifdef SWIG --- 9,13 ---- #define H_CBM_PLAN 1 ! #include <Base/XML.h> #ifdef SWIG *************** *** 47,50 **** --- 46,50 ---- */ int iteration; + std::string filename; virtual CBM_PB *batchForIteration(int *it_in_plan); *************** *** 54,59 **** virtual CBM_PB *addBatch(CBM_PB *_ps); ! virtual void removeBatch(CBM_PB *_ps); ! virtual void removeBatch(std::string _id); virtual int batchNumber(void); --- 54,59 ---- virtual CBM_PB *addBatch(CBM_PB *_ps); ! virtual int removeBatch(CBM_PB *_ps); ! virtual int removeBatch(std::string _id); virtual int batchNumber(void); *************** *** 77,82 **** virtual void reset(void); ! virtual int store(void); ! virtual int restore(XMLNode *_planRootNode); virtual ~Plan(); --- 77,82 ---- virtual void reset(void); ! virtual int store(std::string _filename = ""); ! virtual int restore(std::string _filename); virtual ~Plan(); Index: Plan.cpp =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Plan/Plan.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Plan.cpp 23 May 2007 15:29:46 -0000 1.10 --- Plan.cpp 30 May 2007 17:04:03 -0000 1.11 *************** *** 16,19 **** --- 16,20 ---- #include <Base/Config.h> #include <Base/XML.h> + #include <Base/XMLReader.h> #include <Base/Result.h> *************** *** 75,79 **** } ! void Plan::removeBatch(PlanBatch *_ps) { int i; --- 76,80 ---- } ! int Plan::removeBatch(PlanBatch *_ps) { int i; *************** *** 81,100 **** CBM::PlanBatch *B = 0; std::vector<CBM::PlanBatch*> nplanBatch; ! for(i=0; i<n; i++) { B=getBatch(i); if (B!=_ps) nplanBatch.push_back(B); } planBatch=nplanBatch; ! stop(); } ! void Plan::removeBatch(std::string _id) { PlanBatch *c = getBatch(_id); if (c) ! removeBatch(c); } --- 82,109 ---- CBM::PlanBatch *B = 0; std::vector<CBM::PlanBatch*> nplanBatch; ! int r = 0; ! for(i=0; i<n; i++) { B=getBatch(i); if (B!=_ps) nplanBatch.push_back(B); + else + r=1; } + delete(_ps); planBatch=nplanBatch; ! if (r) ! stop(); ! return(r); } ! int Plan::removeBatch(std::string _id) { PlanBatch *c = getBatch(_id); if (c) ! return(removeBatch(c)); ! else ! return(0); } *************** *** 199,203 **** CBM::XMLNode *Plan::XML(void) { ! XMLNode *root = new CBM::XMLNode("plan"); XMLNode *batchs = new CBM::XMLNode("plan-batchs"); XMLNode *run = new CBM::XMLNode("run"); --- 208,212 ---- CBM::XMLNode *Plan::XML(void) { ! XMLNode *root = new CBM::XMLNode("libcompbenchmarks-plan"); XMLNode *batchs = new CBM::XMLNode("plan-batchs"); XMLNode *run = new CBM::XMLNode("run"); *************** *** 242,254 **** } ! int Plan::store(void) { ! XMLNode *root = XML(); ! cbmSystem->Config()->setPlan(root); ! return(cbmSystem->storeConfiguration()); } ! int Plan::restore(XMLNode *_planRootNode) { XMLNode *PBs; --- 251,267 ---- } ! int Plan::store(std::string _filename) { ! XMLNode *root = XML(); ! std::string data = root->str(); ! delete(root); ! if (_filename!="") ! filename=_filename; ! ! return(cbmSystem->fileWrite(filename, data)); } ! int Plan::restore(std::string _filename) { XMLNode *PBs; *************** *** 258,269 **** XMLAttribute *A; int i, n; PlanBatch *pb; ! if (!_planRootNode) ! return(0); reset(); ! PBs=_planRootNode->getNode("plan-batchs"); if (!PBs) return(0); --- 271,294 ---- XMLAttribute *A; int i, n; + XMLNode *planRootNode; PlanBatch *pb; ! XMLReader r; ! ! ! filename=_filename; ! ! planRootNode=r.read(filename); ! reset(); + if (!planRootNode) + return(0); ! if (planRootNode->Name()!="libcompbenchmarks-plan") { ! return(0); ! } ! ! PBs=planRootNode->getNode("plan-batchs"); if (!PBs) return(0); *************** *** 280,288 **** } ! R=_planRootNode->getNode("run"); if (!R) return(0); ! CI=R->getNode("current-iteration"); if (!CI) return(0); --- 305,313 ---- } ! R=planRootNode->getNode("run"); if (!R) return(0); ! CI=R->getNode("iteration"); if (!CI) return(0); |