3 //=============================================================================
5 * @file Asynch_Reply_Dispatcher_Base.h
7 * @author Alexander Babu Arulanthu <alex@cs.wustl.edu>
8 * @author Jeff Parsons <parsons@cs.wustl.edu>
10 //=============================================================================
12 #ifndef TAO_ASYNCH_REPLY_DISPATCHER_BASE_H
13 #define TAO_ASYNCH_REPLY_DISPATCHER_BASE_H
15 #include /**/ "ace/pre.h"
17 #include "tao/Reply_Dispatcher.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
26 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
30 ACE_END_VERSIONED_NAMESPACE_DECL
32 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
34 class TAO_Pluggable_Reply_Params
;
38 * @class TAO_Asynch_Reply_Dispatcher_Base
40 * @brief Base class for TAO_Asynch_Reply_Dispatcher and
41 * TAO_DII_Deferred_Reply_Dispatcher
43 class TAO_Export TAO_Asynch_Reply_Dispatcher_Base
44 : public TAO_Reply_Dispatcher
47 /// Default constructor.
48 TAO_Asynch_Reply_Dispatcher_Base (TAO_ORB_Core
*orb_core
,
49 ACE_Allocator
*allocator
= 0);
51 /// Sets the transport for this invocation.
52 void transport (TAO_Transport
*t
);
54 /// Install the timeout handler
55 virtual long schedule_timer (CORBA::ULong
, const ACE_Time_Value
&) = 0;
58 /// A helper method that can be used by the subclasses
60 * The semantics of this helper method needs careful attention. A
61 * call to this method will do the following
63 * - If the reply has already been dispatched, the return value
64 * will be false to signify not to try.
66 * - If the reply has not been dispatched, this method will set
67 * the flag to be true and return a true value to signify that
68 * the caller thread can go ahead and dispatch reply.
70 * Why are we clumping everything in one method. Answer is we need
73 bool try_dispatch_reply ();
77 virtual ~TAO_Asynch_Reply_Dispatcher_Base ();
80 void operator= (const TAO_Asynch_Reply_Dispatcher_Base
&);
81 TAO_Asynch_Reply_Dispatcher_Base (const TAO_Asynch_Reply_Dispatcher_Base
&);
84 /// The service context list.
86 * Note, that this is not a reference as in
87 * the synchronous case. We own the reply_service_info
88 * because our TAO_Asynch_Invocation or TAO_DII_Deferred_Invocation
89 * will go out of scope before we are done.
91 IOP::ServiceContextList reply_service_info_
;
93 /// The buffer that is used to initialise the data block
94 char buf_
[ACE_CDR::DEFAULT_BUFSIZE
];
96 /// Datablock that is created on the stack to initialise the CDR
97 /// stream underneath.
100 /// CDR stream which has the reply information that needs to be
101 /// demarshalled by the stubs
102 TAO_InputCDR reply_cdr_
;
104 /// This invocation is using this transport, may change...
105 TAO_Transport
*transport_
;
108 /// Lock to protect @c is_reply_dispatched_ flag.
111 /// Has the reply been dispatched?
112 bool is_reply_dispatched_
;
118 * @class ARDB_Refcount_Functor
120 * @brief Functor for refcounting of Asynch_Reply_Dispatcher_Base
122 * This is used to safely handle the destruction of
123 * Asynch_Reply_Dispatcher_Base objects which are created on the
124 * heap. We cannot use auto_ptr <> since it calls delete on the
125 * pointer, and calling delete on Asynch_Reply_Dispatcher_Base *
126 * will not work. Hence this functor will be used with Auto_Functor
127 * class to handle the memory safely.
129 * @todo Ideally, this class can be a generic class. But that
130 * requires quite a bit of cleanup within TAO to be more useful.
132 class TAO_Export ARDB_Refcount_Functor
135 void operator() (TAO_Asynch_Reply_Dispatcher_Base
*ardb
) noexcept
;
139 TAO_END_VERSIONED_NAMESPACE_DECL
141 #if defined (__ACE_INLINE__)
142 #include "tao/Asynch_Reply_Dispatcher_Base.inl"
143 #endif /* __ACE_INLINE__ */
145 #include /**/ "ace/post.h"
146 #endif /* TAO_ASYNCH_REPLY_DISPATCHER_BASE_H */