/// @file modeler_weightvectored.hpp
/// Derived modeler which uses a simple vector of probabilities
///
/// @remarks
/// This is a derived (but still abstract) modeler class which can serve
///  as the foundation for common simple statistic modelers which use a single
///  vector of weights.
///
/// @author mouser
/// @date   2003.07.29
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
// recursive header protection
#ifndef OctaneModelerWeightVectoredH
#define OctaneModelerWeightVectoredH
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
// application includes
#include "modeler.hpp"
// system includes
//---------------------------------------------------------------------------



//---------------------------------------------------------------------------
/// This is a derived modeler class which has some default functions for modelers which
///  work with a vector of weights as probabilities (very common).
///
/// @ingroup Modelers
///
class OctaneModeler_WeightVectored : public OctaneModeler
{
protected:
	/// vector based data structure for computing and storing frequencies
	SymbolWeightVector weightvector;
public:
	/// constructor
	OctaneModeler_WeightVectored() {;}
	/// destructor
	virtual ~OctaneModeler_WeightVectored() {;}
public:
	//---------------------------------------------------------------------------
	// OCTANE PUBLIC API - RTTI FUNCTIONS - these are supported by all derived classes
	virtual std::string GetName() {return "OctaneModelerWeightVectored";}
	virtual std::string GetDescription() {return "OctaneModeler using a WeightVector";}
	//---------------------------------------------------------------------------
public:
	//---------------------------------------------------------------------------
	// OCTANE PUBLIC API - AUXILIARY FUNCTIONS - these are supported by all derived classes
	virtual unsigned int GetMemoryUsed();
	virtual unsigned int GetDiskspaceUsed(bool fortempdecompressiononly);
	virtual bool SaveState(bitwriter &to,bool fortempdecompressiononly);
	virtual bool LoadState(bitreader &from);
	virtual void ShowDebuggingInfo();
	//---------------------------------------------------------------------------
public:
	//---------------------------------------------------------------------------
	// MODELLER PUBLIC API - STATE MAINTENANCE
	virtual bool IsReadyToModel() {if (weightvector.GetSymbolCount()>0) return true; else return false;};
	virtual void ResetState();
	//---------------------------------------------------------------------------
public:
	//---------------------------------------------------------------------------
	// MODELLER PUBLIC API - ACCESSOR FOR CODING
	virtual int GetSymbolCount() {return weightvector.GetSymbolCount();};
	virtual SymbolWeightVector* GetWeightVectorp() {return &weightvector;};
	virtual TSymbolWeightVectorWeight GetWeightVectorItem(int symbolnum) {return weightvector.GetSymbolWeight(symbolnum);};
	//---------------------------------------------------------------------------
};
//---------------------------------------------------------------------------



//---------------------------------------------------------------------------
#endif
//---------------------------------------------------------------------------

