Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound 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.3 2004/05/19 15:56:56 mmarsh Exp $
00008 //
00009 // $Log: ResponseInfo.h,v $
00010 // Revision 1.3  2004/05/19 15:56:56  mmarsh
00011 // *** empty log message ***
00012 //
00013 // Revision 1.2  2003/11/04 22:17:23  mmarsh
00014 // General code cleanup.
00015 //
00016 //
00017 
00018 #ifndef __CODEX_QUORUM_RESPONSEINFO_H__
00019 #define __CODEX_QUORUM_RESPONSEINFO_H__
00020 
00021 #include <map>
00022 
00023 #include "ResponseCallback.h"
00024 
00025 namespace CODEX_Quorum
00026 {
00030    class ResponseInfo
00031    {
00032       public :
00034          typedef map< unsigned int , bool > ServerMap;
00035 
00042          ResponseInfo( ResponseCallback* cb ) :
00043             m_cb( cb ),
00044             m_failures( 0 )
00045          {}
00046 
00048          virtual ~ResponseInfo();
00049 
00057          void add( unsigned int server, Message* msg );
00058 
00060          const ServerMap& map() const { return m_map; }
00061 
00063          unsigned int failures() const { return m_failures; }
00064 
00066          unsigned int successes() const { return m_map.size() - m_failures; }
00067 
00069          void fail() { if ( 0 != m_cb ) m_cb->fail(); }
00070 
00071       private :
00072          ResponseCallback*  m_cb;
00073          unsigned int       m_failures;
00074          ServerMap          m_map;
00075    };
00076 
00077 }
00078 
00079 #endif /* __CODEX_QUORUM_RESPONSEINFO_H__ */

Generated on Wed Jun 2 16:32:55 2004 for COrnell Data EXchange (CODEX) by doxygen1.2.18