WvStreams
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
WvFunctorEncoder< IT, OT, FT > Class Template Reference

Functor specifies the functor type which must have an operator() with a signature compatible with invocations of the form: const IT data = ...; OT result = func(data);. More...

#include <wvfunctorencoder.h>

Inheritance diagram for WvFunctorEncoder< IT, OT, FT >:
Inheritance graph
[legend]

Public Types

typedef FT FType
 
typedef IT IType
 
typedef OT OType
 
typedef WvBufBase< IType > IBuffer
 
typedef WvBufBase< OType > OBuffer
 
typedef WvBufViewBase< IType > IBufferView
 
typedef WvBufViewBase< OType > OBufferView
 

Public Member Functions

 WvFunctorEncoder (const FType &f)
 
bool encode (IBuffer &inbuf, OBuffer &outbuf, bool flush=false, bool finish=false)
 Typed variant of encode(). More...
 
bool encode (WvBuf &inbuf, WvBuf &outbuf, bool flush=false, bool finish=false)
 
bool flush (IBuffer &inbuf, OBuffer &outbuf, bool finish=false)
 Typed variant of flush(). More...
 
bool flush (WvBuf &inbuf, WvBuf &outbuf, bool finish=false)
 
bool finish (OBuffer &outbuf)
 Typed variant of finish(). More...
 
bool finish (WvBuf &outbuf)
 

Protected Member Functions

virtual bool _typedencode (IBuffer &inbuf, OBuffer &outbuf, bool flush)
 Typed variant of _encode(). More...
 
virtual bool _reset ()
 
virtual bool _typedfinish (OBuffer &outbuf)
 Typed variant of _finish(). More...
 
virtual bool _encode (WvBuf &inbuf, WvBuf &outbuf, bool flush)
 Wrapper implementation of _encode(). More...
 
virtual bool _finish (WvBuf &outbuf)
 Wrapper implementation of _finish(). More...
 

Protected Attributes

FT f
 

Detailed Description

template<class IT, class OT, class FT>
class WvFunctorEncoder< IT, OT, FT >

Functor specifies the functor type which must have an operator() with a signature compatible with invocations of the form: const IT data = ...; OT result = func(data);.

The best way to use this monster is to subclass with friendly names for the implementations that are needed. For maximum performance, define the functor as a struct that provides an operator() inline. This is extremely efficent since this class is templated, so there's room for lots of compiler optimization.

"IT" is the input buffer datatype "OT" is the output buffer datatype "FT" is the functor type

Definition at line 31 of file wvfunctorencoder.h.

Member Function Documentation

template<class IT , class OT , class FT >
virtual bool WvFunctorEncoder< IT, OT, FT >::_typedencode ( IBuffer inbuf,
OBuffer outbuf,
bool  flush 
)
inlineprotectedvirtual
bool WvTypedEncoder< IT, OT, S >::encode ( IBuffer inbuf,
OBuffer outbuf,
bool  flush = false,
bool  finish = false 
)
inlineinherited

Typed variant of encode().

See also
encode(WvBuf&, WvBuf&, bool, bool)

Definition at line 47 of file wvtypedencoder.h.

References WvTypedEncoder< IT, OT, S >::finish(), and WvTypedEncoder< IT, OT, S >::flush().

bool WvTypedEncoder< IT, OT, S >::flush ( IBuffer inbuf,
OBuffer outbuf,
bool  finish = false 
)
inlineinherited

Typed variant of flush().

See also
flush(WvBuf, WvBuf, bool)

Definition at line 59 of file wvtypedencoder.h.

References WvTypedEncoder< IT, OT, S >::finish().

Referenced by WvFunctorEncoder< IT, OT, FT >::_typedencode().

bool WvTypedEncoder< IT, OT, S >::finish ( OBuffer outbuf)
inlineinherited

Typed variant of finish().

See also
finish(WvBuf)

Definition at line 70 of file wvtypedencoder.h.

virtual bool WvTypedEncoder< IT, OT, S >::_typedfinish ( OBuffer outbuf)
inlineprotectedvirtualinherited

Typed variant of _finish().

See also
_finish(WvBuf&)

Definition at line 103 of file wvtypedencoder.h.

virtual bool WvTypedEncoder< IT, OT, S >::_encode ( WvBuf inbuf,
WvBuf outbuf,
bool  flush 
)
inlineprotectedvirtualinherited

Wrapper implementation of _encode().

Definition at line 107 of file wvtypedencoder.h.

References WvTypedEncoder< IT, OT, S >::_typedencode().

virtual bool WvTypedEncoder< IT, OT, S >::_finish ( WvBuf outbuf)
inlineprotectedvirtualinherited

Wrapper implementation of _finish().

Definition at line 116 of file wvtypedencoder.h.

References WvTypedEncoder< IT, OT, S >::_typedfinish().


The documentation for this class was generated from the following file: