00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Messaging_Queueing_Strategies.h 00006 * 00007 * $Id: Messaging_Queueing_Strategies.h 79231 2007-08-06 18:32:54Z johnnyw $ 00008 * 00009 * Queueing strategies for the ORB Messaging layer. 00010 * 00011 * @author Irfan Pyarali 00012 */ 00013 //============================================================================= 00014 00015 00016 #ifndef TAO_MESSAGING_QUEUEING_STRATEGIES_H 00017 #define TAO_MESSAGING_QUEUEING_STRATEGIES_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/orbconf.h" 00028 #include "tao/Basic_Types.h" 00029 #include "tao/Transport_Queueing_Strategies.h" 00030 00031 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00032 00033 namespace TAO 00034 { 00035 struct BufferingConstraint; 00036 } 00037 00038 namespace TimeBase 00039 { 00040 typedef CORBA::ULongLong TimeT; 00041 } 00042 00043 namespace TAO 00044 { 00045 #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1) 00046 00047 class Eager_Transport_Queueing_Strategy : public Transport_Queueing_Strategy 00048 { 00049 public: 00050 virtual bool must_queue (bool queue_empty) const; 00051 00052 virtual bool buffering_constraints_reached ( 00053 TAO_Stub *stub, 00054 size_t msg_count, 00055 size_t total_bytes, 00056 bool &must_flush, 00057 const ACE_Time_Value ¤t_deadline, 00058 bool &set_timer, 00059 ACE_Time_Value &new_deadline) const; 00060 00061 private: 00062 /// Check if the buffering constraint includes any timeouts and 00063 /// compute the right timeout interval if needed. 00064 /** 00065 * @param buffering_constraint The constraints defined by the 00066 * application 00067 * @param current_deadline The current deadline 00068 * @param set_timer Return true if the timer should be set 00069 * @param new_deadline Return the timer interval value 00070 * 00071 * @return Returns true if the deadline has already expired and 00072 * flushing must commence immediately. If the function 00073 * returns false then flushing may need to be delayed, use @c 00074 * set_timer and 00075 */ 00076 bool timer_check (const TAO::BufferingConstraint &buffering_constraint, 00077 const ACE_Time_Value ¤t_deadline, 00078 bool &set_timer, 00079 ACE_Time_Value &new_deadline) const; 00080 00081 /// Convert from standard CORBA time units to seconds/microseconds. 00082 ACE_Time_Value time_conversion (const TimeBase::TimeT &time) const; 00083 }; 00084 00085 /// Delay the buffering decision until the transport blocks 00086 /** 00087 * If the queue is empty the transport will try to send immediately. 00088 */ 00089 class Delayed_Transport_Queueing_Strategy 00090 : public Eager_Transport_Queueing_Strategy 00091 { 00092 public: 00093 virtual bool must_queue (bool queue_empty) const; 00094 }; 00095 00096 #endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */ 00097 00098 } 00099 00100 TAO_END_VERSIONED_NAMESPACE_DECL 00101 00102 #include /**/ "ace/post.h" 00103 00104 #endif /* TAO_MESSAGING_QUEUEING_STRATEGIES_H */