Resume_Handle.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file Resume_Handle.h
00006  *
00007  *  $Id: Resume_Handle.h 80288 2007-12-17 20:05:04Z johnnyw $
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 private:
00082 
00083   /// Our ORB Core.
00084   TAO_ORB_Core *orb_core_;
00085 
00086   /// The actual handle that needs resumption..
00087   ACE_HANDLE handle_;
00088 
00089   /// The flag for indicating whether the handle has been resumed or
00090   /// not. A value of '0' indicates that the handle needs resumption.
00091   TAO_Handle_Resume_Flag flag_;
00092 };
00093 
00094 TAO_END_VERSIONED_NAMESPACE_DECL
00095 
00096 #if defined (__ACE_INLINE__)
00097 # include "tao/Resume_Handle.inl"
00098 #endif /* __ACE_INLINE__ */
00099 
00100 #include /**/ "ace/post.h"
00101 
00102 #endif /*TAO_RESUME_HANDLE*/

Generated on Tue Feb 2 17:37:52 2010 for TAO by  doxygen 1.4.7