Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Priority_Reactor.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Priority_Reactor.h
00006  *
00007  *  $Id: Priority_Reactor.h,v 1.1.1.4 2003/02/21 18:36:32 chad Exp $
00008  *
00009  *  @author Carlos O'Ryan <coryan@uci.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef ACE_PRIORITY_REACTOR_H
00014 #define ACE_PRIORITY_REACTOR_H
00015 #include "ace/pre.h"
00016 
00017 #include "ace/Unbounded_Queue.h"
00018 
00019 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00020 # pragma once
00021 #endif /* ACE_LACKS_PRAGMA_ONCE */
00022 
00023 #include "ace/Select_Reactor.h"
00024 
00025 /**
00026  * @class ACE_Priority_Reactor
00027  *
00028  * @brief Implements priority based dispatching.
00029  *
00030  * This class refines the dispatching mechanism for the
00031  * Select_Reactor by taking advantage of the priority method on
00032  * ACE_Event_Handler.
00033  */
00034 class ACE_Export ACE_Priority_Reactor : public ACE_Select_Reactor
00035 {
00036 public:
00037   // = Initialization and termination methods.
00038 
00039   /// Initialize <ACE_Priority_Reactor> with the default size.
00040   ACE_Priority_Reactor (ACE_Sig_Handler * = 0,
00041                         ACE_Timer_Queue * = 0);
00042 
00043   /// Initialize <ACE_Priority_Reactor> with size <size>.
00044   ACE_Priority_Reactor (size_t size,
00045                         int restart = 0,
00046                         ACE_Sig_Handler * = 0,
00047                         ACE_Timer_Queue * = 0);
00048 
00049   /// Close down the select_reactor and release all of its resources.
00050   virtual ~ACE_Priority_Reactor (void);
00051 
00052   /// Dump the state of an object.
00053   void dump (void) const;
00054 
00055   /// Declare the dynamic allocation hooks.
00056   ACE_ALLOC_HOOK_DECLARE;
00057 
00058 protected:
00059   // = Dispatching methods.
00060 
00061   /// We simply override this function to implement the priority
00062   /// dispatching.
00063   virtual int dispatch_io_set (int number_of_active_handles,
00064                                int &number_dispatched,
00065                                int mask,
00066                                ACE_Handle_Set &dispatch_mask,
00067                                ACE_Handle_Set &ready_mask,
00068                                ACE_EH_PTMF callback);
00069 
00070 private:
00071   /// A small helper to initialize the bucket.
00072   void init_bucket (void);
00073 
00074   /// There is a queue per-priority, which simply holds the
00075   /// Event_Handlers until we know who goes first.
00076   typedef ACE_Unbounded_Queue<ACE_Event_Tuple> QUEUE;
00077   QUEUE** bucket_;
00078 
00079   /// The queues themselves use this allocator to minimize dynamic
00080   /// memory usage.
00081   ACE_Allocator* tuple_allocator_;
00082 
00083   /// Deny access since member-wise won't work...
00084   ACE_Priority_Reactor (const ACE_Select_Reactor &);
00085   ACE_Priority_Reactor &operator = (const ACE_Select_Reactor &);
00086 };
00087 
00088 #include "ace/post.h"
00089 #endif /* ACE_PRIORITY_REACTOR_H */

Generated on Mon Jun 16 11:20:52 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002