Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

MPS::Connection Class Reference

Manages a connection over a Transport to an MPS server. More...

#include <connection.h>

Inheritance diagram for MPS::Connection:

Inheritance graph
[legend]
Collaboration diagram for MPS::Connection:

Collaboration graph
[legend]
List of all members.

Public Methods

virtual ~Connection ()
Address const& getRemoteAddress () const
virtual OutputStreamgetOutputStream ()=0
virtual void releaseOutputStream (OutputStream *stream)=0
virtual InputStreamgetInputStream ()=0
virtual void releaseInputStream (InputStream *stream)=0
virtual void setCallback (ref< Callback > _callback, Callback::Method _method)
void fireCallback (InputStream &input)

Protected Methods

 Connection (Address const &a)

Private Attributes

Address address
ref<Callbackcallback
Callback::Method callbackMethod

Detailed Description

Manages a connection over a Transport to an MPS server.

Allows message reception and transmission.

Definition at line 44 of file connection.h.


Constructor & Destructor Documentation

MPS::Connection::Connection ( Address const & a ) [inline, protected]
 

Constructor for subclasses.

Definition at line 59 of file connection.h.

MPS::Connection::~Connection ( ) [inline, virtual]
 

Definition at line 66 of file connection.h.


Member Function Documentation

void MPS::Connection::fireCallback ( InputStream & input ) [inline]
 

If a callback is registered, deregisters it, and calls it.

Note that callbacks should be called when it's safe to read a complete message from this connection (ie. it won't block to do so). This method should be called from somewhere within Transports' main loops.

See also:
Proxy::_setCallback

Definition at line 120 of file connection.h.

InputStream * MPS::Connection::getInputStream ( ) [pure virtual]
 

Obtain an InputStream to use to receive a message from the remote object.

The caller must call releaseInputStream() when it's finished with the stream.

Returns:
an InputStream which allows reading of the most recent message sent back from the remote object.

Reimplemented in FastmsgLink, MPS::InetTransport::InetConnection, and MPS::SimplTransport::SimplConnection.

OutputStream * MPS::Connection::getOutputStream ( ) [pure virtual]
 

Obtain an OutputStream to use to send a message to the remote object.

The caller must call releaseOutputStream() when it's finished with the stream.

Returns:
an OutputStream which, when flushed, will send a message to the remote object.

Reimplemented in FastmsgLink, MPS::InetTransport::InetConnection, and MPS::SimplTransport::SimplConnection.

Address const & MPS::Connection::getRemoteAddress ( ) const [inline]
 

Extract the address of the object we're connected to.

Definition at line 69 of file connection.h.

void MPS::Connection::releaseInputStream ( InputStream * stream ) [pure virtual]
 

Signals that the caller is finished with an InputStream obtained via the getInputStream() method.

Parameters:
stream   the stream to release

Reimplemented in FastmsgLink, MPS::InetTransport::InetConnection, and MPS::SimplTransport::SimplConnection.

void MPS::Connection::releaseOutputStream ( OutputStream * stream ) [pure virtual]
 

Signals that the caller is finished with an OutputStream obtained via the getOutputStream() method.

Parameters:
stream   the stream to release

Reimplemented in FastmsgLink, MPS::InetTransport::InetConnection, and MPS::SimplTransport::SimplConnection.

void MPS::Connection::setCallback ( ref< Callback > _callback,
Callback::Method _method ) [inline, virtual]
 

Registers a callback.

Override this if you need to do special processing on callback registration (unlikely).

See also:
Proxy::_setCallback

Definition at line 108 of file connection.h.


Member Data Documentation

Address MPS::Connection::address [private]
 

the address of the remote object.

Definition at line 53 of file connection.h.

ref< Callback > MPS::Connection::callback<Callback> [private]
 

currently-registered callback.

Definition at line 54 of file connection.h.

Callback::Method MPS::Connection::callbackMethod [private]
 

method to invoke on registered callback.

Definition at line 55 of file connection.h.


The documentation for this class was generated from the following file:
Generated at Wed Aug 15 01:05:26 2001 for mps-cpp by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001