Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tao / Resume_Handle.h
bloba9f863cfc68285db5537772a354b789084c64837
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Resume_Handle.h
7 * @author Balachandran Natarajan <bala@cs.wustl.edu>
8 */
9 //=============================================================================
11 #ifndef TAO_RESUME_HANDLE_H
12 #define TAO_RESUME_HANDLE_H
14 #include /**/ "ace/pre.h"
16 #include /**/ "tao/TAO_Export.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include /**/ "tao/Versioned_Namespace.h"
24 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
26 class TAO_ORB_Core;
28 /**
29 * @class TAO_Resume_Handle
31 * @brief A utility class that helps in resuming handlers if TAO uses
32 * a TP Reactor from ACE.
34 * Please read the documentation in the bugzilla #575 in the bugzilla
35 * database what we mean by handler resumption.
37 * When TAO uses a TP reactor, it takes care of resuming the handler
38 * once it makes sure that it has read the whole message out of the
39 * socket. During the process of reading the transport object would
40 * have to deal with errors in 'read' from the socket, or errors in
41 * the messages that has been received. Instead of calling
42 * resume_handler () on the reactor at every point in the code, we
43 * use this utility class to take care of the resumption.
45 class TAO_Export TAO_Resume_Handle
47 public:
48 /// Constructor.
49 TAO_Resume_Handle (TAO_ORB_Core *orb_core = 0,
50 ACE_HANDLE h = ACE_INVALID_HANDLE);
51 /// Destructor
52 ~TAO_Resume_Handle ();
54 enum TAO_Handle_Resume_Flag
56 TAO_HANDLE_RESUMABLE = 0,
57 TAO_HANDLE_ALREADY_RESUMED,
58 TAO_HANDLE_LEAVE_SUSPENDED
61 /// Allow the users of this class to change the underlying flag.
62 void set_flag (TAO_Handle_Resume_Flag fl);
64 /// Assignment operator
65 TAO_Resume_Handle &operator= (const TAO_Resume_Handle &rhs);
67 /// Resume the handle in the reactor only if the ORB uses a TP
68 /// reactor. Else we don't resume the handle.
69 void resume_handle ();
71 /// Hook method called at the end of a connection handler's
72 /// handle_input function. Might override the handle_input
73 /// return value or change the resume_handler's flag_ value.
74 void handle_input_return_value_hook (int& return_value);
76 private:
77 /// Our ORB Core.
78 TAO_ORB_Core *orb_core_;
80 /// The actual handle that needs resumption..
81 ACE_HANDLE handle_;
83 /// The flag for indicating whether the handle has been resumed or
84 /// not. A value of '0' indicates that the handle needs resumption.
85 TAO_Handle_Resume_Flag flag_;
88 TAO_END_VERSIONED_NAMESPACE_DECL
90 #if defined (__ACE_INLINE__)
91 # include "tao/Resume_Handle.inl"
92 #endif /* __ACE_INLINE__ */
94 #include /**/ "ace/post.h"
96 #endif /*TAO_RESUME_HANDLE*/