Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / POA / On_Demand_Loading / Servant_Locator.h
blob7b744cafac926260120b81fe7130e55b97225732
1 //=============================================================================
2 /**
3 * @file Servant_Locator.h
5 * Defines a ServantLocator_i class , used with a POA having
6 * a NON_RETAIN policy.
8 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
9 */
10 //=============================================================================
12 #ifndef SERVANT_LOCATOR_H
13 #define SERVANT_LOCATOR_H
15 #include "ace/DLL.h"
17 #include "Servant_Manager.h"
18 #include "tao/PortableServer/ServantLocatorC.h"
19 #include "tao/LocalObject.h"
21 class ServantLocator_i :
22 public virtual PortableServer::ServantLocator,
23 public virtual ::CORBA::LocalObject
26 // = TITLE
27 // This class is used by a POA with USE_SERVANT_MANAGER and
28 // NON_RETAIN policy.
30 // = DESCRIPTION
31 // This class defines the Servant Locator interface of the Servant
32 // Manager. It is invoked when the POA has an USE_SERVANT_MANAGER
33 // policy and a servant_retention policy of NON_RETAIN type.
34 public:
35 /// Constructor.
36 ServantLocator_i (CORBA::ORB_ptr orb);
38 /**
39 * This method is invoked by a POA whenever it receives a request
40 * for test object that is not currently active. When the POA is
41 * created using the NON_RETAIN policy the Active Object Map is not
42 * maintained, in other words, an association between the ObjectId
43 * and the servant is not maintained. Hence every client request the
44 * servant has to be loaded. Note the operation argument. This
45 * argument specifies the operation to be invoked on the
46 * servant. The cookie helps in marking the servant. This marking is
47 * useful while destroying the servant.
49 virtual PortableServer::Servant preinvoke (const PortableServer::ObjectId &oid,
50 PortableServer::POA_ptr adapter,
51 const char *operation,
52 PortableServer::ServantLocator::Cookie &the_cookie);
54 /**
55 * This method is invoked whenever a test servant completes a
56 * request. As the Servant Loactor interface is used when the POA
57 * doesnt maintain the Active Object Map, its necessary to get rid
58 * of the servant after the client request has been processed. The
59 * appropriate servant is destroyed by verifying the cookie.Again
60 * this method is invoked per client request.
62 virtual void postinvoke (const PortableServer::ObjectId &oid,
63 PortableServer::POA_ptr adapter,
64 const char *operation,
65 PortableServer::ServantLocator::Cookie the_cookie,
66 PortableServer::Servant the_servant);
68 /// Returns an ObjectId when given an dll name and the factory method
69 /// to be invoked in the dll.
70 PortableServer::ObjectId_var create_dll_object_id (const char *dllname,
71 const char *factory_function);
72 private:
73 /**
74 * The <ServantManager_i> object that provides utility methods. The
75 * methods include obtaining the servant using an ACE_DLL object,
76 * destroying the servant and extracting the dllname and factory
77 * function from the ObjectId.
79 ServantManager_i servant_manager_;
82 #endif /* SERVANT_LOCATOR_H */