summaryrefslogtreecommitdiff
path: root/ace/Event_Handler_T.h
diff options
context:
space:
mode:
Diffstat (limited to 'ace/Event_Handler_T.h')
-rw-r--r--ace/Event_Handler_T.h125
1 files changed, 61 insertions, 64 deletions
diff --git a/ace/Event_Handler_T.h b/ace/Event_Handler_T.h
index 0ba36bf27ac..92d54b7dffe 100644
--- a/ace/Event_Handler_T.h
+++ b/ace/Event_Handler_T.h
@@ -1,18 +1,15 @@
/* -*- C++ -*- */
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// ace
-//
-// = FILENAME
-// Event_Handler_T.h
-//
-// = AUTHOR
-// Doug Schmidt
-//
-// ============================================================================
+
+//=============================================================================
+/**
+ * @file Event_Handler_T.h
+ *
+ * $Id$
+ *
+ * @author Doug Schmidt
+ */
+//=============================================================================
+
#ifndef ACE_EVENT_HANDLER_T_H
#define ACE_EVENT_HANDLER_T_H
@@ -26,45 +23,45 @@
#if defined (ACE_HAS_TEMPLATE_TYPEDEFS)
+/**
+ * @class ACE_Event_Handler_T
+ *
+ * @brief Enable a class that doesn't inherit from the
+ * ACE_Event_Handler to be incorporated into the ACE_Reactor
+ * framework. Thanks to Greg Lavender (g.lavender@isode.com)
+ * for sharing this idea.
+ *
+ * It is sometimes the case that an application has a hierarchy
+ * of operation dispatcher classes that have their own
+ * inheritance hierarchy but also would like to integrate with
+ * the ACE_Reactor. Rather than adopt a "mixin" approach, it is
+ * often cleaner to define a template as a subclass of
+ * ACE_Event_Handler and paramterize it with an operation
+ * dispatcher type.
+ * When constructing an instantiation of the ACE_Event_Handler_T
+ * object, a set of pointers to member functions must be
+ * provided so that when one of the handle_* methods is called
+ * by the ACE_Reactor, the appropriate method is called on the
+ * underlying operations object. This is done since in some
+ * cases it is useful to map any event that happens to the same
+ * method on an object.
+ * The ACE_Event_Handler_T template is instantiated by an
+ * operations object and registered with the ACE_Reactor, and it
+ * then calls the appropriate op_handler. So, it's basically
+ * just another level of indirection in event dispatching. The
+ * coupling betweent the ultimate handler of the event and the
+ * ACE_Event_Handler class is relaxed a bit by have this
+ * intermediate <op_handler_> object of type <T> around. The
+ * client object can then dynamically change the bindings for
+ * the various handlers so that during the life of one of the
+ * operation objects, it can change how it wants events to be
+ * handled. It just instantiates a new instance of the template
+ * with different bindings and reregisters this new object with
+ * the ACE_Reactor.
+ */
template <class T>
class ACE_Event_Handler_T : public ACE_Event_Handler
{
- // = TITLE
- // Enable a class that doesn't inherit from the
- // ACE_Event_Handler to be incorporated into the ACE_Reactor
- // framework. Thanks to Greg Lavender (g.lavender@isode.com)
- // for sharing this idea.
- //
- // = DESCRIPTION
- // It is sometimes the case that an application has a hierarchy
- // of operation dispatcher classes that have their own
- // inheritance hierarchy but also would like to integrate with
- // the ACE_Reactor. Rather than adopt a "mixin" approach, it is
- // often cleaner to define a template as a subclass of
- // ACE_Event_Handler and paramterize it with an operation
- // dispatcher type.
- //
- // When constructing an instantiation of the ACE_Event_Handler_T
- // object, a set of pointers to member functions must be
- // provided so that when one of the handle_* methods is called
- // by the ACE_Reactor, the appropriate method is called on the
- // underlying operations object. This is done since in some
- // cases it is useful to map any event that happens to the same
- // method on an object.
- //
- // The ACE_Event_Handler_T template is instantiated by an
- // operations object and registered with the ACE_Reactor, and it
- // then calls the appropriate op_handler. So, it's basically
- // just another level of indirection in event dispatching. The
- // coupling betweent the ultimate handler of the event and the
- // ACE_Event_Handler class is relaxed a bit by have this
- // intermediate <op_handler_> object of type <T> around. The
- // client object can then dynamically change the bindings for
- // the various handlers so that during the life of one of the
- // operation objects, it can change how it wants events to be
- // handled. It just instantiates a new instance of the template
- // with different bindings and reregisters this new object with
- // the ACE_Reactor.
public:
// = Typedefs to simplify pointer-to-member-function registration.
@@ -72,18 +69,19 @@ public:
typedef ACE_HANDLE (T::*GET_HANDLE) (void) const;
typedef void (T::*SET_HANDLE) (ACE_HANDLE);
+ /// Handle I/O events.
typedef int (T::*IO_HANDLER) (ACE_HANDLE);
- // Handle I/O events.
+ /// Handle timeout events.
typedef int (T::*TO_HANDLER) (const ACE_Time_Value &, const void *);
- // Handle timeout events.
+ /// Handle close events.
typedef int (T::*CL_HANDLER) (ACE_HANDLE, ACE_Reactor_Mask);
- // Handle close events.
+ /// = Initialization and termination methods.
typedef int (T::*SIG_HANDLER) (ACE_HANDLE, siginfo_t*, ucontext_t*);
- // = Initialization and termination methods.
+ /// Initialize the op_handler.
ACE_Event_Handler_T (T *op_handler,
int delete_handler,
GET_HANDLE get_handle = 0,
@@ -94,10 +92,9 @@ public:
IO_HANDLER output = 0,
SET_HANDLE set_handle = 0,
IO_HANDLER except = 0);
- // Initialize the op_handler.
+ /// Close down and delete the <op_handler>
~ACE_Event_Handler_T (void);
- // Close down and delete the <op_handler>
// = Override all the ACE_Event_Handler methods.
@@ -141,33 +138,33 @@ public:
SIG_HANDLER sig_handler (void);
void sig_handler (SIG_HANDLER);
+ /// Dump the state of an object.
void dump (void) const;
- // Dump the state of an object.
+ /// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
- // Declare the dynamic allocation hooks.
protected:
+ /// Pointer to the object that handles all the delegated operations.
T *op_handler_;
- // Pointer to the object that handles all the delegated operations.
// = Handle input, output, and exception events.
IO_HANDLER input_handler_;
IO_HANDLER output_handler_;
IO_HANDLER except_handler_;
+ /// Handle timeout events.
TO_HANDLER to_handler_;
- // Handle timeout events.
+ /// Handle close events.
CL_HANDLER cl_handler_;
- // Handle close events.
+ /// Handle signal events.
SIG_HANDLER sig_handler_;
- // Handle signal events.
+ /// Keeps track of whether we need to delete the handler in the
+ /// destructor.
int delete_handler_;
- // Keeps track of whether we need to delete the handler in the
- // destructor.
// = Get/set underlying handle.
SET_HANDLE set_handle_;