本文整理汇总了C++中corba::ORB_var::_create_policy方法的典型用法代码示例。如果您正苦于以下问题:C++ ORB_var::_create_policy方法的具体用法?C++ ORB_var::_create_policy怎么用?C++ ORB_var::_create_policy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corba::ORB_var
的用法示例。
在下文中一共展示了ORB_var::_create_policy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cln_thr
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try
{
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv);
if (parse_args (argc, argv) != 0)
return 2;
// create UIPMC reference
CORBA::Object_var miop_ref =
orb->string_to_object (ior_file);
// create Hello reference
Test::Hello_var hello =
Test::Hello::_unchecked_narrow (miop_ref.in ());
if (CORBA::is_nil (hello.in ()))
return 5;
TAO::DiffservCodepoint request_dscp = dscp[12];
TAO::DiffservCodepoint reply_dscp = dscp[13];
CORBA::PolicyList policy_list;
policy_list.length (1);
CORBA::Policy_var client_network_policy =
orb->_create_policy (TAO::CLIENT_NETWORK_PRIORITY_TYPE);
TAO::NetworkPriorityPolicy_var nw_priority =
TAO::NetworkPriorityPolicy::_narrow (client_network_policy.in ());
nw_priority->request_diffserv_codepoint (
request_dscp);
nw_priority->reply_diffserv_codepoint (
reply_dscp);
nw_priority->network_priority_model (
TAO::CLIENT_PROPAGATED_NETWORK_PRIORITY);
policy_list[0] = TAO::NetworkPriorityPolicy::_duplicate (nw_priority.in ());
CORBA::Object_var over_ridden_object = hello->_set_policy_overrides (
policy_list, CORBA::SET_OVERRIDE);
policy_list[0]->destroy ();
hello = Test::Hello::_unchecked_narrow (over_ridden_object.in ());
{
// start clients
ClientThread cln_thr (hello.in (), HELLO_CALL_NUMBER);
cln_thr.activate (THR_NEW_LWP | THR_JOINABLE, CLIENT_THREAD_NUMBER);
cln_thr.wait ();
}
// shutdown the server, after 10 invocations of shutdown() we can be
// more or less sure that server actually received that call
for (int i = 0; i < 10; i++)
hello->shutdown ();
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught in client main ():");
return 4;
}
ACE_DEBUG ((LM_DEBUG,
"\n (%P|%t) client finished successfully..\n"));
return 0;
}