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

Member Typedef Documentation

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

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

Definition at line 181 of file XMLUtils.cc.

182 {
183 }

Member Function Documentation

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

Definition at line 158 of file XMLUtils.h.

References pos.

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

Definition at line 185 of file XMLUtils.cc.

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

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 }
int i
Definition: DBlmapReader.cc:9
unsigned int pos
Definition: XMLUtils.h:165
virtual unsigned int readBytes(XMLByte *const buf, const unsigned int size)
Definition: XMLUtils.cc:185
std::istream & in
Definition: XMLUtils.h:164
tuple size
Write out results.

Member Data Documentation

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

Definition at line 164 of file XMLUtils.h.

Referenced by readBytes().

unsigned int lhef::STLInputStream::pos
private