Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tests / Objref_Sequence_Test / client.cpp
blob65ad651ab7838680ca3096f9cead08c268389e9f
1 #include "TestC.h"
2 #include "ace/Get_Opt.h"
4 const ACE_TCHAR *ior = ACE_TEXT("file://test.ior");
6 int
7 parse_args (int argc, ACE_TCHAR *argv[])
9 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
10 int c;
12 while ((c = get_opts ()) != -1)
13 switch (c)
15 case 'k':
16 ior = get_opts.opt_arg ();
17 break;
19 case '?':
20 default:
21 ACE_ERROR_RETURN ((LM_ERROR,
22 "usage: %s "
23 "-k <ior> "
24 "\n",
25 argv [0]),
26 -1);
28 // Indicates successful parsing of the command line
29 return 0;
33 int
34 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
36 try
38 CORBA::ORB_var orb =
39 CORBA::ORB_init (argc,
40 argv);
42 if (parse_args (argc, argv) == -1)
43 return -1;
45 // Connect to the server
46 CORBA::Object_var tmp =
47 orb->string_to_object(ior);
49 Server_var server = Server::_narrow (tmp.in ());
51 // Create object instances
52 // This portion of the test was given by Petr Tuma and am just
53 // leaving it alone -- Bala
54 ServerSequence_var vServers;
55 ServerSequence_var vAddition;
57 CORBA::ULong iStep;
58 CORBA::ULong iSize, iOldSize, iAddSize;
59 CORBA::ULong iCount;
61 ACE_NEW_RETURN (vServers,
62 ServerSequence (),
63 -1);
65 iSize = 1;
66 iStep = 1;
67 while (iSize <= 50000)
69 iOldSize = vServers->length ();
70 iAddSize = iSize - iOldSize;
72 server->CreateExtra (iAddSize,
73 vAddition.out ());
76 vServers->length (iSize);
77 for (iCount = 0 ; iCount < iAddSize ; iCount ++)
79 vServers [iOldSize + iCount] =
80 Server::_duplicate (vAddition [iCount]);
83 vAddition = 0;
85 if (iStep * 5 > iSize)
87 iSize += iStep;
89 else
91 iStep *= 10;
92 iSize = iStep;
96 //------------- End of donated untouched section
98 ACE_DEBUG ((LM_DEBUG,
99 "(%P|%t) Call delete on the server\n"));
101 server->DeleteExtra (vServers.in ());
103 ACE_DEBUG ((LM_DEBUG,
104 "(%P|%t) Calling shutdown\n"));
105 server->shutdown ();
107 catch (const CORBA::Exception& ex)
109 ex._tao_print_exception ("");
112 return 0;