CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Attributes
lhef::CBInputStream Class Reference

#include <XMLUtils.h>

Inheritance diagram for lhef::CBInputStream:

Classes

class  Reader
 

Public Types

typedef Reader Stream_t
 

Public Member Functions

 CBInputStream (Reader &in)
 
XMLFilePos curPos () const override
 
const XMLCh * getContentType () const override
 
XMLSize_t readBytes (XMLByte *const buf, const XMLSize_t size) override
 
 ~CBInputStream () override
 

Private Attributes

std::string buffer
 
unsigned int pos
 
Readerreader
 

Detailed Description

Definition at line 120 of file XMLUtils.h.

Member Typedef Documentation

◆ Stream_t

Definition at line 128 of file XMLUtils.h.

Constructor & Destructor Documentation

◆ CBInputStream()

lhef::CBInputStream::CBInputStream ( Reader in)

Definition at line 108 of file XMLUtils.cc.

108 : reader(reader) {}

◆ ~CBInputStream()

lhef::CBInputStream::~CBInputStream ( )
override

Definition at line 110 of file XMLUtils.cc.

110 {}

Member Function Documentation

◆ curPos()

XMLFilePos lhef::CBInputStream::curPos ( ) const
inlineoverride

Definition at line 133 of file XMLUtils.h.

References pos.

133 { return pos; }
unsigned int pos
Definition: XMLUtils.h:142

◆ getContentType()

const XMLCh* lhef::CBInputStream::getContentType ( ) const
inlineoverride

Definition at line 137 of file XMLUtils.h.

137 { return nullptr; }

◆ readBytes()

XMLSize_t lhef::CBInputStream::readBytes ( XMLByte *const  buf,
const XMLSize_t  size 
)
override

Definition at line 112 of file XMLUtils.cc.

References visDQMUpload::buf, buffer, lhef::CBInputStream::Reader::data(), fileinputsource_cfi::read, reader, and findQualityFiles::size.

112  {
113  char *rawBuf = reinterpret_cast<char *>(buf);
114  unsigned int bytes = size * sizeof(XMLByte);
115  unsigned int read = 0;
116 
117  while (read < bytes) {
118  if (buffer.empty()) {
119  buffer = reader.data();
120  if (buffer.empty())
121  break;
122  }
123 
124  unsigned int len = buffer.length();
125  unsigned int rem = bytes - read;
126  if (rem < len) {
127  std::memcpy(rawBuf + read, buffer.c_str(), rem);
128  buffer.erase(0, rem);
129  read += rem;
130  break;
131  }
132 
133  std::memcpy(rawBuf + read, buffer.c_str(), len);
134  buffer.clear();
135  read += len;
136  }
137 
138  read /= sizeof(XMLByte);
139  pos += read;
140 
141  return read;
142  }
size
Write out results.
std::string buffer
Definition: XMLUtils.h:141
virtual const std::string & data()=0

Member Data Documentation

◆ buffer

std::string lhef::CBInputStream::buffer
private

Definition at line 141 of file XMLUtils.h.

Referenced by readBytes().

◆ pos

unsigned int lhef::CBInputStream::pos
private

Definition at line 142 of file XMLUtils.h.

Referenced by curPos().

◆ reader

Reader& lhef::CBInputStream::reader
private

Definition at line 140 of file XMLUtils.h.

Referenced by readBytes().