ACE_Msg_WFMO_Reactor Class Reference

An OO event demultiplexor and event handler dispatcher for Win32 . More...

#include <Msg_WFMO_Reactor.h>

Inheritance diagram for ACE_Msg_WFMO_Reactor:

Inheritance graph
[legend]
Collaboration diagram for ACE_Msg_WFMO_Reactor:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ACE_Msg_WFMO_Reactor (ACE_Sig_Handler *=0, ACE_Timer_Queue *=0)
 Initialize with the default size.

 ACE_Msg_WFMO_Reactor (size_t size, int unused=0, ACE_Sig_Handler *=0, ACE_Timer_Queue *=0)
virtual ~ACE_Msg_WFMO_Reactor (void)
 Close down the ACE_Msg_WFMO_Reactor and release all of its resources.

virtual int handle_events (ACE_Time_Value *max_wait_time=0)
virtual int alertable_handle_events (ACE_Time_Value *max_wait_time=0)
virtual int handle_events (ACE_Time_Value &max_wait_time)
virtual int alertable_handle_events (ACE_Time_Value &max_wait_time)

Protected Member Functions

virtual DWORD wait_for_multiple_events (int timeout, int alertable)
 Wait for timer and I/O events to occur.

virtual DWORD poll_remaining_handles (DWORD index)
 Check for activity on remaining handles.

virtual int dispatch_window_messages (void)
 Dispatches window messages.


Detailed Description

An OO event demultiplexor and event handler dispatcher for Win32 .

The ACE_Msg_WFMO_Reactor is an OO event demultiplexor and event handler Reactor. It differs from by its ability to react on Windows messages. It is needed when the task should serve also as a COM/DCOM server.

Definition at line 42 of file Msg_WFMO_Reactor.h.


Constructor & Destructor Documentation

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Msg_WFMO_Reactor::ACE_Msg_WFMO_Reactor ACE_Sig_Handler = 0,
ACE_Timer_Queue = 0
 

Initialize with the default size.

Definition at line 15 of file Msg_WFMO_Reactor.cpp.

References ACE_Timer_Queue.

00017   : ACE_WFMO_Reactor (sh, tq)
00018 {
00019 }

ACE_Msg_WFMO_Reactor::ACE_Msg_WFMO_Reactor size_t  size,
int  unused = 0,
ACE_Sig_Handler = 0,
ACE_Timer_Queue = 0
 

Initialize with size . Two slots will be added to the parameter which will store handles used for internal management purposes.

Definition at line 21 of file Msg_WFMO_Reactor.cpp.

References ACE_Timer_Queue.

00025   : ACE_WFMO_Reactor (size, unused, sh, tq)
00026 {
00027 }

ACE_Msg_WFMO_Reactor::~ACE_Msg_WFMO_Reactor void   )  [virtual]
 

Close down the ACE_Msg_WFMO_Reactor and release all of its resources.

Definition at line 29 of file Msg_WFMO_Reactor.cpp.

00030 {
00031 }


Member Function Documentation

virtual int ACE_Msg_WFMO_Reactor::alertable_handle_events ACE_Time_Value max_wait_time  )  [virtual]
 

Reimplemented from ACE_WFMO_Reactor.

virtual int ACE_Msg_WFMO_Reactor::alertable_handle_events ACE_Time_Value max_wait_time = 0  )  [virtual]
 

Reimplemented from ACE_WFMO_Reactor.

int ACE_Msg_WFMO_Reactor::dispatch_window_messages void   )  [protected, virtual]
 

Dispatches window messages.

Reimplemented from ACE_WFMO_Reactor.

Definition at line 59 of file Msg_WFMO_Reactor.cpp.

00060 {
00061   int number_of_messages = 0;
00062   MSG msg;
00063 
00064   // Process all pending message from this thread's message queue
00065   while (::PeekMessage (&msg, 0, 0, 0, PM_REMOVE))
00066     {
00067       ::TranslateMessage (&msg);
00068       if (msg.message == WM_QUIT)
00069         {
00070           // Should inform the main thread
00071           ::PostQuitMessage (msg.wParam);
00072           return -1;
00073         }
00074 
00075       ::DispatchMessage (&msg);
00076       ++number_of_messages;
00077     }
00078 
00079   return number_of_messages;
00080 }

virtual int ACE_Msg_WFMO_Reactor::handle_events ACE_Time_Value max_wait_time  )  [virtual]
 

This method is just like the one above, except the value is a reference and can therefore never be NULL.

Reimplemented from ACE_WFMO_Reactor.

virtual int ACE_Msg_WFMO_Reactor::handle_events ACE_Time_Value max_wait_time = 0  )  [virtual]
 

This event loop driver blocks for up to before returning. It will return earlier if timer events, I/O events, window events, or signal events occur. Note that can be 0, in which case this method blocks indefinitely until events occur.

is decremented to reflect how much time this call took. For instance, if a time value of 3 seconds is passed to handle_events and an event occurs after 2 seconds, will equal 1 second. This can be used if an application wishes to handle events for some fixed amount of time.

is used as the demultiplexing call

Returns the total number of ACE_Event_Handlers that were dispatched, 0 if the elapsed without dispatching any handlers, or -1 if an error occurs.

The only difference between and is that in the alertable case, MWMO_ALERTABLE is passed to for the option.

Reimplemented from ACE_WFMO_Reactor.

DWORD ACE_Msg_WFMO_Reactor::poll_remaining_handles DWORD  index  )  [protected, virtual]
 

Check for activity on remaining handles.

Reimplemented from ACE_WFMO_Reactor.

Definition at line 83 of file Msg_WFMO_Reactor.cpp.

References ACE_WFMO_Reactor_Handler_Repository::handles().

00084 {
00085   return ::MsgWaitForMultipleObjects (this->handler_rep_.max_handlep1 () - slot,
00086                                       this->handler_rep_.handles () + slot,
00087                                       FALSE,
00088                                       0,
00089                                       QS_ALLINPUT);
00090 }

DWORD ACE_Msg_WFMO_Reactor::wait_for_multiple_events int  timeout,
int  alertable
[protected, virtual]
 

Wait for timer and I/O events to occur.

Reimplemented from ACE_WFMO_Reactor.

Definition at line 34 of file Msg_WFMO_Reactor.cpp.

References ACE_WFMO_Reactor_Handler_Repository::handles().

00036 {
00037   // Wait for any of handles_ to be active, or until timeout expires.
00038   // If <alertable> is enabled allow asynchronous completion of
00039   // ReadFile and WriteFile operations. QS_ALLINPUT allows
00040   // <MsgWaitForMultipleObjectsEx> to wait for any message is in the
00041   // queue.
00042 #if (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0))
00043   return ::MsgWaitForMultipleObjectsEx (this->handler_rep_.max_handlep1 (),
00044                                         this->handler_rep_.handles (),
00045                                         timeout,
00046                                         QS_ALLINPUT,
00047                                         alertable);
00048 #else
00049   ACE_UNUSED_ARG (alertable);
00050   return ::MsgWaitForMultipleObjects (this->handler_rep_.max_handlep1 (),
00051                                       this->handler_rep_.handles (),
00052                                       FALSE,
00053                                       timeout,
00054                                       QS_ALLINPUT);
00055 #endif /* (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) */
00056 }


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:25:10 2006 for ACE by doxygen 1.3.6