1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
// -*- C++ -*-
// $Id$
#include "tao/IFR_Client/IFR_BasicC.h"
#include "tao/ORB_Core.h"
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
//init IFR objref
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
TAO_IFR_Client_Adapter *ifr_client =
ACE_Dynamic_Service<TAO_IFR_Client_Adapter>::instance (
TAO_ORB_Core::ifr_client_adapter_name ());
if (ifr_client == 0)
{
throw ::CORBA::INTF_REPOS ();
}
ACE_DEBUG ((LM_DEBUG, "Got IFR_Client ref.\n"));
CORBA::InterfaceDef_var intDef =
ifr_client->get_interface (orb.in (), "IDL:IFR_Test/test_if:1.0");
if (CORBA::is_nil (intDef.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"get interface returned nil ref\n"),
1);
}
CORBA::ContainedSeq_var attributes =
intDef->contents (CORBA::dk_Attribute, 1);
CORBA::ULong n_ats = attributes->length ();
CORBA::ULong index = 0UL;
CORBA::String_var name = attributes[index]->name ();
ACE_DEBUG ((LM_DEBUG,
"found %d attributes, name = %s\n",
n_ats,
name.in ()));
CORBA::AttributeDef_var attr =
CORBA::AttributeDef::_narrow (attributes[index]);
if (CORBA::is_nil (attr.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"could not narrow attribute ref\n"),
1);
}
CORBA::TypeCode_var tc = attr->type ();
ACE_DEBUG ((LM_DEBUG, "foo attr typecode = %s\n", tc->id ()));
return 0;
}
|