lestes::lang::cplus::lex::encoder_factory Class Reference

Factory for encoders. More...

#include <encoder_factory.hh>

Inheritance diagram for lestes::lang::cplus::lex::encoder_factory:

Inheritance graph
[legend]
List of all members.

Public Types

typedef ptr< encoder >(*) encoder_create_type (void)
 Type of common encoder create methods.

Public Member Functions

void insert (const lstring &a_name, encoder_create_type a_create)
 Inserts new encoder into the database.
void remove (const lstring &a_name)
 Removes the encoder from the database.
ptr< encodersummon (const lstring &a_name) const
 Returns encoder for name.

Static Public Member Functions

template<typename Encoder>
static ptr< encoderencoder_create_adaptor (void)
 Adapts the return value of create methods.
static ptr< encoder_factoryinstance (void)
 Returns the only instance.

Protected Member Functions

 encoder_factory (void)
 Creates the object.
virtual void gc_mark (void)
 Marks the object.

Private Types

typedef ::lestes::std::map<
lstring, encoder_create_type
storage_type
 Type of storage for create functions.

Private Member Functions

 encoder_factory (const encoder_factory &)
 Hides copy constructor.
encoder_factoryoperator= (const encoder_factory &)
 Hides assignment operator.

Private Attributes

srp< storage_typestorage
 The storage for encoders.

Static Private Attributes

static ptr< encoder_factorysingleton
 The only object of the class.

Detailed Description

Factory for encoders.

Manages all encoder implementations.


Member Typedef Documentation

typedef ptr<encoder>(* ) lestes::lang::cplus::lex::encoder_factory::encoder_create_type(void)

Type of common encoder create methods.

typedef ::lestes::std::map< lstring, encoder_create_type > lestes::lang::cplus::lex::encoder_factory::storage_type [private]

Type of storage for create functions.


Constructor & Destructor Documentation

lestes::lang::cplus::lex::encoder_factory::encoder_factory ( void   )  [protected]

Creates the object.

Creates the object.

Postcondition:
summon() == NULL

lestes::lang::cplus::lex::encoder_factory::encoder_factory ( const encoder_factory  )  [private]

Hides copy constructor.


Member Function Documentation

template<typename T>
ptr< encoder > lestes::lang::cplus::lex::encoder_factory::encoder_create_adaptor ( void   )  [inline, static]

Adapts the return value of create methods.

Adapts return value of concrete encoder create() method to return base class.

Parameters:
Encoder The concrete encoder to adapt.
create The creator of the concrete encoder.

void lestes::lang::cplus::lex::encoder_factory::insert ( const lstring &  a_name,
encoder_create_type  a_create 
)

Inserts new encoder into the database.

Inserts new encoder into the database.

Precondition:
a_create != NULL

a_create() != NULL (checked only in summon())

Postcondition:
summon(a_name) == a_create()
Parameters:
a_name The name of the encoder to insert.
a_create The method tho create the encoder.

void lestes::lang::cplus::lex::encoder_factory::remove ( const lstring &  a_name  ) 

Removes the encoder from the database.

Removes encoder from the database.

Precondition:
a_name is in the database.
Parameters:
a_name The name of the encoder to remove.

ptr< encoder > lestes::lang::cplus::lex::encoder_factory::summon ( const lstring &  a_name  )  const

Returns encoder for name.

Returns new encoder for given name.

Precondition:
a_name was inserted into the factory
Postcondition:
returned != NULL or a_name was not inserted
Parameters:
a_name The name of the desired encoder.
Returns:
The new encoder or NULL if not found.

ptr< encoder_factory > lestes::lang::cplus::lex::encoder_factory::instance ( void   )  [static]

Returns the only instance.

Returns the only instance of the encoder_factory class.

Returns:
The singleton encoder_factory object.

void lestes::lang::cplus::lex::encoder_factory::gc_mark ( void   )  [protected, virtual]

Marks the object.

Marks the object.

Reimplemented from lestes::std::mem::keystone.

encoder_factory& lestes::lang::cplus::lex::encoder_factory::operator= ( const encoder_factory  )  [private]

Hides assignment operator.


Member Data Documentation

srp<storage_type> lestes::lang::cplus::lex::encoder_factory::storage [private]

The storage for encoders.

ptr< encoder_factory > lestes::lang::cplus::lex::encoder_factory::singleton [static, private]

The only object of the class.

The only instance of the class, holds all encoder registrations. Uses lazy instantiation.


The documentation for this class was generated from the following files:
Generated on Mon Feb 12 18:43:40 2007 for lestes by doxygen 1.5.1-20070107