Abstract_Servant_Base.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Abstract_Servant_Base.h
00006  *
00007  *  Abstract_Servant_Base.h,v 1.24 2006/06/19 14:51:11 parsons Exp
00008  *
00009  *  This files contains the TAO_Abstract_ServantBase, which is used
00010  *  as a way to decuple the PortableServer from the TAO Core,
00011  *  and make it possible to keep the reference to the servant in
00012  *  the CORBA::Object class.
00013  *
00014  *  @author  Angelo Corsaro <corsaro@cs.wustl.edu>
00015  */
00016 //=============================================================================
00017 
00018 #ifndef TAO_ABSTRACT_SERVANT_BASE_H_
00019 #define TAO_ABSTRACT_SERVANT_BASE_H_
00020 
00021 #include /**/ "ace/pre.h"
00022 
00023 #include "ace/CORBA_macros.h"
00024 
00025 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00026 # pragma once
00027 #endif /* ACE_LACKS_PRAGMA_ONCE */
00028 
00029 #include "tao/TAO_Export.h"
00030 #include "tao/Basic_Types.h"
00031 #include "tao/Collocation_Strategy.h"
00032 #include "tao/CORBA_methods.h"
00033 #include "tao/Pseudo_VarOut_T.h"
00034 
00035 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00036 
00037 class TAO_ServerRequest;
00038 class TAO_Stub;
00039 class TAO_Abstract_ServantBase;
00040 
00041 namespace CORBA
00042 {
00043   class InterfaceDef;
00044   typedef InterfaceDef *InterfaceDef_ptr;
00045 
00046   class Environment;
00047 
00048   class Object;
00049   typedef Object *Object_ptr;
00050   typedef TAO_Pseudo_Var_T<Object> Object_var;
00051   typedef TAO_Pseudo_Out_T<Object> Object_out;
00052 }
00053 
00054 namespace TAO
00055 {
00056   class Argument;
00057 }
00058 
00059 typedef void (*TAO_Skeleton)(
00060     TAO_ServerRequest &,
00061     void *,
00062     void *
00063 #if !defined (TAO_HAS_EXCEPTIONS) || defined (ACE_ENV_BKWD_COMPAT)
00064     , CORBA::Environment &
00065 #endif
00066   );
00067 
00068 typedef void (*TAO_Collocated_Skeleton)(
00069     TAO_Abstract_ServantBase *,
00070     TAO::Argument **,
00071     int
00072 #if !defined (TAO_HAS_EXCEPTIONS) || defined (ACE_ENV_BKWD_COMPAT)
00073     , CORBA::Environment &
00074 #endif
00075   );
00076 
00077 class TAO_Export TAO_Abstract_ServantBase
00078 {
00079 public:
00080   /// Destructor
00081   virtual ~TAO_Abstract_ServantBase (void);
00082 
00083   /// Local implementation of the CORBA::Object::_is_a method.
00084   virtual CORBA::Boolean _is_a (const char* logical_type_id
00085                                 ACE_ENV_ARG_DECL) = 0;
00086 
00087   /// Default @c _non_existent: always returns false.
00088   virtual CORBA::Boolean _non_existent (
00089     ACE_ENV_SINGLE_ARG_DECL) = 0;
00090 
00091   /// Query the Interface Repository.
00092   virtual CORBA::InterfaceDef_ptr _get_interface (
00093       ACE_ENV_SINGLE_ARG_DECL
00094     ) = 0;
00095 
00096   /// Default @c_get_component: always returns nil.
00097   virtual CORBA::Object_ptr _get_component (
00098     ACE_ENV_SINGLE_ARG_DECL) = 0;
00099 
00100   /// Default @c_repository_id
00101   virtual char * _repository_id (
00102     ACE_ENV_SINGLE_ARG_DECL) = 0;
00103 
00104   //@{
00105   /**
00106    * @name Reference Counting Operations
00107    */
00108   /// Increase reference count by one.
00109   virtual void _add_ref (
00110     ACE_ENV_SINGLE_ARG_DECL) = 0;
00111 
00112   /**
00113    * Decreases reference count by one; if the resulting reference
00114    * count equals zero, _remove_ref invokes delete on its this pointer
00115    * in order to destroy the servant.
00116    */
00117   virtual void _remove_ref (
00118     ACE_ENV_SINGLE_ARG_DECL) = 0;
00119 
00120   /// Returns the current reference count value.
00121   virtual CORBA::ULong _refcount_value (
00122     ACE_ENV_SINGLE_ARG_DECL) const = 0;
00123   //@}
00124 
00125   /// This is an auxiliary method for _this() and _narrow().
00126   virtual TAO_Stub *_create_stub (ACE_ENV_SINGLE_ARG_DECL) = 0;
00127 
00128   /// Find an operation in the operation table and return a
00129   /// TAO_Skeleton which can be used to make upcalls
00130   virtual int _find (const char *opname,
00131                      TAO_Skeleton &skelfunc,
00132                      const size_t length = 0) = 0;
00133 
00134   /// Find an operation in the operation table and return a
00135   /// TAO_Collocated_Skeleton which can be used to make upcalls onto
00136   /// collocated servants.
00137   virtual int _find (const char *opname,
00138                      TAO_Collocated_Skeleton &skelfunc,
00139                      TAO::Collocation_Strategy s,
00140                      const size_t length = 0) = 0;
00141 
00142 protected:
00143 
00144   /// Default constructor, only derived classes can be created.
00145   TAO_Abstract_ServantBase (void);
00146 
00147   /// Copy constructor, protected so no instances can be created.
00148   TAO_Abstract_ServantBase (const TAO_Abstract_ServantBase &);
00149 
00150   /// Assignment operator.
00151   TAO_Abstract_ServantBase &operator= (const TAO_Abstract_ServantBase &);
00152 
00153   /// Dispatches a request to the object
00154   /**
00155    * Find the operation, cast the type to the most derived type,
00156    * demarshall all the parameters from the request and finally
00157    * invokes the operation, storing the results and out parameters (if
00158    * any) or the exceptions thrown into @a request.
00159    */
00160   virtual void _dispatch (TAO_ServerRequest &request,
00161                           void *servant_upcall
00162                           ACE_ENV_ARG_DECL) = 0;
00163 
00164   virtual void synchronous_upcall_dispatch (TAO_ServerRequest &req,
00165                                             void *servant_upcall,
00166                                             void *derived_this
00167                                             ACE_ENV_ARG_DECL) = 0;
00168 
00169   /// Get this interface's repository id (TAO specific).
00170   virtual const char *_interface_repository_id (void) const = 0;
00171 
00172 };
00173 
00174 TAO_END_VERSIONED_NAMESPACE_DECL
00175 
00176 #include /**/ "ace/post.h"
00177 
00178 #endif /* TAO_ABSTRACT_SERVANT_BASE_H_ */

Generated on Thu Nov 9 11:54:07 2006 for TAO by doxygen 1.3.6