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: Activity.h,v 1.4 2005/01/21 19:44:16 mmarsh Exp $ 00008 // 00009 // $Log: Activity.h,v $ 00010 // Revision 1.4 2005/01/21 19:44:16 mmarsh 00011 // Updated for compatibility with Doxygen 1.4.1 00012 // 00013 // Revision 1.3 2004/05/19 15:56:49 mmarsh 00014 // *** empty log message *** 00015 // 00016 // Revision 1.2 2003/11/04 22:31:48 mmarsh 00017 // *** empty log message *** 00018 // 00019 // 00020 00021 #ifndef __CODEX_EVENTS_ACTIVITY_H__ 00022 #define __CODEX_EVENTS_ACTIVITY_H__ 00023 00024 #include <queue> 00025 #include <vector> 00026 00027 #include "Event.h" 00028 00029 using namespace std; 00030 00031 namespace CODEX_Events 00032 { 00034 typedef std::queue< EventBase* > QType; // namespace needed on Solaris 00035 00037 typedef vector< Activity* > DeadPileType; 00038 00055 class Activity 00056 { 00057 public: 00066 Activity( DeadPileType& deadPile, QType& eventQueue ); 00067 00069 virtual ~Activity(); 00070 00077 virtual bool handler( EventAck& event ); 00078 00079 protected: 00087 void sendEvent( EventBase* event, 00088 Activity* source, 00089 bool failure=false ); 00090 00097 void enableTerminate(); 00098 00099 private : 00100 void terminate(); 00101 00102 protected : 00104 DeadPileType& m_deadPile; 00106 QType& m_queue; 00107 00108 private : 00109 int m_outstanding; 00110 bool m_canTerminate; 00111 }; 00112 00113 class DataEvent; 00114 00127 class DataHandler : public virtual Activity 00128 { 00129 public: 00131 DataHandler(); 00132 00134 virtual ~DataHandler(); 00135 00137 virtual bool handler( DataEvent& event ) = 0; 00138 }; 00139 00140 class CloseEvent; 00141 00153 class CloseHandler : public virtual Activity 00154 { 00155 public: 00157 CloseHandler(); 00158 00160 virtual ~CloseHandler(); 00161 00163 virtual bool handler( CloseEvent& event ) = 0; 00164 }; 00165 00166 } 00167 00168 #endif /* __CODEX_EVENTS_ACTIVITY_H__ */
1.4.1