Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Plan
In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv7951
Modified Files:
Plan.cpp Plan.h
Log Message:
A same element (compiler, benchmark, options) can't be added more than once.
Index: Plan.h
===================================================================
RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Plan/Plan.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Plan.h 25 Jan 2007 20:57:02 -0000 1.2
--- Plan.h 25 Jan 2007 21:33:48 -0000 1.3
***************
*** 21,24 ****
--- 21,27 ----
int iteration;
+ virtual int isUnique(class Compiler *_compiler);
+ virtual int isUnique(std::string _options);
+ virtual int isUnique(class Benchmark *_benchmark);
public:
Plan();
Index: Plan.cpp
===================================================================
RCS file: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Plan/Plan.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Plan.cpp 25 Jan 2007 20:57:02 -0000 1.2
--- Plan.cpp 25 Jan 2007 21:33:48 -0000 1.3
***************
*** 22,27 ****
--- 22,75 ----
}
+ int Plan::isUnique(CBM::Compiler *_compiler)
+ {
+ int i;
+ int n = compilerNumber();
+ CBM::Compiler *C;
+
+ for(i=0; i<n; i++) {
+ C=getCompiler(i);
+ if (C->compilerName() == _compiler->compilerName()) {
+ return(0);
+ }
+ }
+ return(1);
+ }
+
+ int Plan::isUnique(std::string _options)
+ {
+ int i;
+ int n = compilerOptionNumber();
+ std::string O;
+
+ for(i=0; i<n; i++) {
+ O=getCompilerOptions(i);
+ if (O == _options)
+ return(0);
+ }
+ return(1);
+ }
+
+ int Plan::isUnique(CBM::Benchmark *_benchmark)
+ {
+ int i;
+ int n = benchmarkNumber();
+ CBM::Benchmark *B;
+
+ for(i=0; i<n; i++) {
+ B=getBenchmark(i);
+ if (B->Name() == _benchmark->Name())
+ return(0);
+ }
+
+ return(1);
+ }
+
int Plan::add(CBM::Compiler *_compiler)
{
+ if (!isUnique(_compiler)) {
+ return(0);
+ }
+
compilers.push_back(_compiler);
return(1);
***************
*** 30,33 ****
--- 78,85 ----
int Plan::add(std::string _compilerOptions)
{
+ if (!isUnique(_compilerOptions)) {
+ return(0);
+ }
+
compilerOptions.push_back(_compilerOptions);
return(1);
***************
*** 36,39 ****
--- 88,95 ----
int Plan::add(CBM::Benchmark *_benchmark)
{
+ if (!isUnique(_benchmark)) {
+ return(0);
+ }
+
benchmarks.push_back(_benchmark);
return(1);
|