Msg_WFMO_Reactor.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Msg_WFMO_Reactor.h
00006  *
00007  *  Msg_WFMO_Reactor.h,v 4.21 2006/02/10 10:06:22 jwillemsen Exp
00008  *
00009  *  @author Beskrovny Evgeny <evgeny_beskrovny@icomverse.com>
00010  *  @author Irfan Pyarali <irfan@cs.wustl.edu>
00011  */
00012 //=============================================================================
00013 
00014 
00015 #ifndef ACE_MSG_WFMO_REACTOR_H
00016 #define ACE_MSG_WFMO_REACTOR_H
00017 #include /**/ "ace/pre.h"
00018 
00019 #include "ace/ACE_export.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 #if defined (ACE_WIN32) && !defined (ACE_LACKS_MSG_WFMO)
00026 
00027 #include "ace/WFMO_Reactor.h"
00028 
00029 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00030 
00031 /**
00032  * @class ACE_Msg_WFMO_Reactor
00033  *
00034  * @brief An OO event demultiplexor and event handler dispatcher for
00035  * Win32 <MsgWaitForMultipleObjects>.
00036  *
00037  * The ACE_Msg_WFMO_Reactor is an OO event demultiplexor and
00038  * event handler Reactor. It differs from <ACE_WFMO_Reactor> by
00039  * its ability to react on Windows messages.  It is needed when
00040  * the task should serve also as a COM/DCOM server.
00041  */
00042 class ACE_Export ACE_Msg_WFMO_Reactor : public ACE_WFMO_Reactor
00043 {
00044 public:
00045   // = Initialization and termination methods.
00046   /// Initialize <ACE_Msg_WFMO_Reactor> with the default size.
00047   ACE_Msg_WFMO_Reactor (ACE_Sig_Handler * = 0,
00048                         ACE_Timer_Queue * = 0);
00049 
00050   /**
00051    * Initialize <ACE_Msg_WFMO_Reactor> with size <size>.  Two slots will be
00052    * added to the <size> parameter which will store handles used for
00053    * internal management purposes.
00054    */
00055   ACE_Msg_WFMO_Reactor (size_t size,
00056                         int unused = 0,
00057                         ACE_Sig_Handler * = 0,
00058                         ACE_Timer_Queue * = 0);
00059 
00060   /// Close down the ACE_Msg_WFMO_Reactor and release all of its resources.
00061   virtual ~ACE_Msg_WFMO_Reactor (void);
00062 
00063   /**
00064    * This event loop driver blocks for up to <max_wait_time> before
00065    * returning.  It will return earlier if timer events, I/O events,
00066    * window events, or signal events occur.  Note that <max_wait_time>
00067    * can be 0, in which case this method blocks indefinitely until
00068    * events occur.
00069    *
00070    * <max_wait_time> is decremented to reflect how much time this call
00071    * took.  For instance, if a time value of 3 seconds is passed to
00072    * handle_events and an event occurs after 2 seconds,
00073    * <max_wait_time> will equal 1 second.  This can be used if an
00074    * application wishes to handle events for some fixed amount of
00075    * time.
00076    *
00077    * <MsgWaitForMultipleObjects> is used as the demultiplexing call
00078    *
00079    * Returns the total number of ACE_Event_Handlers that were
00080    * dispatched, 0 if the <max_wait_time> elapsed without dispatching
00081    * any handlers, or -1 if an error occurs.
00082    *
00083    * The only difference between <alertable_handle_events> and
00084    * <handle_events> is that in the alertable case, MWMO_ALERTABLE is
00085    * passed to <MsgWaitForMultipleObjects> for the <bAlertable>
00086    * option.
00087    */
00088   virtual int handle_events (ACE_Time_Value *max_wait_time = 0);
00089   virtual int alertable_handle_events (ACE_Time_Value *max_wait_time = 0);
00090 
00091   /**
00092    * This method is just like the one above, except the
00093    * <max_wait_time> value is a reference and can therefore never be
00094    * NULL.
00095    */
00096   virtual int handle_events (ACE_Time_Value &max_wait_time);
00097   virtual int alertable_handle_events (ACE_Time_Value &max_wait_time);
00098 
00099 protected:
00100   /// Wait for timer and I/O events to occur.
00101   virtual DWORD wait_for_multiple_events (int timeout,
00102                                           int alertable);
00103 
00104   /// Check for activity on remaining handles.
00105   virtual DWORD poll_remaining_handles (DWORD index);
00106 
00107   /// Dispatches window messages.
00108   virtual int dispatch_window_messages (void);
00109 };
00110 
00111 ACE_END_VERSIONED_NAMESPACE_DECL
00112 
00113 #if defined (__ACE_INLINE__)
00114 #include "ace/Msg_WFMO_Reactor.inl"
00115 #endif /* __ACE_INLINE__ */
00116 
00117 #endif /* ACE_WIN32 && !ACE_LACKS_MSG_WFMO */
00118 
00119 #include /**/ "ace/post.h"
00120 #endif /* ACE_MSG_WFMO_REACTOR_H */

Generated on Thu Nov 9 09:41:56 2006 for ACE by doxygen 1.3.6