Resume_Handle.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file Resume_Handle.h
00006  *
00007  *  Resume_Handle.h,v 1.14 2006/04/11 16:36:14 zhangw Exp
00008  *
00009  *  @author Balachandran Natarajan <bala@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef TAO_RESUME_HANDLE_H
00014 #define TAO_RESUME_HANDLE_H
00015 
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "tao/TAO_Export.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "tao/Versioned_Namespace.h"
00025 
00026 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00027 
00028 class TAO_ORB_Core;
00029 
00030 /**
00031  * @class TAO_Resume_Handle
00032  *
00033  * @brief A utility class that helps in resuming handlers if TAO uses
00034  *  a TP Reactor from ACE.
00035  *
00036  * Please read the documentation in the bugzilla #575 in the bugzilla
00037  * database what we mean by handler resumption.
00038  *
00039  * When TAO uses a TP reactor, it takes care of resuming the handler
00040  * once it makes sure that it has read the whole message out of the
00041  * socket. During the process of reading the transport object would
00042  * have to deal with errors in 'read' from the socket, or errors in
00043  * the messages that has been received. Instead of calling
00044  * resume_handler () on the reactor at every point in the code, we
00045  * use this utility class to take care of the resumption.
00046  */
00047 
00048 class TAO_Export TAO_Resume_Handle
00049 {
00050 
00051 public:
00052 
00053   /// Ctor.
00054   TAO_Resume_Handle (TAO_ORB_Core *orb_core = 0,
00055                      ACE_HANDLE h = ACE_INVALID_HANDLE);
00056   /// Dtor
00057   ~TAO_Resume_Handle (void);
00058 
00059   enum TAO_Handle_Resume_Flag
00060   {
00061     TAO_HANDLE_RESUMABLE = 0,
00062     TAO_HANDLE_ALREADY_RESUMED,
00063     TAO_HANDLE_LEAVE_SUSPENDED
00064   };
00065 
00066   /// Allow the users of this class to change the underlying flag.
00067   void set_flag (TAO_Handle_Resume_Flag fl);
00068 
00069   /// Assignment operator
00070   TAO_Resume_Handle &operator= (const TAO_Resume_Handle &rhs);
00071 
00072   /// Resume the handle in the reactor only if the ORB uses a TP
00073   /// reactor. Else we don't resume the handle.
00074   void resume_handle (void);
00075 
00076   // Hook method called at the end of a connection handler's
00077   // handle_input function.  Might override the handle_input
00078   // return value or change the resume_handler's flag_ value.
00079   void handle_input_return_value_hook (int& return_value);
00080 
00081 
00082 private:
00083 
00084   /// Our ORB Core.
00085   TAO_ORB_Core *orb_core_;
00086 
00087   /// The actual handle that needs resumption..
00088   ACE_HANDLE handle_;
00089 
00090   /// The flag for indicating whether the handle has been resumed or
00091   /// not. A value of '0' indicates that the handle needs resumption.
00092   TAO_Handle_Resume_Flag flag_;
00093 };
00094 
00095 TAO_END_VERSIONED_NAMESPACE_DECL
00096 
00097 #if defined (__ACE_INLINE__)
00098 # include "tao/Resume_Handle.inl"
00099 #endif /* __ACE_INLINE__ */
00100 
00101 #include /**/ "ace/post.h"
00102 
00103 #endif /*TAO_RESUME_HANDLE*/

Generated on Thu Nov 9 11:54:21 2006 for TAO by doxygen 1.3.6