9#ifndef __WVFUNCTORENCODER_H
10#define __WVFUNCTORENCODER_H
12#include "wvtypedencoder.h"
30template<
class IT,
class OT,
class FT>
42 WvFunctorEncoder(
const FType &f) : f(f) { }
43 virtual ~WvFunctorEncoder() { }
57 const IType *indata = inbuf.
get(count);
58 OType *outdata = outbuf.
alloc(count);
60 *(outdata++) = f(*(indata++));
size_t optgettable() const
Returns the optimal maximum number of elements in the buffer currently available for reading without ...
const T * get(size_t count)
Reads exactly the specified number of elements and returns a pointer to a storage location owned by t...
T * alloc(size_t count)
Allocates exactly the specified number of elements and returns a pointer to an UNINITIALIZED storage ...
size_t optallocable() const
Returns the optimal maximum number of elements that the buffer can currently accept for writing witho...
The generic buffer base type.
virtual bool _typedencode(IBuffer &inbuf, OBuffer &outbuf, bool flush)
Typed variant of _encode().
virtual bool _reset()
Template method implementation of reset().
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().