Updated logging to include the class/method so that it is more obvious where these...
[ACE_TAO.git] / TAO / tao / Resume_Handle.h
blob34ce7fd63d9bd32a95235a8e9bfb373b9c899410
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
48 public:
49 /// Constructor.
50 TAO_Resume_Handle (TAO_ORB_Core *orb_core = 0,
51 ACE_HANDLE h = ACE_INVALID_HANDLE);
52 /// Destructor
53 ~TAO_Resume_Handle (void);
55 enum TAO_Handle_Resume_Flag
57 TAO_HANDLE_RESUMABLE = 0,
58 TAO_HANDLE_ALREADY_RESUMED,
59 TAO_HANDLE_LEAVE_SUSPENDED
62 /// Allow the users of this class to change the underlying flag.
63 void set_flag (TAO_Handle_Resume_Flag fl);
65 /// Assignment operator
66 TAO_Resume_Handle &operator= (const TAO_Resume_Handle &rhs);
68 /// Resume the handle in the reactor only if the ORB uses a TP
69 /// reactor. Else we don't resume the handle.
70 void resume_handle (void);
72 /// Hook method called at the end of a connection handler's
73 /// handle_input function. Might override the handle_input
74 /// return value or change the resume_handler's flag_ value.
75 void handle_input_return_value_hook (int& return_value);
77 private:
79 /// Our ORB Core.
80 TAO_ORB_Core *orb_core_;
82 /// The actual handle that needs resumption..
83 ACE_HANDLE handle_;
85 /// The flag for indicating whether the handle has been resumed or
86 /// not. A value of '0' indicates that the handle needs resumption.
87 TAO_Handle_Resume_Flag flag_;
90 TAO_END_VERSIONED_NAMESPACE_DECL
92 #if defined (__ACE_INLINE__)
93 # include "tao/Resume_Handle.inl"
94 #endif /* __ACE_INLINE__ */
96 #include /**/ "ace/post.h"
98 #endif /*TAO_RESUME_HANDLE*/