Wait_Strategy.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Wait_Strategy.h
00006  *
00007  *  $Id: Wait_Strategy.h 76687 2007-01-29 19:18:13Z johnnyw $
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, int two_way);
00058 
00059   /// Base class virtual method. Wait till the @c reply_received flag is
00060   /// true or the time expires.
00061   virtual int wait (ACE_Time_Value *max_wait_time,
00062                     TAO_Synch_Reply_Dispatcher &rd) = 0;
00063 
00064   /// Register the handler needs with the reactor provided that it makes
00065   /// sense for the  strategy.
00066   virtual int register_handler (void) = 0;
00067 
00068   /// Returns a value to indicate whether the transport needs to set
00069   /// the socket on which it is waiting to non-blocking mode or not.
00070   virtual bool non_blocking (void) const = 0;
00071 
00072   /// Flag that indicates whether we can process requests while
00073   /// waiting for the reply.
00074   /**
00075    * This flag is to check whether the thread can process upcalls
00076    * while waiting for the reply. Some wait strategies, like
00077    * Wait_On_LF_No_Upcall does not allow the client threads to process
00078    * requests while waiting for the reply.
00079    */
00080   virtual bool can_process_upcalls (void) const = 0;
00081 
00082   /// Get method for the flag
00083   bool is_registered (void) const;
00084 
00085   /// Set method for the flag
00086   void is_registered (bool flag);
00087 
00088 protected:
00089   /// Transport object.
00090   TAO_Transport *transport_;
00091 
00092   /// Flag to indicate whether the service handler that created the
00093   /// above transport has been registered with the reactor or not. The
00094   /// default is false.
00095   bool is_registered_;
00096 };
00097 
00098 TAO_END_VERSIONED_NAMESPACE_DECL
00099 
00100 
00101 #if defined (__ACE_INLINE__)
00102 # include "tao/Wait_Strategy.inl"
00103 #endif /* __ACE_INLINE__ */
00104 
00105 #include /**/ "ace/post.h"
00106 
00107 #endif /* TAO_WAIT_STRATEGY_H */

Generated on Tue Feb 2 17:37:53 2010 for TAO by  doxygen 1.4.7