Synch_Invocation.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 //=============================================================================
00004 /**
00005  *  @file    Synch_Invocation.h
00006  *
00007  *  $Id: Synch_Invocation.h 81632 2008-05-07 09:19:05Z vzykov $
00008  *
00009  *
00010  *  @author Balachandran Natarajan <bala@dre.vanderbilt.edu>
00011  */
00012 //=============================================================================
00013 #ifndef TAO_SYNCH_INVOCATION_H
00014 #define TAO_SYNCH_INVOCATION_H
00015 #include /**/ "ace/pre.h"
00016 
00017 #include "tao/Remote_Invocation.h"
00018 
00019 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00020 # pragma once
00021 #endif /* ACE_LACKS_PRAGMA_ONCE */
00022 
00023 #include "tao/orbconf.h"
00024 
00025 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00026 class ACE_Time_Value;
00027 ACE_END_VERSIONED_NAMESPACE_DECL
00028 
00029 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00030 
00031 class TAO_Operation_Details;
00032 class TAO_Synch_Reply_Dispatcher;
00033 class TAO_InputCDR;
00034 class TAO_Bind_Dispatcher_Guard;
00035 
00036 namespace TAO
00037 {
00038   class Profile_Transport_Resolver;
00039 
00040   /**
00041    * @class Synch_Twoway_Invocation
00042    *
00043    * @brief All the action for a synchronous twoway invocation happen
00044    * here.
00045    *
00046    * An object of this type is created by TAO::Invocation_Adapter
00047    * and invokes a method on this class. The method takes care of
00048    * creating and sending a request, waiting for a reply and
00049    * demarshalling the reply for the client.
00050    *
00051    */
00052   class TAO_Export Synch_Twoway_Invocation : public Remote_Invocation
00053   {
00054   public:
00055     /// Constructor used by TAO::Invocation_Adapter
00056     /**
00057      * @param otarget The original target on which this invocation
00058      * was started. This is there to be passed up to its parent
00059      * class.
00060      *
00061      * @param resolver The profile and transport holder.
00062      *
00063      * @param detail Operation details of the invocation on the target
00064      *
00065      * @param response_expected Flag to indicate whether the
00066      * operation encapsulated by @a op returns a response or not.
00067      */
00068     Synch_Twoway_Invocation (CORBA::Object_ptr otarget,
00069                              Profile_Transport_Resolver &resolver,
00070                              TAO_Operation_Details &detail,
00071                              bool response_expected = true);
00072 
00073     /// Method used by the adapter to kickstart an invocation to the
00074     /// remote object.
00075     /**
00076      * There is a exception declaration in this method which ensures
00077      * that the exceptions propogated by the remote objects are
00078      * converted a CORBA exceptions for the clients. This method does
00079      * a bunch of things necessary to create and send the
00080      * invocation. This method is also nerve centre for the
00081      * interceptor invocation points.
00082      */
00083     Invocation_Status remote_twoway (ACE_Time_Value *max_wait_time);
00084 
00085   protected:
00086 
00087     /**
00088      * This method is selectively made virtual, so that inherited
00089      * classes can overload the  user exception handling type. For
00090      * example the DII needs a totally different method of
00091      * user exception exception handling
00092      */
00093     virtual Invocation_Status handle_user_exception (TAO_InputCDR &cdr);
00094 
00095     /// Helper method used to handle location forwarded replies.
00096     Invocation_Status location_forward (TAO_InputCDR &cdr);
00097 
00098     /// Helper method used to handle system exceptions from the remote
00099     /// objects.
00100     Invocation_Status handle_system_exception (TAO_InputCDR &cdr);
00101 
00102     /// As the name suggests waits for a reply from the remote ORB.
00103     /**
00104      * This method returns an exception when there is an error.
00105      */
00106     Invocation_Status wait_for_reply (ACE_Time_Value *max_wait_time,
00107                                       TAO_Synch_Reply_Dispatcher &rd,
00108                                       TAO_Bind_Dispatcher_Guard &bd);
00109 
00110   private:
00111 
00112     /// Helper method that checks the reply status of the
00113     /// replies and takes appropriate action.
00114     /**
00115      * This method returns an exception when there is an error.
00116      */
00117     Invocation_Status check_reply_status (TAO_Synch_Reply_Dispatcher &rd);
00118   };
00119 
00120   /**
00121    * @class Synch_Oneway_Invocation
00122    *
00123    * @brief All the action for a synchronous oneway invocation happen
00124    * here.
00125    *
00126    * This class inherits from twoway invocation for the following
00127    * reasons
00128    *
00129    * - We deal with oneway invocation in more or less the same way as
00130    *   two but for waiting for the reply
00131    *
00132    * - For some SYNC_SCOPE policies namely SYNC_WITH_TARGET and
00133    *   SYNC_WITH_SERVER the invocation classes have to treat the
00134    *   invocation as a twoway invocation (more or less)
00135    *
00136    */
00137   class TAO_Export Synch_Oneway_Invocation
00138     : public Synch_Twoway_Invocation
00139   {
00140   public:
00141     /// Constructor used by TAO::Invocation_Adapter
00142     /**
00143      * @param otarget The original target on which this invocation
00144      * was started. This is there to be passed up to its parent
00145      * class.
00146      *
00147      * @param resolver The profile and transport holder.
00148      *
00149      * @param detail Operation details of the invocation on the target
00150      */
00151     Synch_Oneway_Invocation (CORBA::Object_ptr otarget,
00152                              Profile_Transport_Resolver &resolver,
00153                              TAO_Operation_Details &detail);
00154 
00155     /// Method used by the adapter to kickstart an oneway invocation
00156     /// to the remote object.
00157     Invocation_Status remote_oneway (ACE_Time_Value *max_wait_time);
00158   };
00159 
00160   /**
00161    * @class Reply_Guard
00162    *
00163    * @brief A guard class used for storing and forwarding the reply
00164    *  status to the portable interceptors.
00165    */
00166   class TAO_Export Reply_Guard
00167   {
00168   public:
00169 
00170     Reply_Guard (Invocation_Base *s, Invocation_Status is);
00171 
00172     /// The destructor calls Invocation_Base::invoke_status with the
00173     /// right invoke status, which is useful for PI's.
00174     ~Reply_Guard (void);
00175 
00176     /// Mutator to set the invocation status.
00177     void set_status (Invocation_Status s);
00178 
00179   private:
00180 
00181     Reply_Guard (Reply_Guard const &);
00182     Reply_Guard & operator= (Reply_Guard const &);
00183 
00184   private:
00185 
00186     Invocation_Base * const invocation_;
00187     Invocation_Status status_;
00188   };
00189 
00190 }
00191 
00192 TAO_END_VERSIONED_NAMESPACE_DECL
00193 
00194 #if defined (__ACE_INLINE__)
00195 # include "tao/Synch_Invocation.inl"
00196 #endif /* __ACE_INLINE__ */
00197 
00198 #include /**/ "ace/post.h"
00199 #endif /*TAO_SYNCH_INVOCATION_H*/

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