2 //=============================================================================
6 * The classe define the templates for the client and server.
8 * @author Balachandran Natarajan <bala@cs.wustl.edu>
10 //=============================================================================
16 #include "tao/Utils/ORB_Manager.h"
17 #include "ace/Get_Opt.h"
18 #include "ace/Read_Buffer.h"
23 * @brief A set of useful class Templates for using the TAO CORBA
26 * A template server definition. This template can be used by
27 * single server/client projects for definition of their
28 * server/clients. See the directories time, bank, echo for
29 * further details of implemenatation.
31 template <class Servant
>
41 /// Initialize the Server state - parsing arguments and waiting.
42 /// interface_name is the name used to register the Servant.
43 int init (const char *servant_name
,
47 // int register_name ();
48 // After calling <init>, this method will register the server with
49 // the TAO Naming Service using the servant_name passed to <init>.
58 /// name of the servant to be used for TAO Naming Service
61 /// Parses the commandline arguments.
64 /// The ORB manager - a helper class for accessing the POA and
65 /// registering objects.
66 TAO_ORB_Manager orb_manager_
;
68 /// File where the IOR of the server object is stored.
69 FILE *ior_output_file_
;
71 /// Memory pool name that stores the state
72 ACE_TCHAR
* mem_pool_name_
;
74 /// Number of command line arguments.
77 /// The command line arguments.
82 // Client Class starts here
87 * @brief Template Client class
89 * A template client implementation for a single server/client
90 * model. The example usage of these usage can be found in the
91 * sub-directories below
93 template <class InterfaceObj
, class Var
>
103 /// Initialize the client communication endpoint with server.
104 int init (const char *name
,int argc
, ACE_TCHAR
*argv
[]);
106 /// Return the interface object pointer.
107 InterfaceObj
*operator-> () { return server_
.in ();};
109 /// Returns the shutdown flag.
112 /// Fills in the shutdwon flag.
115 /// Initialize naming service
116 int obtain_initial_references ();
119 /// Function to read the server IOR from a file.
120 int read_ior (ACE_TCHAR
*filename
);
122 /// Parses the arguments passed on the command line.
125 /// Remember our orb.
128 /// # of arguments on the command line.
131 /// arguments from command line.
134 /// IOR of the obj ref of the server.
137 /// Flag to use the naming service
140 /// Flag for shutting down the server
147 #include "Simple_util.cpp"
149 #endif /* TAO_UTIL_H */