2 #include "ace/Get_Opt.h"
4 static const ACE_TCHAR
*ior_input_file
= ACE_TEXT("file://test.ior");
6 static obvmod::tcOffset1
*vt1
= 0;
7 static obvmod::tcOffset003
*vt3
= 0;
8 static obvmod::tcOffset00005
*vt5
= 0;
9 static obvmod::tcOffset0000007
*vt7
= 0;
15 register_factories (CORBA::ORB_ptr orb
)
17 // Create and register factories.
19 obvmod::tcOffset1_init
*factory1
= 0;
20 ACE_NEW_RETURN (factory1
,
21 obvmod::tcOffset1_init
,
24 orb
->register_value_factory (factory1
->tao_repository_id (),
27 factory1
->_remove_ref ();
29 obvmod::tcOffset003_init
*factory3
= 0;
30 ACE_NEW_RETURN (factory3
,
31 obvmod::tcOffset003_init
,
34 orb
->register_value_factory (factory3
->tao_repository_id (),
37 factory3
->_remove_ref ();
39 obvmod::tcOffset00005_init
*factory5
= 0;
40 ACE_NEW_RETURN (factory5
,
41 obvmod::tcOffset00005_init
,
44 orb
->register_value_factory (factory5
->tao_repository_id (),
47 factory5
->_remove_ref ();
49 obvmod::tcOffset0000007_init
*factory7
= 0;
50 ACE_NEW_RETURN (factory7
,
51 obvmod::tcOffset0000007_init
,
54 orb
->register_value_factory (factory7
->tao_repository_id (),
57 factory7
->_remove_ref ();
62 run_test (test_ptr objref
,
65 CORBA::Any_var result
= objref
->get_value (offset
);
67 CORBA::Boolean status
= 0;
68 CORBA::Long member_value
= 0;
73 status
= (result
.in () >>= vt1
);
74 member_value
= vt1
->mem ();
77 status
= (result
.in () >>= vt3
);
78 member_value
= vt3
->mem ();
81 status
= (result
.in () >>= vt5
);
82 member_value
= vt5
->mem ();
85 status
= (result
.in () >>= vt7
);
86 member_value
= vt7
->mem ();
97 "Any extraction failed for repo id length offset"
98 " of %d from 8-byte boundary\n",
105 return (member_value
== offset
);
109 parse_args (int argc
, ACE_TCHAR
*argv
[])
111 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("dk:x"));
114 while ((c
= get_opts ()) != -1)
122 ior_input_file
= get_opts
.optarg
;
131 ACE_ERROR_RETURN ((LM_ERROR
,
140 // Indicates successful parsing of the command line
145 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
149 CORBA::ORB_var orb
= CORBA::ORB_init (argc
,
152 if (parse_args (argc
, argv
) != 0)
157 CORBA::Object_var obj
=
158 orb
->string_to_object (ior_input_file
);
160 int status
= register_factories (orb
.in ());
166 ACE_DEBUG ((LM_DEBUG
,
167 "OBV factory registration failed\n"));
173 test_var objref
= test::_narrow (obj
.in ());
175 for (CORBA::Long i
= 1; i
< 8; i
+= 2)
177 status
= run_test (objref
.in (), i
);
183 ACE_DEBUG ((LM_DEBUG
,
184 "Incorrect member value - expected %d\n",
199 catch (const CORBA::Exception
& ex
)
201 ex
._tao_print_exception ("exception:");