1 #include "tao/IFR_Client/IFR_ComponentsC.h"
2 #include "ace/Get_Opt.h"
7 const ACE_TCHAR
*ifr_ior_file
= 0;
8 const ACE_TCHAR
*idl_value
= 0;
12 parse_args (int argc
, ACE_TCHAR
*argv
[])
14 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("i:s:"));
15 const unsigned char full_success
= 0x03;
16 unsigned char success
= 0;
21 if (success
== full_success
)
28 ACE_ERROR_RETURN ((LM_ERROR
,
40 ifr_ior_file
= get_opts
.opt_arg ();
44 idl_value
= get_opts
.opt_arg ();
50 // Indicates successful parsing of the command line
54 // ----------------------------------------------------------------------
56 int ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
61 CORBA::ORB_var the_orb
=
62 CORBA::ORB_init (argc
, argv
);
64 if (parse_args (argc
, argv
) == -1)
70 CORBA::Object_var objref
=
71 the_orb
->string_to_object (ifr_ior_file
);
72 if (objref
.in () == 0)
74 ACE_ERROR_RETURN ((LM_ERROR
,
75 "The received objref is nil\n"),
79 CORBA::ComponentIR::Repository_var the_repo_ref
;
82 the_repo_ref
= CORBA::ComponentIR::Repository::_narrow (objref
.in ());
84 catch (const CORBA::Exception
&ex
)
86 ex
._tao_print_exception ("Can't narrow the IFR:");
90 // search in repository
91 CORBA::Contained_var current_contained
=
92 the_repo_ref
->lookup_id (ACE_TEXT_ALWAYS_CHAR (idl_value
));
93 if (CORBA::is_nil(current_contained
.in ()))
95 ACE_ERROR_RETURN ((LM_ERROR
,
96 "Can't look up the valuetype\n"),
100 // get value type definition
101 CORBA::ExtValueDef_var value_def
=
102 CORBA::ExtValueDef::_narrow (current_contained
.in ());
103 CORBA::ExtValueDef::ExtFullValueDescription_var value_descr
;
106 value_descr
= value_def
->describe_ext_value ();
108 catch (const CORBA::Exception
&ex
)
110 ex
._tao_print_exception ("Can't describe_ext_value:");
114 CORBA::ValueMemberSeq
& the_value_members
=
115 value_descr
->members
;
116 for (CORBA::ULong ct
= 0; ct
< the_value_members
.length (); ++ct
)
118 const CORBA::ValueMember
& current_member
=
119 the_value_members
[ct
];
120 ACE_DEBUG ((LM_DEBUG
,
121 "value type member '%C'\n",
122 current_member
.name
.in ()));
125 catch (const CORBA::Exception
&ex
)
127 ex
._tao_print_exception ("MAIN: Unexpected CORBA exception caught:");