#include <StreamSource.hh>
Inherits Messager.
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 () |
Message * | retreivePendingMsg (com_id_t msg_id) |
Message * | popPendingMsg () |
Message * | popOldestMsg () |
void | acknowledgeMsg (com_id_t msg_id) |
void | resendPending (int min_age) |
|
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. |
|
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. |
|
This method returns the unique identifier for the source |
|
This method returns the size of the queue of messages awaiting acknowledgement. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |