LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::dataCodec Class Reference

This is the base class for data encoding and decoding. More...

#include <ltiDataCodec.h>

Inheritance diagram for lti::dataCodec:
Inheritance graph
[legend]
Collaboration diagram for lti::dataCodec:
Collaboration graph
[legend]

List of all members.

Classes

class  parameters
 The parameters for the class dataTransformer. More...

Public Member Functions

 dataCodec ()
 dataCodec (const parameters &par)
 dataCodec (const dataCodec &other)
virtual ~dataCodec ()
virtual const char * getTypeName () const
virtual bool encode (bufferElement *srcdest, int nsrc, int &ndest) const
virtual bool encode (buffer &srcdest) const
virtual bool encode (const bufferElement *src, int nsrc, bufferElement *dest, int &ndest) const
virtual bool encode (const buffer &src, buffer &dest) const
virtual bool decode (bufferElement *srcdest, int nsrc, int &ndest) const
virtual bool decode (buffer &srcdest) const
virtual bool decode (const bufferElement *src, int nsrc, bufferElement *dest, int &ndest) const
virtual bool decode (const buffer &src, buffer &dest) const
virtual bool apply (bufferElement *srcdest, int nsrc, int &ndest) const
virtual bool apply (buffer &srcdest) const
virtual bool apply (const bufferElement *src, int nsrc, bufferElement *dest, int &ndest) const
virtual bool apply (const buffer &src, buffer &dest) const
const parametersgetParameters () const
dataCodeccopy (const dataCodec &other)
dataCodecoperator= (const dataCodec &other)
virtual int estimateEncodedSize (int originalSize) const
virtual int estimateDecodedSize (int encodedSize) const

Protected Member Functions

virtual bool decodeImplementation (const buffer &src, buffer &dest, int nsrc, int &ndest) const =0
virtual bool encodeImplementation (const buffer &src, buffer &dest, int nsrc, int &ndest) const =0
virtual int getNewEncodingBufferSize (int originalSize) const
virtual int getNewDecodingBufferSize (int originalSize) const

Detailed Description

This is the base class for data encoding and decoding.

This an abstract class.


Constructor & Destructor Documentation

lti::dataCodec::dataCodec (  ) 

default constructor

lti::dataCodec::dataCodec ( const parameters par  ) 

Construct a functor using the given parameters.

lti::dataCodec::dataCodec ( const dataCodec other  ) 

copy constructor

Parameters:
other the object to be copied
virtual lti::dataCodec::~dataCodec (  )  [virtual]

destructor


Member Function Documentation

virtual bool lti::dataCodec::apply ( const buffer src,
buffer dest 
) const [virtual]

Operates on the given argument.

Parameters:
src vector with the input data
dest vector with the encoded or decoded data
Returns:
true if apply successful or false otherwise.

Implements lti::dataTransformer.

virtual bool lti::dataCodec::apply ( const bufferElement src,
int  nsrc,
bufferElement dest,
int &  ndest 
) const [virtual]

Operates on a copy of the given arguments.

Parameters:
src pointer to an array of bufferElement which contains the source data
nsrc the number of input bytes that should be transformed.
dest pointer to an array of bufferElement which will receive the transformed data. The array must be allocated by the caller
ndest When called, must contain the size of the output buffer. When the function returns, it contains the number of bytes actually used, or -1 if the buffer was too small.
Returns:
true if apply successful or false otherwise.

Implements lti::dataTransformer.

virtual bool lti::dataCodec::apply ( buffer srcdest  )  const [virtual]

Operates on the given argument.

If the data is encoded or decoded depends on the coding direction parameter.

Parameters:
srcdest vector with the input data which will also receive the transformed data.
Returns:
true if apply successful or false otherwise.

Implements lti::dataTransformer.

virtual bool lti::dataCodec::apply ( bufferElement srcdest,
int  nsrc,
int &  ndest 
) const [virtual]

Operates on the given arguments.

If the data is encoded or decoded depends on the coding direction parameter.

Parameters:
srcdest pointer to an array of bufferElement. The input array must be allocated and have enough space for input as well as output data.
nsrc the number of input bytes that should be transformed.
ndest the number of bytes of the transformed data. If the buffer was too small, it will contain -1 when the function returns.
Returns:
true if apply successful or false otherwise.

Implements lti::dataTransformer.

dataCodec& lti::dataCodec::copy ( const dataCodec other  ) 
virtual bool lti::dataCodec::decode ( const buffer src,
buffer dest 
) const [virtual]

Decodes data on copy.

virtual bool lti::dataCodec::decode ( const bufferElement src,
int  nsrc,
bufferElement dest,
int &  ndest 
) const [virtual]

Decodes data on copy.

virtual bool lti::dataCodec::decode ( buffer srcdest  )  const [virtual]

Decodes data in place.

virtual bool lti::dataCodec::decode ( bufferElement srcdest,
int  nsrc,
int &  ndest 
) const [virtual]

Decodes data in place.

virtual bool lti::dataCodec::decodeImplementation ( const buffer src,
buffer dest,
int  nsrc,
int &  ndest 
) const [protected, pure virtual]

Implementation of on-copy data decoder.

This method must not, under no circumstances, resize the destination vector.

Returns:
true if the decoding could be performed successfully.
Parameters:
src the source of the data.
dest the destination for the decoded data.
nsrc tells how many elements of the src vector must be decoded.
ndest tells how many elements of the destination vector can be used for the decoded data. When the method returns, this value tells how many elements were actually used, or notEnoughSpace if not enough elements were available.

Implemented in lti::ascii85Codec, lti::asciiHexCodec, lti::binarizationCodec, lti::combinedCodec, lti::identityCodec, and lti::runLengthCodec.

virtual bool lti::dataCodec::encode ( const buffer src,
buffer dest 
) const [virtual]

Encodes data on copy.

virtual bool lti::dataCodec::encode ( const bufferElement src,
int  nsrc,
bufferElement dest,
int &  ndest 
) const [virtual]

Encodes data on copy.

virtual bool lti::dataCodec::encode ( buffer srcdest  )  const [virtual]

Encodes data in place.

virtual bool lti::dataCodec::encode ( bufferElement srcdest,
int  nsrc,
int &  ndest 
) const [virtual]

Encodes data in place.

virtual bool lti::dataCodec::encodeImplementation ( const buffer src,
buffer dest,
int  nsrc,
int &  ndest 
) const [protected, pure virtual]

Implementation of on-copy data encoder.

This method must not, under no circumstances, resize the destination vector.

Returns:
true if the decoding could be performed successfully.
Parameters:
src the source of the data.
dest the destination for the encoded data.
nsrc tells how many elements of the src vector must be decoded.
ndest tells how many elements of the destination vector can be used for the decoded data. When the method returns, this value tells how many elements were actually used, or notEnoughSpace if not enough elements were available.

Implemented in lti::ascii85Codec, lti::asciiHexCodec, lti::binarizationCodec, lti::combinedCodec, lti::identityCodec, and lti::runLengthCodec.

virtual int lti::dataCodec::estimateDecodedSize ( int  encodedSize  )  const [virtual]

Computes the default buffer size for decoded data.

The source of the encoded data buffer is given as argument. The default is to return the given value.

Parameters:
encodedSize the size of the data buffer to be decoded
Returns:
the estimated size of the decoded data.

Reimplemented in lti::ascii85Codec, lti::asciiHexCodec, lti::binarizationCodec, lti::combinedCodec, and lti::runLengthCodec.

virtual int lti::dataCodec::estimateEncodedSize ( int  originalSize  )  const [virtual]

Computes the default buffer size for encoded data.

The source of the original data buffer is given as argument. The default is to return the given value.

Parameters:
originalSize the size of the data buffer to be encoded
Returns:
the estimated size of the encoded data.

Reimplemented in lti::ascii85Codec, lti::asciiHexCodec, lti::binarizationCodec, lti::combinedCodec, and lti::runLengthCodec.

virtual int lti::dataCodec::getNewDecodingBufferSize ( int  originalSize  )  const [protected, virtual]

Computes a new reasonable buffer size for encoded data if the given buffer size is too small.

The default is 2*orginialSize;

Parameters:
originalSize the size of the data buffer
Returns:
the recommended new size of the data buffer
virtual int lti::dataCodec::getNewEncodingBufferSize ( int  originalSize  )  const [protected, virtual]

Computes a new reasonable buffer size for encoded data if the given buffer size is too small.

The default is 2*orginialSize;

Parameters:
originalSize the size of the data buffer
Returns:
the recommended new size of the data buffer
const parameters& lti::dataCodec::getParameters (  )  const

returns used parameters

Reimplemented from lti::dataTransformer.

Reimplemented in lti::binarizationCodec.

virtual const char* lti::dataCodec::getTypeName (  )  const [virtual]

returns the name of this type ("dataCodec")

Reimplemented from lti::dataTransformer.

Reimplemented in lti::ascii85Codec, lti::asciiHexCodec, lti::binarizationCodec, lti::combinedCodec, lti::identityCodec, and lti::runLengthCodec.

dataCodec& lti::dataCodec::operator= ( const dataCodec other  ) 

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

Generated on Sat Apr 10 15:28:00 2010 for LTI-Lib by Doxygen 1.6.1