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

ResponseInfo.h

00001 /*
00002  * Copyright 2003 Michael A. Marsh, Cornell University. All rights reserved.
00003  * This software is released under the modified BSD license.
00004  * See the file LICENSE in the top-level directory for details.
00005  */
00006 //
00007 // $Id: ResponseInfo.h,v 1.4 2005/01/21 19:44:17 mmarsh Exp $
00008 //
00009 // $Log: ResponseInfo.h,v $
00010 // Revision 1.4  2005/01/21 19:44:17  mmarsh
00011 // Updated for compatibility with Doxygen 1.4.1
00012 //
00013 // Revision 1.3  2004/05/19 15:56:56  mmarsh
00014 // *** empty log message ***
00015 //
00016 // Revision 1.2  2003/11/04 22:17:23  mmarsh
00017 // General code cleanup.
00018 //
00019 //
00020 
00021 #ifndef __CODEX_QUORUM_RESPONSEINFO_H__
00022 #define __CODEX_QUORUM_RESPONSEINFO_H__
00023 
00024 #include <map>
00025 
00026 #include "ResponseCallback.h"
00027 
00028 namespace CODEX_Quorum
00029 {
00033    class ResponseInfo
00034    {
00035       public :
00037          typedef map< unsigned int , bool > ServerMap;
00038 
00045          ResponseInfo( ResponseCallback* cb ) :
00046             m_cb( cb ),
00047             m_failures( 0 )
00048          {}
00049 
00051          virtual ~ResponseInfo();
00052 
00060          void add( unsigned int server, Message* msg );
00061 
00063          const ServerMap& map() const { return m_map; }
00064 
00066          unsigned int failures() const { return m_failures; }
00067 
00069          unsigned int successes() const { return m_map.size() - m_failures; }
00070 
00072          void fail() { if ( 0 != m_cb ) m_cb->fail(); }
00073 
00074       private :
00075          ResponseCallback*  m_cb;
00076          unsigned int       m_failures;
00077          ServerMap          m_map;
00078    };
00079 
00080 }
00081 
00082 #endif /* __CODEX_QUORUM_RESPONSEINFO_H__ */

Generated on Fri May 6 17:41:02 2005 for COrnell Data EXchange (CODEX) by  doxygen 1.4.1