Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / ace / TkReactor / TkReactor.h
blob489c7a9ce080c65a081c48416c57628bc98596e3
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file TkReactor.h
7 * @author Nagarajan Surendran <naga@cs.wustl.edu>
8 */
9 //=============================================================================
12 #ifndef ACE_TKREACTOR_H
13 #define ACE_TKREACTOR_H
14 #include /**/ "ace/pre.h"
16 #include /**/ "ace/config-all.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "ace/TkReactor/ACE_TkReactor_export.h"
23 #include "ace/Select_Reactor.h"
24 #include /**/ <tk.h>
26 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
28 /**
29 * @class ACE_TkReactorID
31 * @brief This little class is necessary due to the way that Microsoft
32 * implements sockets to be pointers rather than indices.
34 class ACE_TkReactor_Export ACE_TkReactorID
36 public:
37 /// Underlying handle.
38 ACE_HANDLE handle_;
40 /// Pointer to next node in the linked list.
41 ACE_TkReactorID *next_;
44 class ACE_TkReactor;
46 class ACE_TkReactor_Export ACE_TkReactor_Input_Callback
48 public:
49 ACE_TkReactor *reactor_;
50 ACE_HANDLE handle_;
53 /**
54 * @class ACE_TkReactor
56 * @brief An object-oriented event demultiplexor and event handler
57 * dispatcher that uses the Tk functions.
59 class ACE_TkReactor_Export ACE_TkReactor : public ACE_Select_Reactor
61 public:
62 ACE_TkReactor (size_t size = DEFAULT_SIZE,
63 bool restart = false,
64 ACE_Sig_Handler * = 0);
66 virtual ~ACE_TkReactor ();
68 // = Timer operations.
69 virtual long schedule_timer (ACE_Event_Handler *event_handler,
70 const void *arg,
71 const ACE_Time_Value &delay,
72 const ACE_Time_Value &interval);
73 virtual int reset_timer_interval (long timer_id,
74 const ACE_Time_Value &interval);
75 virtual int cancel_timer (ACE_Event_Handler *handler,
76 int dont_call_handle_close = 1);
77 virtual int cancel_timer (long timer_id,
78 const void **arg = 0,
79 int dont_call_handle_close = 1);
81 protected:
82 // = Register timers/handles with Tk.
83 /// Register a single @a handler.
84 virtual int register_handler_i (ACE_HANDLE handle,
85 ACE_Event_Handler *handler,
86 ACE_Reactor_Mask mask);
88 /// Register a set of <handlers>.
89 virtual int register_handler_i (const ACE_Handle_Set &handles,
90 ACE_Event_Handler *handler,
91 ACE_Reactor_Mask mask);
93 /// Remove the @a handler associated with this @a handle.
94 virtual int remove_handler_i (ACE_HANDLE handle,
95 ACE_Reactor_Mask mask);
97 /// Remove a set of <handles>.
98 virtual int remove_handler_i (const ACE_Handle_Set &handles,
99 ACE_Reactor_Mask);
101 /// Removes an Tk FileHandler.
102 virtual void remove_TkFileHandler (ACE_HANDLE handle);
104 /// Wait for events to occur.
105 virtual int wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &,
106 ACE_Time_Value *);
108 ///Wait for Tk events to occur.
109 virtual int TkWaitForMultipleEvents (int,
110 ACE_Select_Reactor_Handle_Set &,
111 ACE_Time_Value *);
113 ACE_TkReactorID *ids_;
114 Tk_TimerToken timeout_;
116 private:
117 /// This method ensures there's a Tk timeout for the first timeout in
118 /// the Reactor's Timer_Queue.
119 void reset_timeout ();
121 // = Integrate with the X callback function mechanism.
122 static void TimerCallbackProc (ClientData cd);
123 static void InputCallbackProc (ClientData cd,int mask);
125 /// Deny access since member-wise won't work...
126 ACE_TkReactor (const ACE_TkReactor &);
127 ACE_TkReactor &operator = (const ACE_TkReactor &);
130 ACE_END_VERSIONED_NAMESPACE_DECL
132 #include /**/ "ace/post.h"
133 #endif /* ACE_TK_REACTOR_H */