Main Page | Modules | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

StreamSource Class Reference
[Communications Facilities]

#include <StreamSource.hh>

Inherits Messager.

List of all members.


Detailed Description

Class for sending messages to a remote stream sink.

This is a class for sending messages to a remote stream sink. It buffers outgoing messages until they are acknowledged. We can flush the buffer, query for the number of backed up messages, and pop them off the queue.


Public Member Functions

 StreamSource (CommManager *mgr, RemoteManager *dest, int max_size, com_id_t stream_id, com_id_t exclusive_dest=0, MessagePool *pool=NULL)
com_id_t sendMsg (Message *)
com_id_t sendInt (int i)
com_id_t sendDouble (double d)
com_id_t getSID () const
int ackBlock (com_id_t msg_id, int timeout_ms=-1)
void flush (com_id_t msg_id=0)
int numToSend ()
MessageretreivePendingMsg (com_id_t msg_id)
MessagepopPendingMsg ()
MessagepopOldestMsg ()
void acknowledgeMsg (com_id_t msg_id)
void resendPending (int min_age)


Member Function Documentation

int StreamSource::ackBlock com_id_t  msg_id,
int  timeout_ms = -1
 

This method blocks until the sent message with identifier "msg_id" is no longer on the queue of messages awaiting acknowledgement. If "timeout_ms" is negative, the routine will block forever, otherwise the method will block at most "timeout_ms" milliseconds.

void StreamSource::flush com_id_t  msg_id = 0  ) 
 

This method removes from the queue of messages awaiting acknowledgement any message with identifier "msg_id". If "msg_id" is 0, it removes all the messages from the queue. All removed messages are released in the process.

com_id_t StreamSource::getSID  )  const [inline]
 

This method returns the unique identifier for the source

int StreamSource::numToSend  )  [inline]
 

This method returns the size of the queue of messages awaiting acknowledgement.

Message* StreamSource::popOldestMsg  ) 
 

If the pending acknowledgment queue is non-empty, this method pops the oldest message put on the queue off and returns it to the user.

Message* StreamSource::popPendingMsg  ) 
 

If the pending acknowledgment queue is non-empty, this method pops the most recent message put on the queue off and returns it to the user.

Message* StreamSource::retreivePendingMsg com_id_t  msg_id  ) 
 

If there is a message waiting to be acknowledged with identifier "msg_id", this method removes it from the pending acknowledgment queue and returns it, otherwise, it returns NULL.

com_id_t StreamSource::sendDouble double  d  ) 
 

This method is a convenience routine for sending double precision floating point values. Since streams are even more expensive than mailboxes, use with caution, as it is usually better to bundle related values together in a structure rather than having many individual integer and double streams.

com_id_t StreamSource::sendInt int  i  ) 
 

This method is a convenience routine for sending integers. Since streams are even more expensive than mailboxes, use with caution, as it is usually better to bundle related values together in a structure rather than having many individual integer and double streams.

com_id_t StreamSource::sendMsg Message  ) 
 

This method sends the message to the remote stream sink. The sub-thread will continue to resend the message until it is acknowledged. Upon acknowledgement, the message will be released. The return value is the outgoing message ID, which can be used to retrieve this message from the pending acknowledgement queue.


RHexLib Reference Documentation