3 //=============================================================================
5 * @file Reply_Dispatcher.h
7 * Define the interface for the Reply_Dispatcher strategies.
9 * @author Alexander Babu Arulanthu <alex@cs.wustl.edu>
11 //=============================================================================
13 #ifndef TAO_REPLY_DISPATCHER_H
14 #define TAO_REPLY_DISPATCHER_H
16 #include /**/ "ace/pre.h"
18 #include /**/ "tao/TAO_Export.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 #include "tao/Basic_Types.h"
25 #include "tao/GIOPC.h"
27 #include "ace/Atomic_Op.h"
28 #include "ace/Intrusive_Auto_Ptr.h"
30 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
32 ACE_END_VERSIONED_NAMESPACE_DECL
35 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
37 // Forward Declarations.
38 class TAO_Pluggable_Reply_Params
;
41 * @class TAO_Reply_Dispatcher
43 * Different invocation modes process the Reply messages in
44 * different ways. Traditional synchronous replies simply receive
45 * the message and wake up the waiting thread (if any).
46 * Asynchronous Method Invocation (Callbacks) must process the
47 * message in the thread that receives it.
48 * Deferred Synchronous (DII) and AMI in the Poller mode save the
49 * reply for later processing in the application.
50 * The lower level components in the ORB only deal with this
51 * abstract interface, when the invocation is made the right type
52 * of Reply Dispatcher is instantiated and registered with the
55 class TAO_Export TAO_Reply_Dispatcher
60 TAO_Reply_Dispatcher (ACE_Allocator
*allocator
= 0);
63 virtual ~TAO_Reply_Dispatcher ();
66 * Dispatch the reply. Return 1 on sucess, -1 on error.
67 * @todo Pluggable Messaging: this method has too many arguments,
68 * the "Right Thing"[tm] is for the Transport Object to create a
69 * "ClientReply" that encapsulates all we need to process a
70 * reply. Naturally it is possible that different messaging
71 * protocols implement different variants of such ClientReply
74 virtual int dispatch_reply (TAO_Pluggable_Reply_Params
¶ms
) = 0;
76 /// Inform that the reply timed out
77 virtual void reply_timed_out () = 0;
80 * The used for the pending reply has been closed.
81 * No reply is expected.
82 * @todo If the connection was closed due to a CloseConnection
83 * message then we could re-issue the request instead of raising
84 * the exception, it would a matter of simply adding a boolean
85 * argument to this function.
87 virtual void connection_closed () = 0;
89 /// Get the locate reply status.
90 GIOP::LocateStatusType
locate_reply_status () const;
92 GIOP::ReplyStatusType
reply_status () const;
94 static void intrusive_add_ref (TAO_Reply_Dispatcher
*);
95 static void intrusive_remove_ref (TAO_Reply_Dispatcher
*);
98 /// LocateReply status.
99 GIOP::LocateStatusType locate_reply_status_
;
101 // RequestReply status
102 GIOP::ReplyStatusType reply_status_
;
105 /// Support for intrusive reference counting
106 std::atomic
<uint32_t> refcount_
;
108 /// Allocator that was used to allocate this reply dispatcher. In case of
109 /// zero we come from the heap.
110 ACE_Allocator
*allocator_
;
113 TAO_END_VERSIONED_NAMESPACE_DECL
115 #if defined (__ACE_INLINE__)
116 #include "tao/Reply_Dispatcher.inl"
117 #endif /* __ACE_INLINE__ */
119 #include /**/ "ace/post.h"
121 #endif /* TAO_REPLY_DISPATCHER_H */