Main Page Class Hierarchy Alphabetical List Compound List Examples

codec_base.h
1/***************************************************************************
2 copyright : (C) 2002-2008 by Stefano Barbato
3 email : stefano@codesink.org
4
5 $Id: codec_base.h,v 1.13 2008-10-07 11:06:26 tat Exp $
6 ***************************************************************************/
7#ifndef _MIMETIC_CODEC_CODECBASE_H_
8#define _MIMETIC_CODEC_CODECBASE_H_
9 namespace mimetic
10{
11
12
13 struct buffered_codec_type_tag
14{
15};
16
17 struct unbuffered_codec_type_tag
18{
19};
20
21
22/// Codecs base class
23 struct codec
24{
25 typedef unsigned char char_type;
26 virtual ~codec() {}
27 virtual const char* name() const = 0;
28
29 /*! return the multiplier of the required (max) size of the output buffer
30 * when encoding */
31 virtual double codeSizeMultiplier() const { return 1.0; }
32};
33
34
35
36/// Base class for unbuffered codecs
37 struct unbuffered_codec: public codec
38{
39 typedef unbuffered_codec_type_tag codec_type;
40 template<typename OutIt>
41 void flush(OutIt&)
42 {
43 }
44};
45
46/// Base class for buffered codecs
47 struct buffered_codec: public codec
48{
49 typedef buffered_codec_type_tag codec_type;
50};
51
52
53}
54
55#endif
56
mimetic
Definition body.h:18
mimetic::buffered_codec
Base class for buffered codecs.
Definition codec_base.h:48
mimetic::codec
Codecs base class.
Definition codec_base.h:24
mimetic::codec::codeSizeMultiplier
virtual double codeSizeMultiplier() const
Definition codec_base.h:31
mimetic::unbuffered_codec
Base class for unbuffered codecs.
Definition codec_base.h:38