00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Wait_Strategy.h 00006 * 00007 * Wait_Strategy.h,v 1.35 2006/06/20 06:02:15 jwillemsen Exp 00008 * 00009 * @author Alexander Babu Arulanthu <alex@cs.wustl.edu> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_WAIT_STRATEGY_H 00014 #define TAO_WAIT_STRATEGY_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "tao/orbconf.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "tao/TAO_Export.h" 00025 00026 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00027 class ACE_Time_Value; 00028 ACE_END_VERSIONED_NAMESPACE_DECL 00029 00030 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00031 00032 class TAO_ORB_Core; 00033 class TAO_Transport; 00034 class TAO_Synch_Reply_Dispatcher; 00035 00036 /** 00037 * @class TAO_Wait_Strategy 00038 * 00039 * @brief Strategy for waiting for the reply. 00040 * 00041 */ 00042 class TAO_Export TAO_Wait_Strategy 00043 { 00044 00045 public: 00046 /// Constructor. 00047 TAO_Wait_Strategy (TAO_Transport *transport); 00048 00049 /// Destructor. 00050 virtual ~TAO_Wait_Strategy (void); 00051 00052 /** 00053 * The user is going to send a request, prepare any internal 00054 * variables because the reply may arrive *before* the user calls 00055 * wait. 00056 */ 00057 virtual int sending_request (TAO_ORB_Core *orb_core, 00058 int two_way); 00059 00060 /// Base class virtual method. Wait till the @c reply_received flag is 00061 /// true or the time expires. 00062 virtual int wait (ACE_Time_Value *max_wait_time, 00063 TAO_Synch_Reply_Dispatcher &rd) = 0; 00064 00065 /// Register the handler needs with the reactor provided that it makes 00066 /// sense for the strategy. 00067 virtual int register_handler (void) = 0; 00068 00069 /// Returns a value to indicate whether the transport needs to set 00070 /// the socket on which it is waiting to non-blocking mode or not. 00071 virtual bool non_blocking (void) const = 0; 00072 00073 /// Flag that indicates whether we can process requests while 00074 /// waiting for the reply. 00075 /** 00076 * This flag is to check whether the thread can process upcalls 00077 * while waiting for the reply. Some wait strategies, like 00078 * Wait_On_LF_No_Upcall does not allow the client threads to process 00079 * requests while waiting for the reply. 00080 */ 00081 virtual bool can_process_upcalls (void) const = 0; 00082 00083 /// Get method for the flag 00084 bool is_registered (void) const; 00085 00086 /// Set method for the flag 00087 void is_registered (bool flag); 00088 00089 protected: 00090 /// Transport object. 00091 TAO_Transport *transport_; 00092 00093 /// Flag to indicate whether the service handler that created the 00094 /// above transport has been registered with the reactor or not. The 00095 /// default is false. 00096 bool is_registered_; 00097 }; 00098 00099 TAO_END_VERSIONED_NAMESPACE_DECL 00100 00101 00102 #if defined (__ACE_INLINE__) 00103 # include "tao/Wait_Strategy.inl" 00104 #endif /* __ACE_INLINE__ */ 00105 00106 #include /**/ "ace/post.h" 00107 00108 #endif /* TAO_WAIT_STRATEGY_H */