Use =default for skeleton copy constructor
[ACE_TAO.git] / TAO / tests / Strategies / client.cpp
bloba236a8e1d9f2ad660405b5ffd757c2ea53fdf0f7
1 #include "ace/Get_Opt.h"
2 #include "ace/Task.h"
3 #include "simple_testC.h"
5 const ACE_TCHAR *ior = ACE_TEXT("file://test.ior");
6 int server_shutdown = 0;
8 int
9 parse_args (int argc, ACE_TCHAR *argv[])
11 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:x"));
12 int c;
14 while ((c = get_opts ()) != -1)
15 switch (c)
17 case 'k':
18 ior = get_opts.opt_arg ();
19 break;
20 case 'x':
21 server_shutdown = 1;
22 break;
24 case '?':
25 default:
26 ACE_ERROR_RETURN ((LM_ERROR,
27 "usage: %s "
28 "-k <ior> "
29 "\n",
30 argv [0]),
31 -1);
33 // Indicates successful parsing of the command line
34 return 0;
37 class Client
39 // = TITLE
40 // Defines a class that is used to test and understand the
41 // different ways of loading the default and advanced TAO
42 // strategies.
44 // = DESCRIPTION
45 // A simple client which receives the CORBA boolean variabel
46 // from the server to indicate that everything went on good.
48 public:
49 Client ();
50 // ctor
53 // ****************************************************************
55 Client::Client ()
59 int
60 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
62 try
64 CORBA::ORB_var orb =
65 CORBA::ORB_init (argc, argv);
67 if (parse_args (argc, argv) != 0)
68 return 1;
70 CORBA::Object_var object =
71 orb->string_to_object (ior);
73 Simple_Server_var server =
74 Simple_Server::_narrow (object.in ());
76 if (CORBA::is_nil (server.in ()))
78 ACE_ERROR_RETURN ((LM_ERROR,
79 "Object reference <%s> is nil.\n",
80 ior),
81 1);
84 // Invoke a request on the server
85 CORBA::Boolean ret_value =
86 server->print_status ();
88 if (ret_value == 0)
90 ACE_DEBUG ((LM_DEBUG,
91 "The server has been contacted !!\n",
92 0));
95 if (server_shutdown)
97 server->shutdown ();
100 orb->destroy ();
102 catch (const CORBA::Exception& ex)
104 ex._tao_print_exception ("Caught exception:");
105 return 1;
108 return 0;