00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Messaging_Policy_i.h 00006 * 00007 * $Id: Messaging_Policy_i.h 82353 2008-07-22 10:12:29Z johnnyw $ 00008 * 00009 * @author Carlos O'Ryan (coryan@cs.wustl.edu) 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_MESSAGING_POLICY_I_H 00014 #define TAO_MESSAGING_POLICY_I_H 00015 #include /**/ "ace/pre.h" 00016 00017 #include "tao/orbconf.h" 00018 #include "tao/Messaging/Messaging.h" 00019 #include "tao/LocalObject.h" 00020 00021 #if defined(_MSC_VER) 00022 #pragma warning(push) 00023 #pragma warning(disable:4250) 00024 #endif /* _MSC_VER */ 00025 00026 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00027 00028 #if (TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1) 00029 00030 /* 00031 * @class TAO_RelativeRoundtripTimeoutPolicy 00032 * 00033 * @brief Messaging::RelativeRoundtripTimeoutPolicy implementation 00034 * 00035 * This policy controls the total (round-trip) timeout time for a 00036 * request. 00037 */ 00038 class TAO_RelativeRoundtripTimeoutPolicy 00039 : public Messaging::RelativeRoundtripTimeoutPolicy, 00040 public ::CORBA::LocalObject 00041 { 00042 00043 public: 00044 /// Constructor. 00045 TAO_RelativeRoundtripTimeoutPolicy (const TimeBase::TimeT& relative_expiry); 00046 00047 /// Copy constructor. 00048 TAO_RelativeRoundtripTimeoutPolicy (const TAO_RelativeRoundtripTimeoutPolicy &rhs); 00049 00050 /// Implement the timeout hook, this is set in the ORB_Core at 00051 /// initialization time. 00052 static void hook (TAO_ORB_Core *orb_core, 00053 TAO_Stub *stub, 00054 bool &has_timeout, 00055 ACE_Time_Value &time_value); 00056 00057 /// Helper method for the implementation of 00058 /// CORBA::ORB::create_policy. 00059 static CORBA::Policy_ptr create (const CORBA::Any& val); 00060 00061 /// Returns a copy of <this>. 00062 virtual TAO_RelativeRoundtripTimeoutPolicy *clone (void) const; 00063 00064 // = The Messaging::RelativeRoundtripTimeoutPolicy methods 00065 virtual TimeBase::TimeT relative_expiry (void); 00066 00067 virtual CORBA::PolicyType policy_type (void); 00068 00069 virtual CORBA::Policy_ptr copy (void); 00070 00071 virtual void destroy (void); 00072 00073 /// Change the CORBA representation to the ACE representation. 00074 void set_time_value (ACE_Time_Value &time_value); 00075 00076 // Return the cached policy type for this policy. 00077 virtual TAO_Cached_Policy_Type _tao_cached_type (void) const; 00078 00079 private: 00080 /// The attribute 00081 TimeBase::TimeT relative_expiry_; 00082 }; 00083 00084 #endif /* TAO_HAS_RELATIVE_ROUNDTRIP_TIMEOUT_POLICY == 1 */ 00085 00086 //////////////////////////////////////////////////////////////////////////////// 00087 00088 #if (TAO_HAS_SYNC_SCOPE_POLICY == 1) 00089 00090 /* 00091 * @class TAO_Sync_Scope_Policy 00092 * 00093 * @brief Messaging::SyncScopePolicy implementation. 00094 * 00095 * This policy controls the sync strategy used by the ORB to transport 00096 * requests. 00097 */ 00098 class TAO_Messaging_Export TAO_Sync_Scope_Policy 00099 : public Messaging::SyncScopePolicy, 00100 public ::CORBA::LocalObject 00101 { 00102 00103 public: 00104 /// Constructor. 00105 TAO_Sync_Scope_Policy (Messaging::SyncScope synchronization); 00106 00107 /// Copy constructor. 00108 TAO_Sync_Scope_Policy (const TAO_Sync_Scope_Policy &rhs); 00109 00110 /// Implement the Sync_Scope hook, this is set in the ORB_Core at 00111 /// initialization time. 00112 static void hook (TAO_ORB_Core *orb_core, 00113 TAO_Stub *stub, 00114 bool &has_synchronization, 00115 Messaging::SyncScope &scope); 00116 00117 /// Helper method for the implementation of 00118 /// CORBA::ORB::create_policy. 00119 static CORBA::Policy_ptr create (const CORBA::Any& val); 00120 00121 /// Returns a copy of <this>. 00122 virtual TAO_Sync_Scope_Policy *clone (void) const; 00123 00124 // = The Messaging::SyncScopePolicy methods. 00125 00126 virtual Messaging::SyncScope synchronization (void); 00127 00128 void get_synchronization (Messaging::SyncScope &synchronization) const; 00129 00130 virtual CORBA::PolicyType policy_type (void); 00131 00132 virtual CORBA::Policy_ptr copy (void); 00133 00134 virtual void destroy (void); 00135 00136 // Return the cached policy type for this policy. 00137 virtual TAO_Cached_Policy_Type _tao_cached_type (void) const; 00138 private: 00139 00140 /// The attribute 00141 Messaging::SyncScope synchronization_; 00142 }; 00143 00144 #endif /* TAO_HAS_SYNC_SCOPE_POLICY == 1 */ 00145 00146 TAO_END_VERSIONED_NAMESPACE_DECL 00147 00148 #if defined (__ACE_INLINE__) 00149 #include "tao/Messaging/Messaging_Policy_i.inl" 00150 #endif /* __ACE_INLINE__ */ 00151 00152 #if defined(_MSC_VER) 00153 #pragma warning(pop) 00154 #endif /* _MSC_VER */ 00155 00156 #include /**/ "ace/post.h" 00157 #endif /* TAO_MESSAGING_POLICY_I_H */