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

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

Private Attributes

std::istream & in
 
unsigned int pos
 

Detailed Description

Definition at line 154 of file XMLUtils.h.

Member Typedef Documentation

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

Definition at line 156 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:169
lhef::STLInputStream::~STLInputStream ( )
virtual

Definition at line 181 of file XMLUtils.cc.

182 {
183 }

Member Function Documentation

virtual XMLFilePos lhef::STLInputStream::curPos ( ) const
inlineoverridevirtual

Definition at line 161 of file XMLUtils.h.

References findQualityFiles::size.

161 { return pos; }
unsigned int pos
Definition: XMLUtils.h:170
virtual const XMLCh* lhef::STLInputStream::getContentType ( ) const
inlineoverridevirtual

Definition at line 166 of file XMLUtils.h.

166 { return 0; }
XMLSize_t STLInputStream::readBytes ( XMLByte *const  buf,
const XMLSize_t  size 
)
overridevirtual

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.
virtual XMLSize_t readBytes(XMLByte *const buf, const XMLSize_t size) override
Definition: XMLUtils.cc:185
std::istream & in
Definition: XMLUtils.h:169

Member Data Documentation

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

Definition at line 169 of file XMLUtils.h.

Referenced by readBytes().

unsigned int lhef::STLInputStream::pos
private