Main Page | Class List | File List | Class Members | File Members

datacache.hh

Go to the documentation of this file.
00001 /*
00002 The Evolving Tree
00003 Copyright (C) 2004 Jussi Pakkanen, Petri Turkulainen
00004 
00005 This program is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU General Public License
00007 as published by the Free Software Foundation; either version 2
00008 of the License, or (at your option) any later version.
00009 
00010 This program is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License
00016 along with this program; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 */
00019 
00020 
00028 #ifndef _datacache_hh_
00029 #define _datacache_hh_
00030 
00031 #include<string>
00032 #include<vector>
00033 #include<fstream>
00034 
00035 #include"etreedef.hh"
00036 
00038 
00043 class DataCache {
00044 
00045 private:
00046 
00047 protected:
00048 
00049   vector<double*> data; 
00050   int dim;              
00051 
00052   int *shuffler;     
00053   int currentVector; 
00054 
00055   void DeleteData();
00056   void CreateShuffler();
00057 
00058   vector<string> labels; 
00059 
00060 public:
00061 
00062   DataCache();
00063   ~DataCache();
00064   bool ReadFromDisk(string filename);
00065 
00066   // Accessor functions.
00067   const double* GetRandomVector();
00068   void Shuffle();
00069   void StartNewRound();
00070   const double* GetNextVector(bool &last);
00071   const double* GetVectorNumber(int number) const;
00072   int GetDimension() const { return dim; }
00073   int GetSize() const { return data.size(); }
00074   double *GetMinMax() const;
00075   string GetLabel(int n) const;
00076 };
00077 
00078 #endif
00079 
00080 
00081 
00082 
00083 
00084 
00085 
00086 
00087 
00088 
00089 
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 

Generated on Wed May 17 15:43:41 2006 for The Evolving Tree by  doxygen 1.4.1