Main Page   Class Hierarchy   Alphabetical List   Compound List   Examples  
codec_base.h
00001 /***************************************************************************
00002     copyright            : (C) 2002-2008 by Stefano Barbato
00003     email                : stefano@codesink.org
00004 
00005     $Id: codec_base.h,v 1.13 2008-10-07 11:06:26 tat Exp $
00006  ***************************************************************************/
00007 #ifndef _MIMETIC_CODEC_CODECBASE_H_
00008 #define _MIMETIC_CODEC_CODECBASE_H_
00009 namespace mimetic
00010 {
00011 
00012 
00013 struct buffered_codec_type_tag
00014 {
00015 };
00016 
00017 struct unbuffered_codec_type_tag
00018 {
00019 };
00020 
00021 
00022 /// Codecs base class
00023 struct codec
00024 {
00025     typedef unsigned char char_type;
00026     virtual ~codec() {}
00027     virtual const char* name() const = 0;
00028 
00029     /*! return the multiplier of the required (max) size of the output buffer 
00030      * when encoding */
00031     virtual double codeSizeMultiplier() const { return 1.0; }
00032 };
00033 
00034 
00035 
00036 /// Base class for unbuffered codecs
00037 struct unbuffered_codec: public codec
00038 {
00039     typedef unbuffered_codec_type_tag codec_type;
00040     template<typename OutIt>
00041     void flush(OutIt&)
00042     {
00043     }
00044 };
00045 
00046 /// Base class for buffered codecs
00047 struct buffered_codec: public codec
00048 {
00049     typedef buffered_codec_type_tag codec_type;
00050 };
00051 
00052 
00053 }
00054 
00055 #endif
00056