00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Reply_Dispatcher.h 00006 * 00007 * $Id: Reply_Dispatcher.h 85012 2009-04-02 10:05:46Z msmit $ 00008 * 00009 * Define the interface for the Reply_Dispatcher strategies. 00010 * 00011 * 00012 * @author Alexander Babu Arulanthu <alex@cs.wustl.edu> 00013 */ 00014 //============================================================================= 00015 00016 #ifndef TAO_REPLY_DISPATCHER_H 00017 #define TAO_REPLY_DISPATCHER_H 00018 00019 #include /**/ "ace/pre.h" 00020 00021 #include /**/ "tao/TAO_Export.h" 00022 00023 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00024 # pragma once 00025 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00026 00027 #include "tao/Basic_Types.h" 00028 #include "tao/GIOPC.h" 00029 00030 #include "ace/Atomic_Op.h" 00031 #include "ace/Intrusive_Auto_Ptr.h" 00032 00033 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00034 class ACE_Allocator; 00035 ACE_END_VERSIONED_NAMESPACE_DECL 00036 00037 00038 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00039 00040 // Forward Declarations. 00041 class TAO_Pluggable_Reply_Params; 00042 00043 /** 00044 * @class TAO_Reply_Dispatcher 00045 * 00046 * Different invocation modes process the Reply messages in 00047 * different ways. Traditional synchronous replies simply receive 00048 * the message and wake up the waiting thread (if any). 00049 * Asynchronous Method Invocation (Callbacks) must process the 00050 * message in the thread that receives it. 00051 * Deferred Synchronous (DII) and AMI in the Poller mode save the 00052 * reply for later processing in the application. 00053 * The lower level components in the ORB only deal with this 00054 * abstract interface, when the invocation is made the right type 00055 * of Reply Dispatcher is instantiated and registered with the 00056 * Transport object. 00057 */ 00058 class TAO_Export TAO_Reply_Dispatcher 00059 { 00060 00061 public: 00062 /// Constructor. 00063 TAO_Reply_Dispatcher (ACE_Allocator *allocator = 0); 00064 00065 /// Destructor. 00066 virtual ~TAO_Reply_Dispatcher (void); 00067 00068 /** 00069 * Dispatch the reply. Return 1 on sucess, -1 on error. 00070 * @todo Pluggable Messaging: this method has too many arguments, 00071 * the "Right Thing"[tm] is for the Transport Object to create a 00072 * "ClientReply" that encapsulates all we need to process a 00073 * reply. Naturally it is possible that different messaging 00074 * protocols implement different variants of such ClientReply 00075 * class. 00076 */ 00077 virtual int dispatch_reply (TAO_Pluggable_Reply_Params ¶ms) = 0; 00078 00079 /// Inform that the reply timed out 00080 virtual void reply_timed_out (void) = 0; 00081 00082 /** 00083 * The used for the pending reply has been closed. 00084 * No reply is expected. 00085 * @todo If the connection was closed due to a CloseConnection 00086 * message then we could re-issue the request instead of raising 00087 * the exception, it would a matter of simply adding a boolean 00088 * argument to this function. 00089 */ 00090 virtual void connection_closed (void) = 0; 00091 00092 /// Get the locate reply status. 00093 GIOP::LocateStatusType locate_reply_status (void) const; 00094 00095 GIOP::ReplyStatusType reply_status (void) const; 00096 00097 static void intrusive_add_ref (TAO_Reply_Dispatcher*); 00098 static void intrusive_remove_ref (TAO_Reply_Dispatcher*); 00099 00100 protected: 00101 /// LocateReply status. 00102 GIOP::LocateStatusType locate_reply_status_; 00103 00104 // RequestReply status 00105 GIOP::ReplyStatusType reply_status_; 00106 00107 private: 00108 /// Support for intrusive reference counting 00109 ACE_Atomic_Op<TAO_SYNCH_MUTEX, long> refcnt_; 00110 00111 /// Allocator that was used to allocate this reply dispatcher. In case of 00112 /// zero we come from the heap. 00113 ACE_Allocator *allocator_; 00114 }; 00115 00116 TAO_END_VERSIONED_NAMESPACE_DECL 00117 00118 #if defined (__ACE_INLINE__) 00119 #include "tao/Reply_Dispatcher.inl" 00120 #endif /* __ACE_INLINE__ */ 00121 00122 #include /**/ "ace/post.h" 00123 00124 #endif /* TAO_REPLY_DISPATCHER_H */