/// @file mtfll.hpp
/// Move-to-front encoding
///
/// @remarks
/// Experimental move to front encoding using a linked list
///
/// @author loco
/// @date   2003.08.14
///
///

#ifndef mtfllH
#define mtfllH

#include "../compressor.hpp"

/// Experimental move to front encoding using a linked list instead of tracing the array.
/// Move to front moves the recently encoded byte to the front, so when it appears the next
/// time in the input stream it will be encoded with 00. If there comes another byte
/// to the front the previous byte will be moved back by 1 position, so it will be encoded
/// as 01.
///
/// @ingroup Compressors
///
class mtfllCompressor : public OctaneCompressor
{
public:
	mtfllCompressor(bool registerme = false);
	~mtfllCompressor() {;};

	virtual std::string GetClassName() {return "mtfll";}
	virtual std::string GetDescription() {return "Move To Front using linked list";}

	virtual OctaneCompressor *MakeCompressorInstantiation() {return new mtfllCompressor();};

protected:
	virtual bool DoProtectedCompress(bitreader &s, bitwriter &d);
	virtual bool DoProtectedDecompress(bitreader &s, bitwriter &d);
};

#endif
