Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tao / DynamicInterface / Dynamic_Implementation.h
blobf9381bf0b36ac92d8f33b558139a38a54f31a15c
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Dynamic_Implementation.h
7 * Header file for class TAO_DynamicImplementation.
9 * @author Irfan Pyarali <irfan@cs.wustl.edu>
11 //=============================================================================
14 #ifndef TAO_DYNAMIC_IMPLEMENTATION_H
15 #define TAO_DYNAMIC_IMPLEMENTATION_H
17 #include /**/ "ace/pre.h"
19 #include "tao/DynamicInterface/dynamicinterface_export.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 # pragma once
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 #include "tao/PortableServer/Servant_Base.h"
27 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
29 namespace CORBA
31 typedef char *RepositoryId;
32 typedef String_var RepositoryId_var;
34 class ServerRequest;
35 typedef ServerRequest *ServerRequest_ptr;
38 /**
39 * @class TAO_DynamicImplementation
41 * @brief Base class for DSI.
43 * It is expected that the <invoke> and <_primary_interface>
44 * methods will be only invoked by the POA in the context of
45 * serving a CORBA request. Invoking this method in other
46 * circumstances may lead to unpredictable results.
48 class TAO_DynamicInterface_Export TAO_DynamicImplementation
49 : public virtual TAO_ServantBase
51 public:
52 /// The invoke() method receives requests issued to any CORBA object
53 /// incarnated by the DSI servant and performs the processing
54 /// necessary to execute the request.
55 virtual void invoke (CORBA::ServerRequest_ptr request) = 0;
57 /// The _primary_interface() method receives an ObjectId value and a
58 /// POA_ptr as input parameters and returns a valid RepositoryId
59 /// representing the most-derived interface for that oid.
60 virtual CORBA::RepositoryId _primary_interface (
61 const PortableServer::ObjectId &oid,
62 PortableServer::POA_ptr poa) = 0;
64 /// Local implementation of the CORBA::Object::_is_a method.
65 virtual CORBA::Boolean _is_a (const char *logical_type_id);
67 /// Returns a CORBA::Object_ptr for the target object.
68 CORBA::Object_ptr _this ();
70 /// Query the Interface Repository for the interface definition.
71 virtual CORBA::InterfaceDef_ptr _get_interface ();
73 protected:
74 /// Return 0. Should never be used.
75 virtual const char *_interface_repository_id () const;
77 /// Simply returns "this"
78 virtual void *_downcast (const char *repository_id);
80 /// This is an auxiliary method for _this() and _narrow().
81 virtual TAO_Stub *_create_stub ();
83 /// Turns around and calls invoke.
84 virtual void _dispatch (
85 TAO_ServerRequest &request,
86 TAO::Portable_Server::Servant_Upcall *context);
88 private:
89 /// Encapsulates code common to _is_a(), _get_interface() and _create_stub().
90 CORBA::RepositoryId get_id_from_primary_interface ();
93 TAO_END_VERSIONED_NAMESPACE_DECL
95 #include /**/ "ace/post.h"
97 #endif /* TAO_DYNAMIC_IMPLEMENTATION_H */