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

Member Typedef Documentation

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

Definition at line 157 of file XMLUtils.h.

Constructor & Destructor Documentation

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

Definition at line 172 of file XMLUtils.cc.

172  :
173  in(in)
174 {
175  if (in.bad())
176  throw cms::Exception("FileStreamError")
177  << "I/O stream bad in STLInputStream::STLInputStream()"
178  << std::endl;
179 }
std::istream & in
Definition: XMLUtils.h:170
lhef::STLInputStream::~STLInputStream ( )
override

Definition at line 181 of file XMLUtils.cc.

182 {
183 }

Member Function Documentation

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

Definition at line 162 of file XMLUtils.h.

References findQualityFiles::size.

162 { return pos; }
unsigned int pos
Definition: XMLUtils.h:171
const XMLCh* lhef::STLInputStream::getContentType ( ) const
inlineoverride

Definition at line 167 of file XMLUtils.h.

167 { return nullptr; }
XMLSize_t STLInputStream::readBytes ( XMLByte *const  buf,
const XMLSize_t  size 
)
override

Definition at line 185 of file XMLUtils.cc.

References mps_fire::i, in, and createfilelist::int.

187 {
188  char *rawBuf = reinterpret_cast<char*>(buf);
189  unsigned int bytes = size * sizeof(XMLByte);
190  in.read(rawBuf, bytes);
191  unsigned int readBytes = in.gcount();
192 
193  if (in.bad())
194  throw cms::Exception("FileStreamError")
195  << "I/O stream bad in STLInputStream::readBytes()"
196  << std::endl;
197 
198  unsigned int read = (unsigned int)(readBytes / sizeof(XMLByte));
199  unsigned int rest = (unsigned int)(readBytes % sizeof(XMLByte));
200  for(unsigned int i = 1; i <= rest; i++)
201  in.putback(rawBuf[readBytes - i]);
202 
203  pos += read;
204  return read;
205 }
size
Write out results.
XMLSize_t readBytes(XMLByte *const buf, const XMLSize_t size) override
Definition: XMLUtils.cc:185
std::istream & in
Definition: XMLUtils.h:170

Member Data Documentation

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

Definition at line 170 of file XMLUtils.h.

Referenced by readBytes().

unsigned int lhef::STLInputStream::pos
private