7#ifndef __WVTYPEDENCODER_H
8#define __WVTYPEDENCODER_H
32template<
class IT,
class OT,
class S = WvEncoder>
38 typedef WvBufBase<IType> IBuffer;
39 typedef WvBufBase<OType> OBuffer;
40 typedef WvBufViewBase<IType> IBufferView;
41 typedef WvBufViewBase<OType> OBufferView;
47 bool encode(IBuffer &inbuf, OBuffer &outbuf,
bool flush =
false,
50 WvBufView inview(inbuf);
51 WvBufView outview(outbuf);
59 bool flush(IBuffer &inbuf, OBuffer &outbuf,
bool finish =
false)
61 WvBufView inview(inbuf);
62 WvBufView outview(outbuf);
63 return S::flush(inview, outview,
finish);
72 WvBufView outview(outbuf);
73 return S::finish(outview);
76 bool encode(WvBuf &inbuf, WvBuf &outbuf,
81 bool flush(WvBuf &inbuf, WvBuf &outbuf,
84 return S::flush(inbuf, outbuf,
finish);
88 return S::finish(outbuf);
107 virtual bool _encode(WvBuf &inbuf, WvBuf &outbuf,
110 IBufferView inview(inbuf);
111 OBufferView outview(outbuf);
118 OBufferView outview(outbuf);
129template<
class IT,
class S>
134 typedef unsigned char OType;
135 typedef WvBufBase<IType> IBuffer;
136 typedef WvBufBase<OType> OBuffer;
137 typedef WvBufViewBase<IType> IBufferView;
138 typedef WvBufViewBase<OType> OBufferView;
147 WvBufView inview(inbuf);
157 WvBufView inview(inbuf);
158 return S::flush(inview, outbuf,
finish);
161 bool encode(WvBuf &inbuf, WvBuf &outbuf,
166 bool flush(WvBuf &inbuf, WvBuf &outbuf,
169 return S::flush(inbuf, outbuf,
finish);
188 virtual bool _encode(WvBuf &inbuf, WvBuf &outbuf,
191 IBufferView inview(inbuf);
211 typedef unsigned char IType;
212 typedef unsigned char OType;
213 typedef WvBufBase<IType> IBuffer;
214 typedef WvBufBase<OType> OBuffer;
215 typedef WvBufViewBase<IType> IBufferView;
216 typedef WvBufViewBase<OType> OBufferView;
234 virtual bool _encode(WvBuf &inbuf, WvBuf &outbuf,
bool flush(IBuffer &inbuf, OBuffer &outbuf, bool finish=false)
Typed variant of flush().
virtual bool _finish(WvBuf &outbuf)
Wrapper implementation of _finish().
virtual bool _typedfinish(OBuffer &outbuf)
Typed variant of _finish().
bool encode(IBuffer &inbuf, OBuffer &outbuf, bool flush=false, bool finish=false)
Typed variant of encode().
virtual bool _encode(WvBuf &inbuf, WvBuf &outbuf, bool flush)
Wrapper implementation of _encode().
virtual bool _typedencode(IBuffer &inbuf, OBuffer &outbuf, bool flush)=0
Typed variant of _encode().
virtual bool _encode(WvBuf &inbuf, WvBuf &outbuf, bool flush)
Wrapper implementation of _encode().
virtual bool _finish(WvBuf &outbuf)
Wrapper implementation of _finish().
virtual bool _typedencode(IBuffer &inbuf, OBuffer &outbuf, bool flush)=0
Typed variant of _encode().
virtual bool _typedfinish(OBuffer &outbuf)
Typed variant of _finish().
This template facilitates the creation and use of encoders that manipulate typed buffers.
bool flush(IBuffer &inbuf, OBuffer &outbuf, bool finish=false)
Typed variant of flush().
virtual bool _encode(WvBuf &inbuf, WvBuf &outbuf, bool flush)
Wrapper implementation of _encode().
virtual bool _typedfinish(OBuffer &outbuf)
Typed variant of _finish().
virtual bool _typedencode(IBuffer &inbuf, OBuffer &outbuf, bool flush)=0
Typed variant of _encode().
bool encode(IBuffer &inbuf, OBuffer &outbuf, bool flush=false, bool finish=false)
Typed variant of encode().
virtual bool _finish(WvBuf &outbuf)
Wrapper implementation of _finish().
bool finish(OBuffer &outbuf)
Typed variant of finish().