Dynamic_Implementation.h

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

Generated on Tue Feb 2 17:43:23 2010 for TAO_DynamicInterface by  doxygen 1.4.7