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

CODEX_Quorum::RemoteServerReturn Class Reference

Return values from server communications. More...

#include <RemoteServer.h>

List of all members.

Public Types

enum  ReturnCode { kSuccess, kFailure }
enum  ErrorCode { kNone, kTimeout }

Public Methods

 RemoteServerReturn ()
 The default constructor creates a new RemoteServerReturn object with a ReturnCode::kFailure and ErrorCode::kNone, indicating no successful response but no errors (ie, response pending), and a creation time.

 RemoteServerReturn (const RemoteServerReturn &sr)
 Copy constructor.

ReturnCode returnCode () const
 
Returns:
success or failure of the connection attempt


ErrorCode errorCode () const
 
Returns:
whether or not there was an error


timeval elapsed () const
 Calculate the time elapsed between creation and the last-recorded time.

void setReturnCode (ReturnCode ret)
 Set whether the connection was successful or not.

void setErrorCode (ErrorCode err)
 Set whether there was an error.

void updateTime (const struct timeval &t)
 Set the last-recorded time to the specified time.

void reset ()
 Reset the RemoteServer return to its default state.


Detailed Description

Return values from server communications.

This is designed to be updated in successive invocations.

Definition at line 39 of file RemoteServer.h.


Member Enumeration Documentation

enum CODEX_Quorum::RemoteServerReturn::ErrorCode
 

Enumeration values:
kNone  No errors were detected, though communications may not have been successful yet.
kTimeout  Communications with the server timed out.

Definition at line 49 of file RemoteServer.h.

Referenced by errorCode(), and setErrorCode().

enum CODEX_Quorum::RemoteServerReturn::ReturnCode
 

Enumeration values:
kSuccess  Communications were successful.
kFailure  Communications were unsuccessful.

Definition at line 42 of file RemoteServer.h.

Referenced by returnCode(), and setReturnCode().


Constructor & Destructor Documentation

CODEX_Quorum::RemoteServerReturn::RemoteServerReturn   [inline]
 

The default constructor creates a new RemoteServerReturn object with a ReturnCode::kFailure and ErrorCode::kNone, indicating no successful response but no errors (ie, response pending), and a creation time.

Bug:
Probably not handling error from of gettimeofday optimally.

Definition at line 64 of file RemoteServer.h.

References kFailure, and kNone.


Member Function Documentation

struct timeval CODEX_Quorum::RemoteServerReturn::elapsed   const [inline]
 

Calculate the time elapsed between creation and the last-recorded time.

Returns:
elapsed time as a timeval structure

Definition at line 99 of file RemoteServer.h.

References elapsed().

Referenced by CODEX_Quorum::RemoteServer::checkTimeout(), and elapsed().

void CODEX_Quorum::RemoteServerReturn::reset   [inline]
 

Reset the RemoteServer return to its default state.

The return code and error state are set back to their default values. The creation time and last-recorded time are set to the current time unless gettimeofday(2) fails, in which case they are both set to 0.

Definition at line 132 of file RemoteServer.h.

References kFailure, and kNone.

Referenced by CODEX_Quorum::RemoteServer::contact(), and CODEX_Client::Client::contactServer().


The documentation for this class was generated from the following file:
Generated on Wed Jun 2 16:33:18 2004 for COrnell Data EXchange (CODEX) by doxygen1.2.18