samplecompressor.hpp

来自「Octane v1.01.20 The Open Compression To」· HPP 代码 · 共 94 行

HPP
94
字号
/// @file samplecompressor.hpp
/// Sample compressor
///
/// @remarks
/// This is a silly sample compressor which does nothing useful.
///
/// @note if you are interested in making a statistical style compressor,
/// then you should see the samplestatcompressor.
///
/// @author mouser
/// @date   2003.08.12
//---------------------------------------------------------------------------

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

//---------------------------------------------------------------------------
// application includes
#include "../compressor.hpp"
//---------------------------------------------------------------------------



//---------------------------------------------------------------------------
/// This Sample Statistical Compressor is a minimal example of how to
///  coordinate the 3 components of the statistical compressor framework,
///  a sample parser,modeler,and coder.
///
/// @ingroup Compressors
///
class SampleCompressor : public OctaneCompressor
{
protected:
	/// a byte which the sample compressor xors with incoming or outgoing bytes
	unsigned char Parameter_xorbyte;
public:
	/// constructor
	SampleCompressor(bool registerme=false);
	/// destructor
	~SampleCompressor() {;};
public:
	//---------------------------------------------------------------------------
	// OCTANE PUBLIC API - RTTI AND HELP FUNCTIONS - these are supported by all derived classes
	virtual std::string GetClassName() {return "Sample";}
	virtual std::string GetDescription() {return "Sample Compressor";}
	//---------------------------------------------------------------------------
public:
	//---------------------------------------------------------------------------
	// COMPRESSOR PUBLIC API - FACTORY FUNCTION / MAKE AN INSTANTIATION OF DERIVED COMPRESSOR
	virtual OctaneCompressor *MakeCompressorInstantiation() {return new SampleCompressor();};
	//---------------------------------------------------------------------------
public:
	//---------------------------------------------------------------------------
	// OCTANE PUBLIC API - AUXILIARY FUNCTIONS - these are supported by all derived classes
	virtual void ShowDebuggingInfo();
	virtual unsigned int GetMemoryUsed();
	virtual unsigned int GetDiskspaceUsed(bool fortempdecompressiononly);
	virtual std::string GetParametersInformation();
	virtual void SetDefaultParameters();
	virtual bool SetParameter(const std::string &parametername,const std::string &parametervalue);
	//---------------------------------------------------------------------------
public:
	//---------------------------------------------------------------------------
	// COMPRESSOR PUBLIC API - PREPARATION FOR COMPRESSING/DECOMPRESSING
	virtual bool IsReadyToCompress();
	//---------------------------------------------------------------------------
protected:
	//---------------------------------------------------------------------------
	// COMPRESSOR DERIVED COMPRESSION/DECOMPRESSING - implement these in derived classes
	virtual bool DoProtectedCompress(bitreader &from, bitwriter &to);
	virtual bool DoProtectedDecompress(bitreader &from, bitwriter &to);
	//---------------------------------------------------------------------------
protected:
	//---------------------------------------------------------------------------
	// OCTANE PROTECTED DERIVED STATE LOADING AND SAVING
	virtual bool DoProtectedCreateSymbolsAndModelsUsingStream(bitreader &from);
	virtual bool DoProtectedSaveState(bitwriter &to,bool fortempdecompressiononly);
	virtual bool DoProtectedLoadState(bitreader &from);
	//---------------------------------------------------------------------------
};
//---------------------------------------------------------------------------






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

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?