CMS 3D CMS Logo

lhef::CBInputStream Class Reference

#include <GeneratorInterface/LHEInterface/src/XMLUtils.h>

List of all members.

Public Types

typedef Reader Stream_t

Public Member Functions

 CBInputStream (Reader &in)
virtual unsigned int curPos () const
virtual unsigned int readBytes (XMLByte *const buf, const unsigned int size)
virtual ~CBInputStream ()

Private Attributes

std::string buffer
unsigned int pos
Readerreader

Classes

class  Reader


Detailed Description

Definition at line 125 of file XMLUtils.h.


Member Typedef Documentation

typedef Reader lhef::CBInputStream::Stream_t

Definition at line 133 of file XMLUtils.h.


Constructor & Destructor Documentation

lhef::CBInputStream::CBInputStream ( Reader in  ) 

Definition at line 126 of file XMLUtils.cc.

00126                                            :
00127         reader(reader)
00128 {
00129 }

lhef::CBInputStream::~CBInputStream (  )  [virtual]

Definition at line 131 of file XMLUtils.cc.

00132 {
00133 }


Member Function Documentation

virtual unsigned int lhef::CBInputStream::curPos (  )  const [inline, virtual]

Definition at line 138 of file XMLUtils.h.

References pos.

00138 { return pos; }

unsigned int lhef::CBInputStream::readBytes ( XMLByte *const   buf,
const unsigned int  size 
) [virtual]

Definition at line 135 of file XMLUtils.cc.

References buffer, lhef::CBInputStream::Reader::data(), len, pos, SiStripLorentzAngle_cfi::read, and reader.

00137 {
00138         char *rawBuf = reinterpret_cast<char*>(buf);
00139         unsigned int bytes = size * sizeof(XMLByte);
00140         unsigned int read = 0;
00141 
00142         while(read < bytes) {
00143                 if (buffer.empty()) {
00144                         buffer = reader.data();
00145                         if (buffer.empty())
00146                                 break;
00147                 }
00148 
00149                 unsigned int len = buffer.length();
00150                 unsigned int rem = bytes - read;
00151                 if (rem < len) {
00152                         std::memcpy(rawBuf + read, buffer.c_str(), rem);
00153                         buffer.erase(0, rem);
00154                         read += rem;
00155                         break;
00156                 }
00157 
00158                 std::memcpy(rawBuf + read, buffer.c_str(), len);
00159                 buffer.clear();
00160                 read += len;
00161         }
00162 
00163         read /= sizeof(XMLByte);
00164         pos += read;
00165 
00166         return read;
00167 }


Member Data Documentation

std::string lhef::CBInputStream::buffer [private]

Definition at line 145 of file XMLUtils.h.

Referenced by readBytes().

unsigned int lhef::CBInputStream::pos [private]

Definition at line 146 of file XMLUtils.h.

Referenced by curPos(), and readBytes().

Reader& lhef::CBInputStream::reader [private]

Definition at line 144 of file XMLUtils.h.

Referenced by readBytes().


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