CMS 3D CMS Logo

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

virtual unsigned int curPos () const
 
virtual unsigned int readBytes (XMLByte *const buf, const unsigned int size)
 
 STLInputStream (std::istream &in)
 
virtual ~STLInputStream ()
 

Private Attributes

std::istream & in
 
unsigned int pos
 

Detailed Description

Definition at line 150 of file XMLUtils.h.

Member Typedef Documentation

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

Definition at line 152 of file XMLUtils.h.

Constructor & Destructor Documentation

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

Definition at line 171 of file XMLUtils.cc.

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

Definition at line 180 of file XMLUtils.cc.

181 {
182 }

Member Function Documentation

virtual unsigned int lhef::STLInputStream::curPos ( ) const
inlinevirtual

Definition at line 157 of file XMLUtils.h.

References pos.

157 { return pos; }
unsigned int pos
Definition: XMLUtils.h:164
unsigned int STLInputStream::readBytes ( XMLByte *const  buf,
const unsigned int  size 
)
virtual

Definition at line 184 of file XMLUtils.cc.

References i, in, pos, and SiPixelLorentzAngle_cfi::read.

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

Member Data Documentation

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

Definition at line 163 of file XMLUtils.h.

Referenced by readBytes().

unsigned int lhef::STLInputStream::pos
private