COOPY » Guide  version 0.6.5
/home/paulfitz/cvs/coopy_scm/coopy/src/libcoopy_core/include/coopy/MeasureMan.h
Go to the documentation of this file.
00001 #ifndef COOPY_MEASUREMAN
00002 #define COOPY_MEASUREMAN
00003 
00004 #include <coopy/Measure.h>
00005 #include <coopy/CompareFlags.h>
00006 
00007 namespace coopy {
00008   namespace cmp {
00009     class MeasureMan;
00010   }
00011 }
00012 
00013 class coopy::cmp::MeasureMan {
00014 public:
00015   Measure& main;
00016   Measure& anorm;
00017   Measure& bnorm;
00018   MeasurePass& main_pass;
00019   MeasurePass& anorm_pass;
00020   MeasurePass& bnorm_pass;
00021   bool rowLike;
00022   CompareFlags flags;
00023   bool sampled;
00024 
00025   MeasureMan(Measure& main,
00026              MeasurePass& main_pass,
00027              Measure& anorm,
00028              MeasurePass& anorm_pass,
00029              Measure& bnorm,
00030              MeasurePass& bnorm_pass,
00031              bool rowLike,
00032              const CompareFlags& flags,
00033              bool sampled = false) : main(main), 
00034     anorm(anorm), 
00035     bnorm(bnorm),
00036     main_pass(main_pass),
00037     anorm_pass(anorm_pass),
00038     bnorm_pass(bnorm_pass),
00039     rowLike(rowLike),
00040     flags(flags),
00041     sampled(sampled)
00042   {
00043   }
00044              
00045 
00046   int cellLength(coopy::store::DataSheet& a) {
00047     if (rowLike) {
00048       return a.width();
00049     }
00050     return a.height();
00051   }
00052 
00053   std::string cell(coopy::store::DataSheet& a, int x, int y) {
00054     if (!cellExists(a,x,y)) {
00055       return "(no-cell)";
00056     }
00057     if (rowLike) {
00058       return a.cellString(x,y);
00059     }
00060     return a.cellString(y,x);
00061   }
00062 
00063   bool cellExists(coopy::store::DataSheet& a, int x, int y) {
00064     if (x<0||y<0) return false;
00065     if (rowLike) {
00066       return x<a.width()&&y<a.height();
00067     }
00068     return y<a.width()&&x<a.height();
00069   }
00070 
00071   void setup();
00072 
00073   void compare();
00074 
00075   void compareCore();
00076 
00077   void compare1(int ctrl);
00078 };
00079 
00080 
00081 
00082 #endif
00083 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines