Yate
TranslatorFactory Class Referenceabstract

An unidirectional data translator (codec) More...

#include <yatephone.h>

Inheritance diagram for TranslatorFactory:
GenObject

Public Member Functions

virtual ~TranslatorFactory ()
 
virtual void removed (const TranslatorFactory *factory)
 
virtual DataTranslatorcreate (const DataFormat &sFormat, const DataFormat &dFormat)=0
 
virtual const TranslatorCapsgetCapabilities () const =0
 
virtual bool converts (const DataFormat &sFormat, const DataFormat &dFormat) const
 
virtual unsigned int length () const
 
virtual bool intermediate (const FormatInfo *info) const
 
virtual const FormatInfointermediate () const
 
virtual const char * name () const
 
NamedCounterobjectsCounter () const
 
- Public Member Functions inherited from GenObject
 GenObject ()
 
virtual ~GenObject ()
 
virtual bool alive () const
 
virtual void destruct ()
 
virtual const StringtoString () const
 
virtual const StringtraceId () const
 
virtual void * getObject (const String &name) const
 
NamedCountergetObjCounter () const
 
NamedCountersetObjCounter (NamedCounter *counter)
 

Protected Member Functions

 TranslatorFactory (const char *name=0)
 

Additional Inherited Members

- Static Public Member Functions inherited from GenObject
static void * getObject (const String &name, const GenObject *obj)
 
static bool getObjCounting ()
 
static void setObjCounting (bool enable)
 
static NamedCountergetObjCounter (const String &name, bool create=true)
 
static ObjListgetObjCounters ()
 

Detailed Description

An unidirectional data translator (codec)

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

Constructor & Destructor Documentation

◆ TranslatorFactory()

TranslatorFactory ( const char * name = 0)
inlineexplicitprotected

Constructor - registers the factory in the global list

Parameters
nameStatic name of the factory, used for debugging

References Thread::getCurrentObjCounter(), and DataTranslator::install().

◆ ~TranslatorFactory()

virtual ~TranslatorFactory ( )
virtual

Destructor - unregisters from the global list

Member Function Documentation

◆ converts()

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

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

Parameters
sFormatName of the source format
dFormatName of the destination format
Returns
True if a conversion between formats is possible

◆ create()

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

Creates a translator given the source and destination format names

Parameters
sFormatName of the source format (data received from the consumer)
dFormatName of the destination format (data supplied to the source)
Returns
A pointer to the end of a DataTranslator chain or NULL

◆ getCapabilities()

virtual const TranslatorCaps * getCapabilities ( ) const
pure virtual

Get the capabilities table of this translator

Returns
A pointer to the first element of the capabilities table

◆ intermediate() [1/2]

virtual const FormatInfo * intermediate ( ) const
virtual

Get the intermediate format used by a translator chain

Returns
Pointer to intermediate format or NULL

◆ intermediate() [2/2]

virtual bool intermediate ( const FormatInfo * info) const
virtual

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

Parameters
infoFormat to check for
Returns
True if the format is used internally as intermediate

◆ length()

virtual unsigned int length ( ) const
virtual

Get the length of the translator chain built by this factory

Returns
How many translators will build the factory

◆ name()

virtual const char * name ( ) const
inlinevirtual

Get the name of this factory, useful for debugging purposes

Returns
Name of the factory as specified in the constructor

◆ objectsCounter()

NamedCounter * objectsCounter ( ) const
inline

Retrive the objects counter associated to this factory

Returns
Pointer to factory's objects counter or NULL

◆ removed()

virtual void removed ( const TranslatorFactory * factory)
virtual

Notification that another factory was removed from the list

Parameters
factoryPointer to the factory that just got removed

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