CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
toa Class Reference

#include <ioutils.h>

Public Member Functions

const char * operator() (const unsigned short int &c) const
 
const char * operator() (const short int &c) const
 
const char * operator() (const unsigned long &c) const
 
const char * operator() (const long &c) const
 
const char * operator() (const unsigned int &c) const
 
const char * operator() (bool c) const
 
const char * operator() (const int &c) const
 
const char * operator() (const float &c) const
 
const char * operator() (const double &c) const
 
const char * operator() (const char c[], int n) const
 
const char * operator() (const char *c) const
 
const char * operator() (const std::string &c) const
 
template<typename T >
const char * operator() (const std::vector< T > &v) 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.

98 {}
toa::~toa ( )

Definition at line 32 of file ioutils.cc.

32  {
33 }
toa::toa ( const toa )
inlineprivate

Definition at line 129 of file ioutils.h.

129 {}

Member Function Documentation

std::string & toa::localS ( )
staticprivate

Definition at line 36 of file ioutils.cc.

Referenced by operator()().

36  {
37  static boost::thread_specific_ptr<std::string> local_s;
38  if (!local_s.get()) local_s.reset(new std::string);
39  return *local_s;
40 }
const char* toa::operator() ( const unsigned short int &  c) const
inline

Definition at line 102 of file ioutils.h.

References operator()().

Referenced by operator()().

102 { return operator()(int(c));}
const char * operator()(const unsigned short int &c) const
Definition: ioutils.h:102
const char* toa::operator() ( const short int &  c) const
inline

Definition at line 103 of file ioutils.h.

References operator()().

Referenced by operator()().

103 { return operator()(int(c));}
const char * operator()(const unsigned short int &c) const
Definition: ioutils.h:102
const char* toa::operator() ( const unsigned long &  c) const
inline

Definition at line 104 of file ioutils.h.

References operator()().

Referenced by operator()().

104 { return operator()(int(c));}
const char * operator()(const unsigned short int &c) const
Definition: ioutils.h:102
const char* toa::operator() ( const long &  c) const
inline

Definition at line 105 of file ioutils.h.

References operator()().

Referenced by operator()().

105 { return operator()(int(c));}
const char * operator()(const unsigned short int &c) const
Definition: ioutils.h:102
const char* toa::operator() ( const unsigned int &  c) const
inline

Definition at line 106 of file ioutils.h.

References operator()().

Referenced by operator()().

106 { return operator()(int(c));}
const char * operator()(const unsigned short int &c) const
Definition: ioutils.h:102
const char * toa::operator() ( bool  c) const

Definition at line 51 of file ioutils.cc.

References trackerHits::c, localS(), and oss().

51  {
52  oss() << std::setiosflags(std::ios::boolalpha) << c;
53 #ifdef CMS_CHAR_STREAM
54  oss() << ends;
55 #endif
56  localS() = oss().str();
57  return localS().c_str();
58 }
static std::string & localS()
Definition: ioutils.cc:36
std::ostringstream & oss() const
Definition: ioutils.h:124
const char * toa::operator() ( const int &  c) const

Definition at line 42 of file ioutils.cc.

References trackerHits::c, localS(), and oss().

42  {
43  oss() << c;
44 #ifdef CMS_CHAR_STREAM
45  oss() << ends;
46 #endif
47  localS() = oss().str();
48  return localS().c_str();
49 }
static std::string & localS()
Definition: ioutils.cc:36
std::ostringstream & oss() const
Definition: ioutils.h:124
const char* toa::operator() ( const float &  c) const
inline

Definition at line 109 of file ioutils.h.

References operator()().

Referenced by operator()().

109 { return operator()(double(c));}
const char * operator()(const unsigned short int &c) const
Definition: ioutils.h:102
const char * toa::operator() ( const double &  c) const

Definition at line 61 of file ioutils.cc.

References trackerHits::c, localS(), and oss().

61  {
62  oss() << c;
63 #ifdef CMS_CHAR_STREAM
64  oss() << ends;
65 #endif
66  localS() = oss().str();
67  return localS().c_str();
68 }
static std::string & localS()
Definition: ioutils.cc:36
std::ostringstream & oss() const
Definition: ioutils.h:124
const char * toa::operator() ( const char  c[],
int  n 
) const

Definition at line 70 of file ioutils.cc.

References localS().

70  {
71  localS().assign(c,n);
72  return localS().c_str();
73 }
static std::string & localS()
Definition: ioutils.cc:36
const char* toa::operator() ( const char *  c) const
inline

Definition at line 112 of file ioutils.h.

References trackerHits::c.

112 { return c;}
const char* toa::operator() ( const std::string &  c) const
inline

Definition at line 113 of file ioutils.h.

113 { return c.c_str();}
template<typename T >
const char* toa::operator() ( const std::vector< T > &  v) const
inline

Definition at line 115 of file ioutils.h.

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

115  {
116  std::ostream_iterator<T > oi(oss()," ");
117  std::copy(v.begin(),v.end(),oi);
118  localS() = oss().str();
119  return localS().c_str();
120  }
static std::string & localS()
Definition: ioutils.cc:36
std::ostringstream & oss() const
Definition: ioutils.h:124
mathSSE::Vec4< T > v
void toa::operator= ( const toa )
inlineprivate

Definition at line 130 of file ioutils.h.

130 {}
std::ostringstream& toa::oss ( ) const
inlineprivate

Definition at line 124 of file ioutils.h.

References oss_.

Referenced by operator()().

124 { return oss_;}
std::ostringstream oss_
Definition: ioutils.h:123

Member Data Documentation

std::ostringstream toa::oss_
mutableprivate

Definition at line 123 of file ioutils.h.

Referenced by oss().