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

Member Typedef Documentation

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

Definition at line 151 of file XMLUtils.h.

Constructor & Destructor Documentation

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

Definition at line 170 of file XMLUtils.cc.

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

Definition at line 179 of file XMLUtils.cc.

180 {
181 }

Member Function Documentation

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

Definition at line 156 of file XMLUtils.h.

References pos.

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

Definition at line 183 of file XMLUtils.cc.

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

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

Member Data Documentation

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

Definition at line 162 of file XMLUtils.h.

Referenced by readBytes().

unsigned int lhef::STLInputStream::pos
private