#include <XMLUtils.h>
Classes | |
class | Reader |
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 |
Reader & | reader |
Definition at line 126 of file XMLUtils.h.
typedef Reader lhef::CBInputStream::Stream_t |
Definition at line 134 of file XMLUtils.h.
lhef::CBInputStream::CBInputStream | ( | Reader & | in | ) |
Definition at line 128 of file XMLUtils.cc.
lhef::CBInputStream::~CBInputStream | ( | ) | [virtual] |
Definition at line 133 of file XMLUtils.cc.
{ }
virtual unsigned int lhef::CBInputStream::curPos | ( | ) | const [inline, virtual] |
unsigned int lhef::CBInputStream::readBytes | ( | XMLByte *const | buf, |
const unsigned int | size | ||
) | [virtual] |
Definition at line 137 of file XMLUtils.cc.
References buffer, lhef::CBInputStream::Reader::data(), pos, SiPixelLorentzAngle_cfi::read, and reader.
{ char *rawBuf = reinterpret_cast<char*>(buf); unsigned int bytes = size * sizeof(XMLByte); unsigned int read = 0; while(read < bytes) { if (buffer.empty()) { buffer = reader.data(); if (buffer.empty()) break; } unsigned int len = buffer.length(); unsigned int rem = bytes - read; if (rem < len) { std::memcpy(rawBuf + read, buffer.c_str(), rem); buffer.erase(0, rem); read += rem; break; } std::memcpy(rawBuf + read, buffer.c_str(), len); buffer.clear(); read += len; } read /= sizeof(XMLByte); pos += read; return read; }
std::string lhef::CBInputStream::buffer [private] |
Definition at line 146 of file XMLUtils.h.
Referenced by readBytes().
unsigned int lhef::CBInputStream::pos [private] |
Definition at line 147 of file XMLUtils.h.
Referenced by curPos(), and readBytes().
Reader& lhef::CBInputStream::reader [private] |
Definition at line 145 of file XMLUtils.h.
Referenced by readBytes().