Main Page Class Hierarchy Alphabetical List Compound List Examples |
00001 /*************************************************************************** 00002 copyright : (C) 2002-2005 by Stefano Barbato 00003 email : [email protected] 00004 00005 $Id: codec__base_8h-source.html,v 1.4 2006-03-12 12:28:31 tat Exp $ 00006 ***************************************************************************/ 00007 00008 /*************************************************************************** 00009 * * 00010 * This program is free software; you can redistribute it and/or modify * 00011 * it under the terms of the GNU General Public License as published by * 00012 * the Free Software Foundation; either version 2 of the License, or * 00013 * (at your option) any later version. * 00014 * * 00015 ***************************************************************************/ 00016 #ifndef _MIMETIC_CODEC_CODECBASE_H_ 00017 #define _MIMETIC_CODEC_CODECBASE_H_ 00018 namespace mimetic 00019 { 00020 00021 00022 struct buffered_codec_type_tag 00023 { 00024 }; 00025 00026 struct unbuffered_codec_type_tag 00027 { 00028 }; 00029 00030 00031 /// Codecs base class 00032 struct codec 00033 { 00034 typedef unsigned char char_type; 00035 virtual ~codec() {} 00036 virtual const char* name() const = 0; 00037 00038 /*! return the multiplier of the required (max) size of the output buffer 00039 * when encoding */ 00040 virtual double codeSizeMultiplier() const { return 1.0; } 00041 }; 00042 00043 00044 00045 /// Base class for unbuffered codecs 00046 struct unbuffered_codec: public codec 00047 { 00048 typedef unbuffered_codec_type_tag codec_type; 00049 template<typename OutIt> 00050 void flush(OutIt&) 00051 { 00052 } 00053 }; 00054 00055 /// Base class for buffered codecs 00056 struct buffered_codec: public codec 00057 { 00058 typedef buffered_codec_type_tag codec_type; 00059 }; 00060 00061 00062 } 00063 00064 #endif 00065