=default for generated implementation copy ctor
[ACE_TAO.git] / TAO / tests / RTCORBA / ORB_init / ORB_init.cpp
blobfaee740ce21db4b532e2d360f70307e764341f9c
1 #include "tao/RTCORBA/RTCORBA.h"
2 #include "tao/ORB.h"
3 #include "ace/Get_Opt.h"
4 #include "ace/OS_NS_stdio.h"
6 int
7 test_multiple_orbs (const char *test_name,
8 int argc,
9 ACE_TCHAR *argv[],
10 int iterations,
11 int rt_orb,
12 int destroy)
14 CORBA::ORB_var *orbs =
15 new CORBA::ORB_var[iterations];
17 RTCORBA::RTORB_var *rt_orbs =
18 new RTCORBA::RTORB_var[iterations];
20 try
22 for (int i = 0;
23 i < iterations;
24 ++i)
26 char name[100];
27 ACE_OS::sprintf (name, "%s %d", test_name, i);
29 orbs[i] =
30 CORBA::ORB_init (argc,
31 argv,
32 name);
34 if (rt_orb)
36 CORBA::Object_var object =
37 orbs[i]->resolve_initial_references ("RTORB");
39 rt_orbs[i] =
40 RTCORBA::RTORB::_narrow (object.in ());
42 ACE_ASSERT (rt_orbs[i].in () != RTCORBA::RTORB::_nil ());
46 if (destroy)
48 for (int i = 0;
49 i < iterations;
50 ++i)
52 orbs[i]->destroy ();
56 catch (const CORBA::Exception& ex)
58 ex._tao_print_exception ("Unexpected exception caught in ORB_init");
59 return -1;
62 delete[] rt_orbs;
63 delete[] orbs;
65 return 0;
68 int
69 ACE_TMAIN (int argc, ACE_TCHAR *argv[])
71 int iterations = 5;
72 int rt_orb = 0;
73 int destroy = 0;
75 int result =
76 test_multiple_orbs ("non-RT ORBs, disable destroy",
77 argc,
78 argv,
79 iterations,
80 rt_orb,
81 destroy);
82 ACE_ASSERT (result == 0);
84 destroy = 1;
85 rt_orb = 0;
87 result =
88 test_multiple_orbs ("non-RT ORBs, enable destroy",
89 argc,
90 argv,
91 iterations,
92 rt_orb,
93 destroy);
94 ACE_ASSERT (result == 0);
96 destroy = 0;
97 rt_orb = 1;
99 result =
100 test_multiple_orbs ("RT ORBs, disable destroy",
101 argc,
102 argv,
103 iterations,
104 rt_orb,
105 destroy);
106 ACE_ASSERT (result == 0);
108 destroy = 1;
109 rt_orb = 1;
111 result =
112 test_multiple_orbs ("RT ORBs, enable destroy",
113 argc,
114 argv,
115 iterations,
116 rt_orb,
117 destroy);
118 ACE_ASSERT (result == 0);
120 return result;