Octane v1.01.20 - The Open Compression Toolkit for C++ http://octane.sourceforge.net/
Homepage | Main | Modules | Class Hierarchy | Compound List | File List | Compound Members | Related Pages

modelers/symbolweightvector.hpp

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 //---------------------------------------------------------------------------
00028 
00029 //---------------------------------------------------------------------------
00030 // recursive header protection
00031 #ifndef SymbolWeightVectorH
00032 #define SymbolWeightVectorH
00033 //---------------------------------------------------------------------------
00034 
00035 //---------------------------------------------------------------------------
00036 // application includes
00037 #include "../bitio/bitio.hpp"
00038 #include "../core/octaneclass.hpp"
00039 #include "../parsers/parser.hpp"
00040 // system includes
00041 using namespace std;
00042 #include <assert.h>
00043 //---------------------------------------------------------------------------
00044 
00045 
00046 
00047 //---------------------------------------------------------------------------
00050 #define TSymbolWeightVectorWeight float
00051 // typedef float TSymbolWeightVectorWeight;
00052 //---------------------------------------------------------------------------
00053 
00054 
00055 
00056 //---------------------------------------------------------------------------
00061 class SymbolWeightVector : public OctaneClass
00062 {
00063 protected:
00065         int symbolcount;
00067         vector<TSymbolWeightVectorWeight> weightvector;
00068 public:
00070         SymbolWeightVector() { symbolcount=0; }
00072         virtual ~SymbolWeightVector() { ; }
00073 public:
00074         //---------------------------------------------------------------------------
00075         // OCTANE PUBLIC API - RTTI FUNCTIONS - these are supported by all derived classes
00076         virtual std::string GetName() {return "SymbolWeightVector";}
00077         virtual std::string GetDescription() {return "Symbol Weight Vector";}
00078         virtual std::string GetHelpInformation() {return "";}
00079         //---------------------------------------------------------------------------
00080 public:
00081         //---------------------------------------------------------------------------
00082         // OCTANE PUBLIC API - AUXILIARY FUNCTIONS - these are supported by all derived classes
00083         virtual void ShowDebuggingInfo();
00084         virtual unsigned int GetMemoryUsed();
00085         virtual unsigned int GetDiskspaceUsed(bool fortempdecompressiononly);
00086         virtual bool SaveState(bitwriter &to,bool fortempdecompressiononly);
00087         virtual bool LoadState(bitreader &from);
00088         //---------------------------------------------------------------------------
00089 public:
00090         //---------------------------------------------------------------------------
00091         // SYMBOLWEIGHTVECTOR PUBLIC API - SYMBOL ACCESS
00093         void ResetWeights();
00095         void NormalizeToProbabilityDistribution();
00097         void SetSymbolCount(int newsize);
00099         int GetSymbolCount() {return symbolcount;};
00101         TSymbolWeightVectorWeight GetSymbolWeight(int index) {assert(index<symbolcount);return weightvector[index];};
00103         void SetSymbolWeight(int index,TSymbolWeightVectorWeight weight) {assert(index<symbolcount);weightvector[index]=weight;};
00105         void IncremementSymbolWeight(int index) {assert(index<symbolcount);weightvector[index]+=1;};
00109         bool CountSymbolFrequencies(OctaneParser *parserp, bitreader &from);
00112         void EnforceZeroCountFloor(TSymbolWeightVectorWeight symbolfloorval);
00113         //---------------------------------------------------------------------------
00114 };
00115 //---------------------------------------------------------------------------
00116 
00117 
00118 
00119 //---------------------------------------------------------------------------
00120 #endif
00121 //---------------------------------------------------------------------------
00122 
 
Generated on 20 May 2004 by doxygen 1.3.3