Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CODEX_Quorum::ConcreteResponseTracker< ST, MT > Class Template Reference

ConcreteResponseTracker is a templated class that correlates responses with requests. More...

#include <ResponseTracker.h>

Inheritance diagram for CODEX_Quorum::ConcreteResponseTracker< ST, MT >:

Inheritance graph
[legend]
Collaboration diagram for CODEX_Quorum::ConcreteResponseTracker< ST, MT >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef map< const unsigned
char *, ResponseInfo *, memless<
MT > > 
MessageResponseMap
 Internally stored data type.
typedef MessageResponseMap::iterator MessageResponseMapItr
 Iterator into a MessageResponseMap.

Public Member Functions

 ConcreteResponseTracker (unsigned char *self)
 Constructor.
virtual ~ConcreteResponseTracker ()
 Virtual destructor.
void insert (unsigned char *key, ResponseInfo *m)
 Attach a map of Message%s (keyed by server ID) with request identifier key.
bool remove (const unsigned char *key, bool del=false)
 Remove the map of Message%s with request identifier key.
bool check (const unsigned char *data, int length, unsigned int server)
 Check if the incoming data is a response to a registered request.
ResponseInfooperator() (const unsigned char *msgID)
 Pointer to the ResponseInfo corresponding to the specified message ID, or 0 if the ID isn't found.
unsigned char * extractKey (const unsigned char *data)
 Helper routine to extract the key (message ID) from an incoming or outgoing message.

Detailed Description

template<size_t ST, size_t MT>
class CODEX_Quorum::ConcreteResponseTracker< ST, MT >

ConcreteResponseTracker is a templated class that correlates responses with requests.

The application writer is responsible for ensuring that messages begin with a fixed-length originating server ID followed by a message identifier. Both must be specified to be in whole numbers of bytes.

Definition at line 109 of file ResponseTracker.h.


Constructor & Destructor Documentation

template<size_t ST, size_t MT>
CODEX_Quorum::ConcreteResponseTracker< ST, MT >::ConcreteResponseTracker unsigned char *  self  )  [inline]
 

Constructor.

Parameters:
self Array of MT bytes containing server's identifier.

Definition at line 122 of file ResponseTracker.h.


Member Function Documentation

template<size_t ST, size_t MT>
bool CODEX_Quorum::ConcreteResponseTracker< ST, MT >::check const unsigned char *  data,
int  length,
unsigned int  server
[inline, virtual]
 

Check if the incoming data is a response to a registered request.

If so, the data is added to the corresponding MessageVector. Ownership of the data is kept by the calling routine.

Parameters:
data The full incoming message.
length The length of the array data.
server The ID of the server sending this message.
Return values:
true The message is a response to a known request.
false The message is not recognized and must be handled.

Implements CODEX_Quorum::ResponseTracker.

Definition at line 160 of file ResponseTracker.h.

References CODEX_Quorum::Message::fill().

template<size_t ST, size_t MT>
unsigned char* CODEX_Quorum::ConcreteResponseTracker< ST, MT >::extractKey const unsigned char *  data  )  [inline, virtual]
 

Helper routine to extract the key (message ID) from an incoming or outgoing message.

Returns:
A new array of data, which the calling routine becomes responsible for.

Implements CODEX_Quorum::ResponseTracker.

Definition at line 190 of file ResponseTracker.h.

template<size_t ST, size_t MT>
void CODEX_Quorum::ConcreteResponseTracker< ST, MT >::insert unsigned char *  key,
ResponseInfo m
[inline, virtual]
 

Attach a map of Message%s (keyed by server ID) with request identifier key.

Ownership of the arguments is taken by the object.

Implements CODEX_Quorum::ResponseTracker.

Definition at line 139 of file ResponseTracker.h.

template<size_t ST, size_t MT>
bool CODEX_Quorum::ConcreteResponseTracker< ST, MT >::remove const unsigned char *  key,
bool  del = false
[inline, virtual]
 

Remove the map of Message%s with request identifier key.

Parameters:
key The request identifier
del Should the ResponseInfo be deleted?
Return values:
true The request was successfully found and removed
false The request was not found

Implements CODEX_Quorum::ResponseTracker.

Definition at line 143 of file ResponseTracker.h.


The documentation for this class was generated from the following file:
Generated on Fri May 6 17:42:32 2005 for COrnell Data EXchange (CODEX) by  doxygen 1.4.1