本文整理汇总了C++中Test_var::instance_count方法的典型用法代码示例。如果您正苦于以下问题:C++ Test_var::instance_count方法的具体用法?C++ Test_var::instance_count怎么用?C++ Test_var::instance_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Test_var
的用法示例。
在下文中一共展示了Test_var::instance_count方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
int
ACE_TMAIN(int, ACE_TCHAR *[])
{
int niterations = 10;
int norbs = 10;
try
{
for (int i = 0; i != niterations; ++i)
{
for (int j = 0; j != norbs; ++j)
{
char buf[16];
ACE_OS::sprintf (buf, "ORB_%4.4d", j);
int argc = 0;
ACE_TCHAR **argv = 0;
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv, buf);
CORBA::Object_var object =
orb->string_to_object ("DLL:Test_Object");
Test_var test =
Test::_narrow (object.in ());
if (CORBA::is_nil (test.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Nil object reference.\n"),
1);
}
CORBA::Long count =
test->instance_count ();
if (count != norbs*i + j + 1)
{
ACE_DEBUG ((LM_DEBUG,
"Incorrect number of objects "
"(%d != %d)\n",
count, norbs * i + j + 1));
}
test->destroy ();
}
}
for (int j = 0; j != norbs; ++j)
{
char buf[16];
ACE_OS::sprintf (buf, "ORB_%4.4d", j);
int argc = 0;
ACE_TCHAR **argv = 0;
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv, buf);
CORBA::Object_var obj =
orb->resolve_initial_references ("RootPOA");
PortableServer::POA_var poa =
PortableServer::POA::_narrow (obj.in ());
poa->destroy (1, 1);
orb->destroy ();
}
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("main()");
return 1;
}
return 0;
}