Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tao / Reply_Dispatcher.h
blob6b8e940de516661832b54fd32c2090515241dfab
1 // -*- C++ -*-
3 //=============================================================================
4 /**
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)
21 # 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
31 class ACE_Allocator;
32 ACE_END_VERSIONED_NAMESPACE_DECL
35 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
37 // Forward Declarations.
38 class TAO_Pluggable_Reply_Params;
40 /**
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
53 * Transport object.
55 class TAO_Export TAO_Reply_Dispatcher
57 public:
58 /// Constructor.
59 TAO_Reply_Dispatcher (ACE_Allocator *allocator = 0);
61 /// Destructor.
62 virtual ~TAO_Reply_Dispatcher ();
64 /**
65 * Dispatch the reply. Return 1 on sucess, -1 on error.
66 * @todo Pluggable Messaging: this method has too many arguments,
67 * the "Right Thing"[tm] is for the Transport Object to create a
68 * "ClientReply" that encapsulates all we need to process a
69 * reply. Naturally it is possible that different messaging
70 * protocols implement different variants of such ClientReply
71 * class.
73 virtual int dispatch_reply (TAO_Pluggable_Reply_Params &params) = 0;
75 /// Inform that the reply timed out
76 virtual void reply_timed_out () = 0;
78 /**
79 * The used for the pending reply has been closed.
80 * No reply is expected.
81 * @todo If the connection was closed due to a CloseConnection
82 * message then we could re-issue the request instead of raising
83 * the exception, it would a matter of simply adding a boolean
84 * argument to this function.
86 virtual void connection_closed () = 0;
88 /// Get the locate reply status.
89 GIOP::LocateStatusType locate_reply_status () const;
91 GIOP::ReplyStatusType reply_status () const;
93 static void intrusive_add_ref (TAO_Reply_Dispatcher*);
94 static void intrusive_remove_ref (TAO_Reply_Dispatcher*);
96 protected:
97 /// LocateReply status.
98 GIOP::LocateStatusType locate_reply_status_;
100 // RequestReply status
101 GIOP::ReplyStatusType reply_status_;
103 private:
104 /// Support for intrusive reference counting
105 std::atomic<uint32_t> refcount_;
107 /// Allocator that was used to allocate this reply dispatcher. In case of
108 /// zero we come from the heap.
109 ACE_Allocator *allocator_;
112 TAO_END_VERSIONED_NAMESPACE_DECL
114 #if defined (__ACE_INLINE__)
115 #include "tao/Reply_Dispatcher.inl"
116 #endif /* __ACE_INLINE__ */
118 #include /**/ "ace/post.h"
120 #endif /* TAO_REPLY_DISPATCHER_H */