00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef SH_CVRSTGFILE_H
00022 #define SH_CVRSTGFILE_H
00023
00024 #include <list>
00025 #include <string>
00026 #include <map>
00027
00028 #include "BinaryIO.h"
00029 #include "CvrStgObject.h"
00030 class Graph ;
00031 class Matching ;
00032 class MatchingAlgorithm ;
00033 class SampleValue ;
00034 class SampleValueAdjacencyList ;
00035
00046 class CvrStgFile : public CvrStgObject {
00047 public:
00052 static CvrStgFile *readFile (const std::string& fn) ;
00053
00054 class Property : private std::pair<std::string,std::string> {
00055 public:
00056 Property (std::string key, std::string value)
00057 : std::pair<std::string,std::string> (key, value) {} ;
00058
00059 std::string getKey (void) const
00060 { return first ; } ;
00061
00062 std::string getValue (void) const
00063 { return second ; } ;
00064 } ;
00065
00066 CvrStgFile (void) ;
00067 virtual ~CvrStgFile (void) ;
00068
00069 virtual void read (BinaryIO *io) ;
00070 virtual void write (void) ;
00071 void transform (const std::string& fn) ;
00072
00073 virtual std::list<Property> getProperties (void) const = 0 ;
00074
00086 virtual std::vector<SampleValueAdjacencyList*> calcSVAdjacencyLists (const std::vector<SampleValue*>& svs) const ;
00087
00095 virtual std::vector<MatchingAlgorithm*> getMatchingAlgorithms (Graph* g, Matching* m) const ;
00096
00100 const std::string& getName (void) const
00101 { return getBinIO()->getName() ; } ;
00102
00103 bool is_std (void) const
00104 { return getBinIO()->is_std() ; } ;
00105
00110 unsigned long getCapacity (void) const ;
00111
00115 std::string getHRCapacity (void) const ;
00116
00120 unsigned short getSamplesPerVertex (void) const
00121 { return SamplesPerVertex ; } ;
00125 UWORD32 getRadius (void) const
00126 { return Radius ; } ;
00130 EmbValue getEmbValueModulus (void) const
00131 { return EmbValueModulus ; } ;
00132
00142 virtual EmbValue getEmbeddedValue (const SamplePos pos) const ;
00143
00144 #ifdef DEBUG
00145
00148 virtual std::map<SampleKey,unsigned long>* getFrequencies (void) ;
00155 virtual void printFrequencies (const std::map<SampleKey,unsigned long>& freqs) ;
00156 #endif
00157
00158 protected:
00159 void setSamplesPerVertex (unsigned short spv)
00160 { SamplesPerVertex = spv ; } ;
00164 void setRadius (UWORD32 r) ;
00165 void setEmbValueModulus (EmbValue m)
00166 { EmbValueModulus = m ; } ;
00167
00168 void setBinIO (BinaryIO* io)
00169 { BinIO = io ; } ;
00170
00171 BinaryIO* getBinIO (void) const
00172 { return BinIO ; } ;
00173
00174 private:
00175 enum FILEFORMAT { UNKNOWN, BMP, WAV, AU, JPEG } ;
00176
00180 static FILEFORMAT guessff (BinaryIO *io) ;
00181
00182 BinaryIO* BinIO ;
00183
00184 unsigned short SamplesPerVertex ;
00185 UWORD32 Radius ;
00186 EmbValue EmbValueModulus ;
00187 } ;
00188
00189 #endif