Use override/default for RTPortableServer
[ACE_TAO.git] / ACE / ace / Priority_Reactor.h
blob7368579d702b6e331b4702d9668c2595842ff3b7
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Priority_Reactor.h
7 * @author Carlos O'Ryan <coryan@uci.edu>
8 */
9 //=============================================================================
11 #ifndef ACE_PRIORITY_REACTOR_H
12 #define ACE_PRIORITY_REACTOR_H
13 #include /**/ "ace/pre.h"
15 #include /**/ "ace/ACE_export.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 # pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "ace/Select_Reactor.h"
22 #include "ace/Unbounded_Queue.h"
24 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
26 /**
27 * @class ACE_Priority_Reactor
29 * @brief Implements priority based dispatching.
31 * This class refines the dispatching mechanism for the
32 * Select_Reactor by taking advantage of the priority method on
33 * ACE_Event_Handler.
35 class ACE_Export ACE_Priority_Reactor : public ACE_Select_Reactor
37 public:
38 /// Initialize ACE_Priority_Reactor with the default size.
39 ACE_Priority_Reactor (ACE_Sig_Handler * = 0,
40 ACE_Timer_Queue * = 0);
42 /// Initialize ACE_Priority_Reactor with size @a size.
43 ACE_Priority_Reactor (size_t size,
44 bool restart = false,
45 ACE_Sig_Handler * = 0,
46 ACE_Timer_Queue * = 0);
48 /// Close down the select_reactor and release all of its resources.
49 virtual ~ACE_Priority_Reactor ();
51 /// Dump the state of an object.
52 void dump () const;
54 /// Declare the dynamic allocation hooks.
55 ACE_ALLOC_HOOK_DECLARE;
57 protected:
58 // = Dispatching methods.
60 /// We simply override this function to implement the priority
61 /// dispatching.
62 virtual int dispatch_io_set (int number_of_active_handles,
63 int &number_dispatched,
64 int mask,
65 ACE_Handle_Set &dispatch_mask,
66 ACE_Handle_Set &ready_mask,
67 ACE_EH_PTMF callback);
69 private:
70 /// A small helper to initialize the bucket.
71 void init_bucket ();
73 /// Build the bucket from the given dispatch_mask. Return -1 on
74 /// failure, 0 otherwise.
75 int build_bucket (ACE_Handle_Set& dispatch_mask,
76 int &min_priority,
77 int &max_priority);
79 /// There is a queue per-priority, which simply holds the
80 /// Event_Handlers until we know who goes first.
81 typedef ACE_Unbounded_Queue<ACE_Event_Tuple> QUEUE;
82 QUEUE** bucket_;
84 /// The queues themselves use this allocator to minimize dynamic
85 /// memory usage.
86 ACE_Allocator* tuple_allocator_;
88 /// Deny access since member-wise won't work...
89 ACE_Priority_Reactor (const ACE_Priority_Reactor &);
90 ACE_Priority_Reactor &operator = (const ACE_Priority_Reactor &);
93 ACE_END_VERSIONED_NAMESPACE_DECL
95 #include /**/ "ace/post.h"
96 #endif /* ACE_PRIORITY_REACTOR_H */