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 (void);
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.
62 int parse_args (void);
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.
83 // Client Class starts here
88 * @brief Template Client class
90 * A template client implementation for a single server/client
91 * model. The example usage of these usage can be found in the
92 * sub-directories below
94 template <class InterfaceObj
, class Var
>
104 /// Initialize the client communication endpoint with server.
105 int init (const char *name
,int argc
, ACE_TCHAR
*argv
[]);
107 /// Return the interface object pointer.
108 InterfaceObj
*operator-> () { return server_
.in ();};
110 /// Returns the shutdown flag.
111 int shutdown (void );
113 /// Fills in the shutdwon flag.
116 /// Initialize naming service
117 int obtain_initial_references (void);
120 /// Function to read the server IOR from a file.
121 int read_ior (ACE_TCHAR
*filename
);
123 /// Parses the arguments passed on the command line.
124 int parse_args (void);
126 /// Remember our orb.
129 /// # of arguments on the command line.
132 /// arguments from command line.
135 /// IOR of the obj ref of the server.
138 /// Flag to use the naming service
141 /// Flag for shutting down the server
148 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
149 #include "Simple_util.cpp"
150 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
151 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
152 #pragma implementation ("Simple_util.cpp")
153 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
155 #endif /* TAO_UTIL_H */