CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

lhef::STLInputStream Class Reference

#include <XMLUtils.h>

List of all members.

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.

                                             :
        in(in)
{
        if (in.bad())
                throw cms::Exception("FileStreamError")
                        << "I/O stream bad in STLInputStream::STLInputStream()"
                        << std::endl;
}
lhef::STLInputStream::~STLInputStream ( ) [virtual]

Definition at line 180 of file XMLUtils.cc.

{
}

Member Function Documentation

virtual unsigned int lhef::STLInputStream::curPos ( ) const [inline, virtual]

Definition at line 157 of file XMLUtils.h.

References pos.

{ return pos; }
unsigned int lhef::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.

{
        char *rawBuf = reinterpret_cast<char*>(buf);
        unsigned int bytes = size * sizeof(XMLByte);
        in.read(rawBuf, bytes);
        unsigned int readBytes = in.gcount();

        if (in.bad())
                throw cms::Exception("FileStreamError")
                        << "I/O stream bad in STLInputStream::readBytes()"
                        << std::endl;

        unsigned int read = (unsigned int)(readBytes / sizeof(XMLByte));
        unsigned int rest = (unsigned int)(readBytes % sizeof(XMLByte));
        for(unsigned int i = 1; i <= rest; i++)
                in.putback(rawBuf[readBytes - i]);

        pos += read;
        return read;
}

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]

Definition at line 164 of file XMLUtils.h.

Referenced by curPos(), and readBytes().