CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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

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

Definition at line 147 of file XMLUtils.h.

Constructor & Destructor Documentation

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

Definition at line 144 of file XMLUtils.cc.

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
lhef::STLInputStream::~STLInputStream ( )
override

Definition at line 149 of file XMLUtils.cc.

149 {}

Member Function Documentation

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
const XMLCh* lhef::STLInputStream::getContentType ( ) const
inlineoverride

Definition at line 156 of file XMLUtils.h.

156 { return nullptr; }
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, pos, and SiPixelLorentzAngle_cfi::read.

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  }
unsigned int pos
Definition: XMLUtils.h:160
std::istream & in
Definition: XMLUtils.h:159
XMLSize_t readBytes(XMLByte *const buf, const XMLSize_t size) override
Definition: XMLUtils.cc:151
tuple size
Write out results.

Member Data Documentation

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

Definition at line 159 of file XMLUtils.h.

Referenced by readBytes().

unsigned int lhef::STLInputStream::pos
private

Definition at line 160 of file XMLUtils.h.

Referenced by curPos(), and readBytes().