PLearn 0.1
Public Member Functions | Protected Attributes
PLearn::pl_fdstream Class Reference

#include <pl_fdstream.h>

Inheritance diagram for PLearn::pl_fdstream:
Inheritance graph
[legend]
Collaboration diagram for PLearn::pl_fdstream:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 pl_fdstream ()
 pl_fdstream (int fd, int inbufsize=pl_dftbuflen, int outbufsize=pl_dftbuflen)
void init (int fd, int inbufsize=pl_dftbuflen, int outbufsize=pl_dftbuflen)
void attach (int fd)
 for compatibility with old non-standard stl fstream
 ~pl_fdstream ()

Protected Attributes

char * outbuffer

Detailed Description

Definition at line 91 of file pl_fdstream.h.


Constructor & Destructor Documentation

PLearn::pl_fdstream::pl_fdstream ( ) [inline]

Definition at line 98 of file pl_fdstream.h.

        :iostream(0), outbuffer(0)
    {}
PLearn::pl_fdstream::pl_fdstream ( int  fd,
int  inbufsize = pl_dftbuflen,
int  outbufsize = pl_dftbuflen 
) [inline]

Definition at line 102 of file pl_fdstream.h.

        :iostream(0), outbuffer(0)
    { init(fd, inbufsize, outbufsize); }
PLearn::pl_fdstream::~pl_fdstream ( )

Definition at line 191 of file pl_fdstream.cc.

References PLearn::flush(), and outbuffer.

{
    flush();
    delete rdbuf(0); // delete pl_fdstreambuf
    if(outbuffer)
        delete[] outbuffer;
}

Here is the call graph for this function:


Member Function Documentation

void PLearn::pl_fdstream::attach ( int  fd)

for compatibility with old non-standard stl fstream

Definition at line 179 of file pl_fdstream.cc.

References outbuffer, and PLearn::pl_dftbuflen.

{
    rdbuf(new pl_fdstreambuf(fd, pl_dftbuflen));
    outbuffer= new char[pl_dftbuflen];
#if __GNUC__ < 3 && !defined(WIN32)
    rdbuf()->setbuf(outbuffer, pl_dftbuflen);
#else
    rdbuf()->pubsetbuf(outbuffer, pl_dftbuflen);
#endif
}
void PLearn::pl_fdstream::init ( int  fd,
int  inbufsize = pl_dftbuflen,
int  outbufsize = pl_dftbuflen 
)

Definition at line 159 of file pl_fdstream.cc.

References outbuffer.

{
    rdbuf(new pl_fdstreambuf(fd, inbufsize));
    if(outbufsize<=1)
#if __GNUC__ < 3 && !defined(WIN32)
        rdbuf()->setbuf(0,0);
#else
    rdbuf()->pubsetbuf(0,0);
#endif
    else
    {
        outbuffer = new char[outbufsize];
#if __GNUC__ < 3 && !defined(WIN32)
        rdbuf()->setbuf(outbuffer,outbufsize);
#else
        rdbuf()->pubsetbuf(outbuffer,outbufsize);
#endif
    }
}

Member Data Documentation

char* PLearn::pl_fdstream::outbuffer [protected]

Definition at line 94 of file pl_fdstream.h.

Referenced by attach(), init(), and ~pl_fdstream().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines