CMS 3D CMS Logo

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

#include <XMLUtils.h>

Inheritance diagram for lhef::STLInputStream:

Public Types

typedef std::istream Stream_t
 

Public Member Functions

XMLFilePos curPos () const override
 
const XMLCh * getContentType () const override
 
XMLSize_t readBytes (XMLByte *const buf, const XMLSize_t size) override
 
 STLInputStream (std::istream &in)
 
 ~STLInputStream () override
 

Private Attributes

std::istream & in
 
unsigned int pos
 

Detailed Description

Definition at line 145 of file XMLUtils.h.

Member Typedef Documentation

◆ Stream_t

typedef std::istream lhef::STLInputStream::Stream_t

Definition at line 147 of file XMLUtils.h.

Constructor & Destructor Documentation

◆ STLInputStream()

lhef::STLInputStream::STLInputStream ( std::istream &  in)

Definition at line 144 of file XMLUtils.cc.

References in.

144  : in(in) {
145  if (in.bad())
146  throw cms::Exception("FileStreamError") << "I/O stream bad in STLInputStream::STLInputStream()" << std::endl;
147  }
std::istream & in
Definition: XMLUtils.h:159

◆ ~STLInputStream()

lhef::STLInputStream::~STLInputStream ( )
override

Definition at line 149 of file XMLUtils.cc.

149 {}

Member Function Documentation

◆ curPos()

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

Definition at line 152 of file XMLUtils.h.

References pos.

152 { return pos; }
unsigned int pos
Definition: XMLUtils.h:160

◆ getContentType()

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

Definition at line 156 of file XMLUtils.h.

156 { return nullptr; }

◆ readBytes()

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

Definition at line 151 of file XMLUtils.cc.

References visDQMUpload::buf, mps_fire::i, in, createfilelist::int, fileinputsource_cfi::read, mergeAndRegister::rest, and findQualityFiles::size.

151  {
152  char *rawBuf = reinterpret_cast<char *>(buf);
153  unsigned int bytes = size * sizeof(XMLByte);
154  in.read(rawBuf, bytes);
155  unsigned int readBytes = in.gcount();
156 
157  if (in.bad())
158  throw cms::Exception("FileStreamError") << "I/O stream bad in STLInputStream::readBytes()" << std::endl;
159 
160  unsigned int read = (unsigned int)(readBytes / sizeof(XMLByte));
161  unsigned int rest = (unsigned int)(readBytes % sizeof(XMLByte));
162  for (unsigned int i = 1; i <= rest; i++)
163  in.putback(rawBuf[readBytes - i]);
164 
165  pos += read;
166  return read;
167  }
size
Write out results.
std::istream & in
Definition: XMLUtils.h:159
XMLSize_t readBytes(XMLByte *const buf, const XMLSize_t size) override
Definition: XMLUtils.cc:151

Member Data Documentation

◆ in

std::istream& lhef::STLInputStream::in
private

Definition at line 159 of file XMLUtils.h.

Referenced by readBytes(), and STLInputStream().

◆ pos

unsigned int lhef::STLInputStream::pos
private

Definition at line 160 of file XMLUtils.h.

Referenced by curPos().