lestes::msg::formatter< T > Class Template Reference

Object formatter. More...

#include <formatter.hh>

Inheritance diagram for lestes::msg::formatter< T >:

object List of all members.

Public Member Functions

virtual lstring format (const T &x)
 Formats object of type T.

Static Public Member Functions

static ptr< formatter< T > > instance (void)
 Returns the instance.

Protected Member Functions

 formatter (void)
 Creates the object.

Private Member Functions

 formatter (const formatter< T > &)
 Hides copy constructor.
formatter< T > & operator= (const formatter< T > &)
 Hides assignment operator.

Static Private Attributes

static srp< formatter< T > > singleton
 The singleton instance.

Detailed Description

template<typename T>
class lestes::msg::formatter< T >

Object formatter.

Represents formatter template performing conversion of objects to lstring representation. The default formatting is done through ostream and is thus suitable for basic types.

Parameters:
T The type of object to format.

Definition at line 52 of file formatter.hh.


Constructor & Destructor Documentation

template<typename T>
lestes::msg::formatter< T >::formatter ( void   )  [inline, protected]

Creates the object.

Creates the formatter.

Definition at line 50 of file as_id_formatter.cc.

00050                                    : object()
00051 {}

template<typename T>
lestes::msg::formatter< T >::formatter ( const formatter< T > &   )  [private]

Hides copy constructor.


Member Function Documentation

template<typename T>
lstring lestes::msg::formatter< T >::format ( const T &  x  )  [inline, virtual]

Formats object of type T.

Converts argument into readable form.

Parameters:
x The object to format.
Returns:
The text representation of the argument.

Definition at line 103 of file formatter.hh.

00104 {
00105         ::std::stringbuf sb;
00106         ::std::ostream os(&sb);
00107         os << x;
00108         return sb.str();
00109 }

template<typename T>
ptr< formatter< T > > lestes::msg::formatter< T >::instance ( void   )  [inline, static]

Returns the instance.

Returns the instance of the formatter.

Returns:
The singleton instance.

Definition at line 38 of file as_id_formatter.cc.

00039 {
00040         if (!the_instance)
00041                 the_instance = new formatter< ptr<as_id> >();
00042         return the_instance;
00043 }

template<typename T>
formatter<T>& lestes::msg::formatter< T >::operator= ( const formatter< T > &   )  [private]

Hides assignment operator.


Member Data Documentation

template<typename T>
srp< formatter< T > > lestes::msg::formatter< T >::singleton [inline, static, private]

The singleton instance.

The singleton instance of the formatter.

Definition at line 63 of file formatter.hh.


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