home *** CD-ROM | disk | FTP | other *** search
/ Hacks & Cracks / Hacks_and_Cracks.iso / hackersguides-&-software / hdsk41.zip / SOURCE.ZIP / CODEC.HPP next >
C/C++ Source or Header  |  1993-02-11  |  2KB  |  78 lines

  1. //--------------------------------------------------------//
  2. //                                                        //
  3. //   File:    CODEC.HPP                                   //
  4. //                                                        //
  5. //   Desc:    Base class definitions for data             //
  6. //            compressors and decompressors.              //
  7. //                                                        //
  8. //--------------------------------------------------------//
  9.  
  10. #ifndef _CODEC_HPP_
  11. #define _CODEC_HPP_
  12.  
  13. //.................codec types
  14.  
  15. enum tCodecTypes
  16. {
  17.    tNONE,
  18.    tRLE,
  19.    tPACKBITS,
  20.    tHUFFMAN,
  21.    tGROUP3,
  22.    tLZW,
  23.    tGIFLZW
  24. };
  25.  
  26. //.................status codes
  27.  
  28. enum xStatusCodes
  29. {
  30.    xOKAY        = 0x00,
  31.    xENDOFIMAGE  = 0x01,
  32.    xENDOFFILE   = 0x02,
  33.    xIOERROR     = 0x04,
  34.    xNOMEMORY    = 0x08,
  35.    xOUTOFSYNC   = 0x10,
  36.    xOVERFLOW    = 0x20,
  37.    xBADPARAM    = 0x40,
  38.    xUNSUPPORTED = 0x80
  39. };
  40.  
  41. //.................the encoder (compressor) base class
  42.  
  43. class Encoder
  44. {
  45.    public:
  46.       int type;      // encoder identifier
  47.  
  48.       Encoder( int encoder_type = tNONE )
  49.       { type = encoder_type; }
  50.       virtual ~Encoder( )
  51.       { }
  52.       virtual int encode( unsigned char *buf,
  53.                           int nbytes ) = 0;
  54.       virtual int init( void ) = 0;
  55.       virtual int term( void ) = 0;
  56.       virtual int status( void ) = 0;
  57. };
  58.  
  59. //.................the decoder (decompressor) base class
  60.  
  61. class Decoder
  62. {
  63.    public:
  64.       int   type;      // decoder type
  65.  
  66.       Decoder( int decoder_type = tNONE )
  67.       { type = decoder_type; }
  68.       virtual ~Decoder( )
  69.       { }
  70.       virtual int decode( unsigned char *buf,
  71.                           int nbytes ) = 0;
  72.       virtual int init( void ) = 0;
  73.       virtual int term( void ) = 0;
  74.       virtual int status( void ) = 0;
  75. };
  76.  
  77. #endif
  78.