# class TranslatorFactory

An unidirectional data translator (codec). More...

Contains pure virtuals
Full name | `TelEngine::TranslatorFactory`
Definition | `#include <yatephone.h>`
Inherits | TelEngine::GenObject [public ]
List of all Methods

Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- virtual ~TranslatorFactory ()
- virtual void removed (const TranslatorFactory* factory)
- virtual DataTranslator* create (const DataFormat& sFormat, const DataFormat& dFormat)
- virtual const TranslatorCaps* getCapabilities () const
- virtual bool converts (const DataFormat& sFormat, const DataFormat& dFormat) const
- virtual unsigned int length () const
- virtual bool intermediate (const FormatInfo* info) const
- virtual const FormatInfo* intermediate () const
- virtual const char* name () const

#### Protected Methods

- inline explicit TranslatorFactory (const char* name = 0)

## Detailed Description

A factory for constructing data translators by format name conversion of data from one type to another

inline explicit TranslatorFactory (const char* name = 0)

### TranslatorFactory

[protected]

Constructor - registers the factory in the global list

Parameters:

name | Static name of the factory, used for debugging

~TranslatorFactory ()

### ~TranslatorFactory

[virtual]

Destructor - unregisters from the global list

void removed (const TranslatorFactory* factory)

### removed

[virtual]

Notification that another factory was removed from the list

Parameters:

factory | Pointer to the factory that just got removed

DataTranslator* create (const DataFormat& sFormat, const DataFormat& dFormat)

### create

[pure virtual]

Creates a translator given the source and destination format names

Parameters:

sFormat | Name of the source format (data received from the consumer)
dFormat | Name of the destination format (data supplied to the source)

Returns: A pointer to the end of a DataTranslator chain or NULL

const TranslatorCaps* getCapabilities ()

### getCapabilities

[const pure virtual]

Get the capabilities table of this translator

Returns: A pointer to the first element of the capabilities table

bool converts (const DataFormat& sFormat, const DataFormat& dFormat)

### converts

[const virtual]

Check if this factory can build a translator for given data formats

Parameters:

sFormat | Name of the source format
dFormat | Name of the destination format

Returns: True if a conversion between formats is possible

unsigned int length ()

### length

[const virtual]

Get the length of the translator chain built by this factory

Returns: How many translators will build the factory

bool intermediate (const FormatInfo* info)

### intermediate

[const virtual]

Check if a data format is used as intermediate in a translator chain

Parameters:

info | Format to check for

Returns: True if the format is used internally as intermediate

const FormatInfo* intermediate ()

### intermediate

[const virtual]

Get the intermediate format used by a translator chain

Returns: Pointer to intermediate format or NULL

const char* name ()

### name

[const virtual]

Get the name of this factory, useful for debugging purposes

Returns: Name of the factory as specified in the constructor

Generated by: paulc on bussard on Fri Dec 21 16:28:34 2012, using kdoc 2.0a54.