You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.



Main Page   Compound List   File List   Compound Members  

tmQueue Class Reference

#include <tmQueue.h>

List of all members.

Public Member Functions

 tmQueue ()
virtual ~tmQueue ()
nsresult Init (const char *aName, PRUint32 aID, tmTransactionManager *aTM)
nsresult AttachClient (PRUint32 aClientID)
nsresult DetachClient (PRUint32 aClientID)
nsresult FlushQueue (PRUint32 aClientID)
nsresult PostTransaction (tmTransaction *aTrans)
PRUint32 GetID () const
const char * GetName () const

Protected Attributes

tmVector mTransactions
tmVector mListeners
PRUint32 mID
char * mName
tmTransactionManagermTM


Detailed Description

This class isn't so much a queue as it is storage for transactions. It is set up to recieve and store transactions in a growing collection (using tmVectors). Different messages can be recieved from the Transaction Manager(TM) the queue belongs to which can add and remove listeners, empty the queue (flush), and add messages to the queue.

See the documentation in tmTransactionService.h for details on the messages you can send to and recieve from the queues in the TM


Constructor & Destructor Documentation

tmQueue::tmQueue   [inline]
 

Set the internal state to default values. Init() must be called after construction to allocate the storage and set the name and ID.

virtual tmQueue::~tmQueue   [virtual]
 

Reclaim the memory allocated in Init(). Destroys the transactions in the transaction storage and the ids in the listener storage


Member Function Documentation

nsresult tmQueue::AttachClient PRUint32    aClientID
 

Adds the clientID to the list of queue listeners. A reply is created and sent to the client. The reply contains both the name of the queue and the id, so the client can match the id to the name and then use the id in all further communications to the queue.

The reply is sent for all cases.

Returns:
NS_ERRROR_INVALID_ARG if there were problems creating storage for the clientID

NS_ERROR_OUT_OF_MEMORY if the collection needed to grow and the allocation of a new backing store failed.

NS_ERROR_GENERATE_SUCCESS(index) if the add was successful. The calling method can get the index of the element added by using the macro NS_ERROR_GET_CODE() on the return value. But for simple success test use NS_SUCCEEDED() on the return value.

nsresult tmQueue::DetachClient PRUint32    aClientID
 

Removes the client from the list of queue listeners. A reply is created and sent to the client to indicate the success of the removal.

The reply is sent for all cases.

Returns:
NS_OK on success

NS_ERROR_INVALID_ARG if client didn't map to an ID that was in the range of the vector. This is bad news, indicates inconsistant state between the queue and it's storage.

nsresult tmQueue::FlushQueue PRUint32    aClientID
 

Removes all the transactions being held in the queue, creating an empty queue. A reply is created and sent to the client to indicate the completion of the operation.

The reply is sent for all cases.

Returns:
NS_OK

PRUint32 tmQueue::GetID   const [inline]
 

Returns:
the ID of the queue

const char* tmQueue::GetName   const [inline]
 

Returns:
the name of the queue

nsresult tmQueue::Init const char *    aName,
PRUint32    aID,
tmTransactionManager   aTM
 

Initialize internal storage vectors and set the name of the queue and the pointer to the TM container.

Returns:
NS_OK if everything succeeds

NS_ERROR_FAILURE if the vector initializations fail or the allocation for the name fails.

nsresult tmQueue::PostTransaction tmTransaction   aTrans
 

Places the transaction passed in on the queue. Takes ownership of the transaction, deletes it in the destructor. A reply is created and sent to the client to indicate the success of the posting of the transaction.

The reply is sent for all cases except INVALID_ARG (no destination)

Returns:
NS_ERRROR_INVALID_ARG if the transaction is null

TM_ERROR_WRONG_QUEUE if the transaction has been sent to the wrong queue.

NS_ERROR_OUT_OF_MEMORY if the collection needed to grow and the allocation of a new backing store failed.

NS_ERROR_GENERATE_SUCCESS(index) if the add was successful. The calling method can get the index of the element added by using the macro NS_ERROR_GET_CODE() on the return value. But for simple success test use NS_SUCCEEDED() on the return value.


The documentation for this class was generated from the following file:
Generated on Mon Feb 24 10:22:50 2003 for transaction manager by doxygen1.3-rc3