conexus logo

Conexus::NSPR::FileDescriptor Class Reference
[Conexus I/O Endpoints with NSPR support]

This class is the top level object for all subclasses performing I/O (Input/Output) operations via NSPR file descriptors. More...

#include <conexus-nspr/filedescriptor.h>

Inheritance diagram for Conexus::NSPR::FileDescriptor:

Inheritance graph
[legend]

List of all members.

Public Types

typedef ConexusPointer
< FileDescriptor
pointer

Public Member Functions

virtual ~FileDescriptor ()
virtual PRFileDesc * fd () throw ()
 Base class method returning the raw NSPR file descriptor.
virtual void close (bool force=false) throw ( close_exception )
 Closes the Endpoint object by closing the member file descriptor.
virtual size_t input_available () throw ()

Protected Member Functions

 FileDescriptor (PRFileDesc *fd=NULL, bool close_on_destruct=true)
virtual size_t write_data (const Data data, Timeout timeout) throw ( write_exception )
 Reimplements write_data() to provide for NSPR specific calls.
virtual Data read_data (size_t size, Timeout timeout) throw ( read_exception )
 Implements Endpoint::read_data().

Protected Attributes

PRFileDesc * m_fd


Detailed Description

This class is the top level object for all subclasses performing I/O (Input/Output) operations via NSPR file descriptors.

Author:
Rick L Vinyard Jr

Member Typedef Documentation


Constructor & Destructor Documentation

Conexus::NSPR::FileDescriptor::FileDescriptor ( PRFileDesc *  fd = NULL,
bool  close_on_destruct = true 
) [protected]

Conexus::NSPR::FileDescriptor::~FileDescriptor (  )  [virtual]

References close().


Member Function Documentation

void Conexus::NSPR::FileDescriptor::close ( bool  force = false  )  throw ( close_exception ) [virtual]

Closes the Endpoint object by closing the member file descriptor.

If the object is already closed will return without attempting to close.

Reimplemented in Conexus::NSPR::Socket.

Referenced by ~FileDescriptor().

PRFileDesc * Conexus::NSPR::FileDescriptor::fd (  )  throw () [virtual]

Base class method returning the raw NSPR file descriptor.

References m_fd.

size_t Conexus::NSPR::FileDescriptor::input_available (  )  throw () [virtual]

References m_fd.

Data Conexus::NSPR::FileDescriptor::read_data ( size_t  size,
Timeout  timeout 
) throw ( read_exception ) [protected, virtual]

Implements Endpoint::read_data().

Reimplemented in Conexus::NSPR::Socket.

Referenced by Conexus::NSPR::Socket::read_data(), and Conexus::NSPR::File::read_data().

size_t Conexus::NSPR::FileDescriptor::write_data ( const Data  data,
Timeout  timeout 
) throw ( write_exception ) [protected, virtual]

Reimplements write_data() to provide for NSPR specific calls.

This method performs blocking I/O whenever timeout is zero or null. This differs from the base Conexus endpoint behavior which performs non-blocking I/O whenever timeout is zero. The reason for this change is due to the fact that NSPR does not support non-blocking I/O at the file level, as only sockets can perform non-blocking I/O in NSPR.

Todo:
throw specific exceptions rather than a generic exception

Reimplemented in Conexus::NSPR::Socket, Conexus::NSPR::TCP, and Conexus::NSPR::UDP.


Member Data Documentation

PRFileDesc* Conexus::NSPR::FileDescriptor::m_fd [protected]


The documentation for this class was generated from the following files:

Generated on Tue Mar 3 09:48:17 2009 for conexus-nspr by doxygen 1.5.7.1