COOPY » Guide  version 0.6.5
/home/paulfitz/cvs/coopy_scm/coopy/src/libcoopy_core/include/coopy/FloatSheet.h
Go to the documentation of this file.
00001 #ifndef COOPY_FLOATSHEET
00002 #define COOPY_FLOATSHEET
00003 
00004 #include <coopy/TypedSheet.h>
00005 #include <coopy/Stat.h>
00006 
00007 #include <stdio.h>
00008 
00009 namespace coopy {
00010   namespace store {
00011     class FloatSheet;
00012   }
00013 }
00014 
00015 class coopy::store::FloatSheet : public TypedSheet<float> {
00016 public:
00017   virtual std::string cellString(int x, int y) const {
00018     char buf[256];
00019     snprintf(buf,sizeof(buf),"%g",cell(x,y));
00020     return buf;
00021   }
00022 
00023   void rescale(float factor) {
00024     int w = width();
00025     int h = height();
00026     for (int x=0; x<w; x++) {
00027       for (int y=0; y<h; y++) {
00028         cell(x,y) *= factor;
00029       }
00030     }
00031   }
00032 
00033   Stat normalize(int first=-1, int last=-1, float sc=0.1, bool modify = true);
00034 
00035 };
00036 
00037 
00038 
00039 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines