00001 // -*- C++ -*- 00002 // 00003 // Dynamic_Implementation.h,v 1.14 2006/03/10 07:19:08 jtc Exp 00004 00005 // ============================================================================ 00006 // 00007 // = LIBRARY 00008 // DynamicInterface 00009 // 00010 // = FILENAME 00011 // Dynamic_Implementation.h 00012 // 00013 // = DESCRIPTION 00014 // Header file for class TAO_DynamicImplementation. 00015 // 00016 // = AUTHOR 00017 // Irfan Pyarali <irfan@cs.wustl.edu> 00018 // 00019 // ============================================================================ 00020 00021 #ifndef TAO_DYNAMIC_IMPLEMENTATION_H 00022 #define TAO_DYNAMIC_IMPLEMENTATION_H 00023 00024 #include /**/ "ace/pre.h" 00025 00026 #include "tao/DynamicInterface/dynamicinterface_export.h" 00027 00028 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00029 # pragma once 00030 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00031 00032 #include "tao/PortableServer/Servant_Base.h" 00033 00034 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00035 00036 namespace CORBA 00037 { 00038 typedef char *RepositoryId; 00039 typedef String_var RepositoryId_var; 00040 00041 class ServerRequest; 00042 typedef ServerRequest *ServerRequest_ptr; 00043 } 00044 00045 /** 00046 * @class TAO_DynamicImplementation 00047 * 00048 * @brief Base class for DSI. 00049 * 00050 * It is expected that the <invoke> and <_primary_interface> 00051 * methods will be only invoked by the POA in the context of 00052 * serving a CORBA request. Invoking this method in other 00053 * circumstances may lead to unpredictable results. 00054 */ 00055 class TAO_DynamicInterface_Export TAO_DynamicImplementation 00056 : public virtual TAO_ServantBase 00057 { 00058 public: 00059 /// The invoke() method receives requests issued to any CORBA object 00060 /// incarnated by the DSI servant and performs the processing 00061 /// necessary to execute the request. 00062 virtual void invoke (CORBA::ServerRequest_ptr request 00063 ACE_ENV_ARG_DECL_WITH_DEFAULTS) = 0; 00064 00065 /// The _primary_interface() method receives an ObjectId value and a 00066 /// POA_ptr as input parameters and returns a valid RepositoryId 00067 /// representing the most-derived interface for that oid. 00068 virtual CORBA::RepositoryId _primary_interface ( 00069 const PortableServer::ObjectId &oid, 00070 PortableServer::POA_ptr poa 00071 ACE_ENV_ARG_DECL_WITH_DEFAULTS 00072 ) = 0; 00073 00074 /// Local implementation of the CORBA::Object::_is_a method. 00075 virtual CORBA::Boolean _is_a (const char *logical_type_id 00076 ACE_ENV_ARG_DECL_WITH_DEFAULTS); 00077 00078 /// Returns a CORBA::Object_ptr for the target object. 00079 CORBA::Object_ptr _this (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); 00080 00081 /// Query the Interface Repository for the interface definition. 00082 virtual CORBA::InterfaceDef_ptr _get_interface ( 00083 ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS 00084 ); 00085 00086 protected: 00087 00088 /// Return 0. Should never be used. 00089 virtual const char *_interface_repository_id (void) const; 00090 00091 /// Simply returns "this" 00092 virtual void *_downcast (const char *repository_id); 00093 00094 /// This is an auxiliary method for _this() and _narrow(). 00095 virtual TAO_Stub *_create_stub (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); 00096 00097 /// Turns around and calls invoke. 00098 virtual void _dispatch (TAO_ServerRequest &request, 00099 void *context 00100 ACE_ENV_ARG_DECL_WITH_DEFAULTS); 00101 00102 private: 00103 /// Encapsulates code common to _is_a(), _get_interface() and _create_stub(). 00104 CORBA::RepositoryId get_id_from_primary_interface ( 00105 ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS 00106 ); 00107 }; 00108 00109 TAO_END_VERSIONED_NAMESPACE_DECL 00110 00111 #include /**/ "ace/post.h" 00112 00113 #endif /* TAO_DYNAMIC_IMPLEMENTATION_H */