Abstract_Servant_Base.h

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

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