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 117 of file XMLUtils.h.

Member Typedef Documentation

◆ Stream_t

Definition at line 125 of file XMLUtils.h.

Constructor & Destructor Documentation

◆ CBInputStream()

lhef::CBInputStream::CBInputStream ( Reader in)

Definition at line 107 of file XMLUtils.cc.

107 : reader(reader) {}

◆ ~CBInputStream()

lhef::CBInputStream::~CBInputStream ( )
override

Definition at line 109 of file XMLUtils.cc.

109 {}

Member Function Documentation

◆ curPos()

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

Definition at line 130 of file XMLUtils.h.

130 { return pos; }

References pos.

◆ getContentType()

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

Definition at line 134 of file XMLUtils.h.

134 { return nullptr; }

◆ readBytes()

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

Definition at line 111 of file XMLUtils.cc.

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

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

Member Data Documentation

◆ buffer

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

Definition at line 138 of file XMLUtils.h.

Referenced by readBytes().

◆ pos

unsigned int lhef::CBInputStream::pos
private

Definition at line 139 of file XMLUtils.h.

Referenced by curPos().

◆ reader

Reader& lhef::CBInputStream::reader
private

Definition at line 137 of file XMLUtils.h.

Referenced by readBytes().

pos
Definition: PixelAliasList.h:18
lhef::CBInputStream::reader
Reader & reader
Definition: XMLUtils.h:137
lhef::CBInputStream::pos
unsigned int pos
Definition: XMLUtils.h:139
lhef::CBInputStream::Reader::data
virtual const std::string & data()=0
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
readEcalDQMStatus.read
read
Definition: readEcalDQMStatus.py:38
lhef::CBInputStream::buffer
std::string buffer
Definition: XMLUtils.h:138
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443