CMS 3D CMS Logo

toa Class Reference

a simple class to write ints, floats and doubles in chars. More...

#include <Utilities/General/interface/ioutils.h>

List of all members.

Public Member Functions

template<typename T>
const char * operator() (const std::vector< T > &v) const
const char * operator() (const std::string &c) const
const char * operator() (const char *c) const
const char * operator() (const char c[], int n) const
const char * operator() (const double &c) const
const char * operator() (const float &c) const
const char * operator() (const int &c) const
const char * operator() (bool c) const
const char * operator() (const unsigned int &c) const
const char * operator() (const long &c) const
const char * operator() (const unsigned long &c) const
const char * operator() (const short int &c) const
const char * operator() (const unsigned short int &c) const
 toa ()
 ~toa ()

Private Member Functions

void operator= (const toa &)
std::ostringstream & oss () const
 toa (const toa &)

Static Private Member Functions

static std::string & localS ()

Private Attributes

std::ostringstream oss_


Detailed Description

a simple class to write ints, floats and doubles in chars.

Usage as in: string mystring; ... ; mystring += toa()(4.);

Definition at line 94 of file ioutils.h.


Constructor & Destructor Documentation

toa::toa (  )  [inline]

Definition at line 98 of file ioutils.h.

00098 {}

toa::~toa (  ) 

Definition at line 31 of file ioutils.cc.

00032           {

toa::toa ( const toa  )  [inline, private]

Definition at line 129 of file ioutils.h.

00129 {}


Member Function Documentation

std::string & toa::localS (  )  [static, private]

Definition at line 35 of file ioutils.cc.

Referenced by operator()().

00036                         {
00037   static boost::thread_specific_ptr<std::string> local_s;
00038   if (!local_s.get()) local_s.reset(new std::string);
00039   return *local_s;

template<typename T>
const char* toa::operator() ( const std::vector< T > &  v  )  const [inline]

Definition at line 115 of file ioutils.h.

References edmNew::copy(), localS(), and oss().

00115                                                         { 
00116     std::ostream_iterator<T > oi(oss()," ");
00117     std::copy(v.begin(),v.end(),oi);
00118     localS() = oss().str();
00119     return localS().c_str();
00120   }

const char* toa::operator() ( const std::string &  c  )  const [inline]

Definition at line 113 of file ioutils.h.

00113 { return c.c_str();}

const char* toa::operator() ( const char *  c  )  const [inline]

Definition at line 112 of file ioutils.h.

00112 { return c;}

const char * toa::operator() ( const char  c[],
int  n 
) const

Definition at line 69 of file ioutils.cc.

References localS().

00070                                                           {
00071   localS().assign(c,n);
00072   return localS().c_str();

const char * toa::operator() ( const double &  c  )  const

Definition at line 60 of file ioutils.cc.

References lat::ends(), localS(), and oss().

00061                                                    {
00062   oss() << c;
00063 #ifdef CMS_CHAR_STREAM
00064   oss() << ends;
00065 #endif
00066   localS() = oss().str();
00067   return localS().c_str();

const char* toa::operator() ( const float &  c  )  const [inline]

Definition at line 109 of file ioutils.h.

References operator()().

00109 { return operator()(double(c));}

const char * toa::operator() ( const int c  )  const

Definition at line 41 of file ioutils.cc.

References lat::ends(), localS(), and oss().

00042                                                 {
00043   oss() << c;
00044 #ifdef CMS_CHAR_STREAM
00045   oss() << ends;
00046 #endif
00047   localS() = oss().str();
00048   return localS().c_str();

const char * toa::operator() ( bool  c  )  const

Definition at line 50 of file ioutils.cc.

References lat::ends(), localS(), and oss().

00051                                            {
00052   oss() << std::setiosflags(std::ios::boolalpha) << c;
00053 #ifdef CMS_CHAR_STREAM
00054   oss() << ends;
00055 #endif
00056   localS() = oss().str();
00057   return localS().c_str();

const char* toa::operator() ( const unsigned int c  )  const [inline]

Definition at line 106 of file ioutils.h.

References operator()().

00106 { return operator()(int(c));}

const char* toa::operator() ( const long &  c  )  const [inline]

Definition at line 105 of file ioutils.h.

References operator()().

00105 { return operator()(int(c));}

const char* toa::operator() ( const unsigned long &  c  )  const [inline]

Definition at line 104 of file ioutils.h.

References operator()().

00104 { return operator()(int(c));}

const char* toa::operator() ( const short int c  )  const [inline]

Definition at line 103 of file ioutils.h.

References operator()().

00103 { return operator()(int(c));}

const char* toa::operator() ( const unsigned short int c  )  const [inline]

Definition at line 102 of file ioutils.h.

Referenced by operator()().

00102 { return operator()(int(c));}

void toa::operator= ( const toa  )  [inline, private]

Definition at line 130 of file ioutils.h.

00130 {}

std::ostringstream& toa::oss (  )  const [inline, private]

Definition at line 124 of file ioutils.h.

References oss_.

Referenced by operator()().

00124 { return oss_;}


Member Data Documentation

std::ostringstream toa::oss_ [mutable, private]

Definition at line 123 of file ioutils.h.

Referenced by oss().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:33:40 2009 for CMSSW by  doxygen 1.5.4