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: ClientResponseEvent.h,v 1.4 2005/01/21 19:44:17 mmarsh Exp $ 00008 // 00009 // $Log: ClientResponseEvent.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:51 mmarsh 00014 // *** empty log message *** 00015 // 00016 // Revision 1.2 2003/11/04 22:31:49 mmarsh 00017 // *** empty log message *** 00018 // 00019 // 00020 00021 #ifndef __CODEX_KEYSERVICE_CLIENT_RESPONSE_EVENT_H__ 00022 #define __CODEX_KEYSERVICE_CLIENT_RESPONSE_EVENT_H__ 00023 00024 #include "CODEX_Events/Event.h" 00025 //#include "CODEX_Client/Message.h" 00026 00027 namespace CODEX_KeyService 00028 { 00029 class ClientResponseHandler; 00030 00037 class ClientResponseEventBase : public CODEX_Events::EventBase 00038 { 00039 public : 00044 ClientResponseEventBase( CODEX_Events::Activity* source ) : 00045 CODEX_Events::EventBase( source ) 00046 {} 00047 00049 virtual ~ClientResponseEventBase() {} 00050 00052 virtual int marshal( unsigned char ** pp ) = 0; 00053 }; 00054 00061 template< class MT > 00062 class ClientResponseEvent : public ClientResponseEventBase 00063 { 00064 public : 00066 ClientResponseEvent( CODEX_Events::Activity* source, 00067 ClientResponseHandler* destination, 00068 const MT& message, 00069 bool acknowledge=false ) : 00070 ClientResponseEventBase( source ), 00071 m_destination( destination ), 00072 m_message( message ), 00073 m_acknowledge( acknowledge ) 00074 {} 00075 00077 virtual ~ClientResponseEvent() {} 00078 00080 const MT& message() const { return m_message; } 00081 00083 bool acknowledge() const { return m_acknowledge; } 00084 00089 bool handle() { return m_destination->handler( *this ); } 00090 00098 void reRoute( ClientResponseHandler* newDestination ) 00099 { 00100 m_destination = newDestination; 00101 } 00102 00104 int marshal( unsigned char ** pp ) 00105 { 00106 return m_message.marshal(pp); 00107 } 00108 00109 private : 00110 ClientResponseHandler* m_destination; 00111 MT m_message; 00112 bool m_acknowledge; 00113 }; 00114 } 00115 00116 #endif /* __CODEX_KEYSERVICE_CLIENT_RESPONSE_EVENT_H__ */
1.4.1