Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / POA / Loader / Server_Manager.h
blobfc8944a259fa2724a0a25e295dfe37eb8b4670b2
1 //=============================================================================
2 /**
3 * @file Server_Manager.h
5 * Helper class for the server application.
7 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
8 */
9 //=============================================================================
12 #ifndef SERVER_MANAGER_H
13 #define SERVER_MANAGER_H
15 #include "Servant_Activator.h"
16 #include "Servant_Locator.h"
18 /**
19 * @class Server_i
21 * @brief This class provides the server application with helper methods
23 * The various methods required by the server application for
24 * utilizing the ServantActivator and ServantLocator interfaces of
25 * the Servant Manager are implemented by this class. These
26 * include initialisation procedures of the ServantActivator and
27 * ServantLocator, and creation of POAs with emphasis on the
28 * servant retention policy.
30 class Server_i
32 public:
33 /// Initialisation.
34 Server_i ();
36 /// Destruction.
37 ~Server_i ();
39 /// Initialisation of the ORB and poa.
40 int init (int argc, ACE_TCHAR **argv);
42 /**
43 * This method creates a POA from the root_poa with emphasis being
44 * on the servant_retention_policy which decides the use of the
45 * ServantActivator or ServantLocator interfaces. The
46 * servent_retention_policy value is 1 for the RETAIN policy and 0
47 * for the NONRETAIN policy.
49 PortableServer::POA_ptr create_poa (const char* name,
50 int servant_retention_policy);
52 /// A ServantActivator object is created and initialised.
53 int create_activator (PortableServer::POA_var first_poa);
55 /// A ServantActivator object is created and initialised.
56 int create_locator (PortableServer::POA_var second_poa);
58 /// The server is executed.
59 int run ();
61 private:
62 /// Parses the input arguments.
63 int parse_args (int argc, ACE_TCHAR **argv);
65 /// The IORs are written to a file for future use.
66 int write_iors_to_file (const char *first_ior,
67 const char *second_ior);
69 /// Default ior file.
70 ACE_TCHAR *ior_output_file_;
72 /// The orb pointer.
73 CORBA::ORB_var orb_;
75 /// The poa policicies.
76 CORBA::PolicyList policies_;
78 /// The root_poa which is used for cretaing different child poas.
79 PortableServer::POA_var root_poa_;
81 /// The poa_manager object.
82 PortableServer::POAManager_var poa_manager_;
84 /// The object pointer used by the ServantActivator.
85 CORBA::Object_var first_test_;
87 /// The object pointer used by the Servant Locator.
88 CORBA::Object_var second_test_;
90 /// The servant activator object.
91 ServantActivator *servant_activator_;
93 /// The servant locator object.
94 ServantLocator *servant_locator_;
97 #endif /* SERVER_MANAGER_H */