FlReactor.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   FlReactor.h
00006  *
00007  *  FlReactor.h,v 4.14 2005/10/28 16:14:52 ossama Exp
00008  *
00009  *  @author Carlos O'Ryan <coryan@cs.wustl.edu>
00010  *  @author Based in part in the ACE_XtReactor implementation by
00011  *  @author Eric C. Newton's <ecn@clark.net>
00012  *  @author Kirill Rybaltchenko <Kirill.Rybaltchenko@cern.ch>
00013  *  @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
00014  */
00015 //=============================================================================
00016 
00017 
00018 #ifndef ACE_FLREACTOR_H
00019 #define ACE_FLREACTOR_H
00020 #include /**/ "ace/pre.h"
00021 
00022 #include "ace/config-all.h"
00023 
00024 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00025 # pragma once
00026 #endif /* ACE_LACKS_PRAGMA_ONCE */
00027 
00028 #include "ace/ACE_FlReactor_export.h"
00029 #include "ace/Select_Reactor.h"
00030 
00031 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00032 
00033 /**
00034  * @class ACE_FlReactor
00035  *
00036  * @brief A Reactor implementation that uses the Fast-Light (FL) toolkit
00037  * for event demultiplexing.  This will let us integrate the FL
00038  * toolkit with ACE and/or TAO.
00039  *
00040  * As many other GUI toolkits FL supports a minimal set of
00041  * callbacks to handle event demultiplexing, namely simple methods
00042  * to add file descriptors to the event demuxing set or timeout
00043  * events.  This class adapts this simple mechanisms so they are
00044  * compatible with ACE's Reactor.
00045  */
00046 class ACE_FlReactor_Export ACE_FlReactor : public ACE_Select_Reactor
00047 {
00048 
00049 public:
00050   // = Initialization and termination methods.
00051   ACE_FlReactor (size_t size = DEFAULT_SIZE,
00052                  int restart = 0,
00053                  ACE_Sig_Handler * = 0);
00054   virtual ~ACE_FlReactor (void);
00055 
00056   // = Timer operations.
00057   virtual long schedule_timer (ACE_Event_Handler *event_handler,
00058                                const void *arg,
00059                                const ACE_Time_Value &delay,
00060                                const ACE_Time_Value &interval);
00061   virtual int reset_timer_interval (long timer_id,
00062                                     const ACE_Time_Value &interval);
00063   virtual int cancel_timer (ACE_Event_Handler *handler,
00064                             int dont_call_handle_close = 1);
00065   virtual int cancel_timer (long timer_id,
00066                             const void **arg = 0,
00067                             int dont_call_handle_close = 1);
00068 
00069 protected:
00070   // = Register timers/handles with Fl.
00071   /// Register a single <handler>.
00072   virtual int register_handler_i (ACE_HANDLE handle,
00073                                   ACE_Event_Handler *handler,
00074                                   ACE_Reactor_Mask mask);
00075 
00076   /// Register a set of <handlers>.
00077   virtual int register_handler_i (const ACE_Handle_Set &handles,
00078                                   ACE_Event_Handler *handler,
00079                                   ACE_Reactor_Mask mask);
00080 
00081   /// Remove the <handler> associated with this <handle>.
00082   virtual int remove_handler_i (ACE_HANDLE handle,
00083                                 ACE_Reactor_Mask mask);
00084 
00085   /// Remove a set of <handles>.
00086   virtual int remove_handler_i (const ACE_Handle_Set &handles,
00087                                 ACE_Reactor_Mask);
00088 
00089   /// Wait for events to occur.
00090   virtual int wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &,
00091                                         ACE_Time_Value *);
00092 
00093 private:
00094   /// This method ensures there's an Fl timeout for the first timeout
00095   /// in the Reactor's Timer_Queue.
00096   void reset_timeout (void);
00097 
00098   // = Integrate with the FL callback function mechanism.
00099   static void fl_io_proc (int fd, void*);
00100   static void fl_timeout_proc (void*);
00101 
00102   /// Deny access since member-wise won't work...
00103   ACE_FlReactor (const ACE_FlReactor &);
00104   ACE_FlReactor &operator = (const ACE_FlReactor &);
00105 };
00106 
00107 ACE_END_VERSIONED_NAMESPACE_DECL
00108 
00109 #include /**/ "ace/post.h"
00110 #endif /* ACE_FLREACTOR_H */

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