2 // The run_test.pl perl script will check for the expected output.
4 #include "ace/config.h"
5 #include "tao/IFR_Client/IFR_ComponentsC.h"
6 #include "ace/Get_Opt.h"
8 const ACE_TCHAR
*ifr_ior
= ACE_TEXT("file://ifr.ior");
9 const ACE_TCHAR
*member_type_id
= ACE_TEXT("IDL:arrayOfStruct:1.0");
12 parse_args (int argc
, ACE_TCHAR
*argv
[])
14 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("i:"));
17 while ((c
= get_opts ()) != -1)
21 ifr_ior
= get_opts
.opt_arg ();
25 ACE_ERROR_RETURN ((LM_ERROR
,
32 // Indicates successful parsing of the command line
36 int ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
40 CORBA::ORB_var the_orb
= CORBA::ORB_init (argc
, argv
);
42 if (parse_args (argc
, argv
) != 0)
45 CORBA::Object_var obj
= the_orb
->string_to_object (ACE_TEXT_ALWAYS_CHAR(ifr_ior
));
46 if (CORBA::is_nil (obj
.in()))
48 ACE_DEBUG ((LM_DEBUG
, "Obtained nil reference to Object for interface repository\n" ));
52 CORBA::ComponentIR::Repository_var ifr
;
56 ifr
= CORBA::ComponentIR::Repository::_narrow (obj
.in());
58 catch (const CORBA::SystemException
&)
60 ACE_DEBUG ((LM_DEBUG
, "exception catched .. narrowing IFR object\n" ));
64 if (CORBA::is_nil (ifr
.in()))
66 ACE_DEBUG ((LM_DEBUG
, "Can't narrow to IFR\n" ));
70 ACE_DEBUG ((LM_DEBUG
, "Looking up %C", member_type_id
));
72 dependency
= ifr
->lookup_id (ACE_TEXT_ALWAYS_CHAR(member_type_id
));
73 if (CORBA::is_nil (dependency
.in ()))
75 ACE_DEBUG ((LM_DEBUG
, " *** failed ***\n" ));
80 the_alias
= CORBA::AliasDef::_narrow (dependency
.in ());
81 if (CORBA::is_nil (the_alias
.in ()))
83 ACE_DEBUG ((LM_DEBUG
, " *** not an alias ***\n" ));
88 orig_type
= the_alias
->original_type_def ();
90 tc_content
= orig_type
->type ();
92 length
= tc_content
->length ();
94 cont_type
= tc_content
->content_type ();
96 *name
= cont_type
->name ();
104 ACE_DEBUG ((LM_DEBUG
, "Correct result, test passed\n" ));
108 ACE_DEBUG ((LM_DEBUG
, "Error: Should have been %C [2]\n", name
));
112 catch (const ::CORBA::Exception
&ex
)
114 ex
._tao_print_exception("ERROR : unexpected CORBA exception caugth :");