本文整理汇总了C++中corba::Policy_var::in方法的典型用法代码示例。如果您正苦于以下问题:C++ Policy_var::in方法的具体用法?C++ Policy_var::in怎么用?C++ Policy_var::in使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corba::Policy_var
的用法示例。
在下文中一共展示了Policy_var::in方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
TAO_ZIOPPolicy_Validator::validate_impl (TAO_Policy_Set &policies)
{
CORBA::Policy_var policy =
policies.get_cached_policy (TAO_CACHED_COMPRESSION_ENABLING_POLICY);
if (policy.in () == 0)
return;
ZIOP::CompressionEnablingPolicy_var srp =
ZIOP::CompressionEnablingPolicy::_narrow (policy.in ());
if (srp.in () == 0)
return;
}
示例2:
void
TAO_RT_POA::parse_rt_policies (TAO_POA_Policy_Set &policies)
{
{
CORBA::Policy_var policy =
policies.get_cached_policy (TAO_CACHED_POLICY_PRIORITY_MODEL);
RTCORBA::PriorityModelPolicy_var priority_model =
RTCORBA::PriorityModelPolicy::_narrow (policy.in ());
if (!CORBA::is_nil (priority_model.in ()))
{
RTCORBA::PriorityModel rt_priority_model =
priority_model->priority_model ();
this->cached_policies_.priority_model (
TAO::Portable_Server::Cached_Policies::PriorityModel (rt_priority_model));
RTCORBA::Priority priority =
priority_model->server_priority ();
this->cached_policies_.server_priority (priority);
}
}
this->thread_pool_ =
TAO_POA_RT_Policy_Validator::extract_thread_pool (this->orb_core_,
policies.policies ());
}
示例3: policy_list
int
insecure_invocation_test (CORBA::ORB_ptr orb,
CORBA::Object_ptr obj)
{
// Disable protection for this insecure invocation test.
Security::QOP qop = Security::SecQOPNoProtection;
CORBA::Any no_protection;
no_protection <<= qop;
// Create the Security::QOPPolicy.
CORBA::Policy_var policy =
orb->create_policy (Security::SecQOPPolicy,
no_protection);
CORBA::PolicyList policy_list (1);
policy_list.length (1);
policy_list[0] = CORBA::Policy::_duplicate (policy.in ());
// Create an object reference that uses plain IIOP (i.e. no
// protection).
CORBA::Object_var object =
obj->_set_policy_overrides (policy_list,
CORBA::SET_OVERRIDE);
Foo::Bar_var server =
Foo::Bar::_narrow (object.in ());
if (CORBA::is_nil (server.in ()))
{
ACE_ERROR ((LM_ERROR,
"(%P|%t) ERROR: Object reference <%s> is "
"nil.\n",
ior));
return 1;
}
try
{
// This invocation should result in a CORBA::NO_PERMISSION
// exception.
server->baz ();
}
catch (const CORBA::NO_PERMISSION&)
{
ACE_DEBUG ((LM_INFO,
"(%P|%t) Received CORBA::NO_PERMISSION from "
"server, as expected.\n"));
return 0;
}
ACE_ERROR ((LM_ERROR,
"(%P|%t) ERROR: CORBA::NO_PERMISSION was not thrown.\n"
"(%P|%t) ERROR: It should have been thrown.\n"));
return 1;
}
示例4: policy
void
IORInterceptor::establish_components (
PortableInterceptor::IORInfo_ptr info)
{
try
{
PortableInterceptor::ObjectReferenceTemplate_var t =
info->adapter_template ();
PortableInterceptor::AdapterName_var a =
t->adapter_name ();
// Only execute if POA is not RootPOA. The RootPOA will not
// have our custom policy, but the child POA we created will.
if (a->length () > 1)
{
CORBA::Policy_var policy (
info->get_effective_policy (Test::POLICY_TYPE));
Test::Policy_var test_policy (Test::Policy::_narrow (
policy.in ()));
this->success_ = true;
}
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception (
"EXCEPTION: ""IORInterceptor::establish_components:");
ACE_ASSERT (false);
}
}
示例5: check_cp_policy
//Check if the policy of object is set to client declared
CORBA::Short check_cp_policy (Test_ptr server ACE_ENV_ARG_DECL)
{
// Check that the object is configured with CLIENT_PROPAGATED
// PriorityModelPolicy.
CORBA::Policy_var policy =
server->_get_policy (RTCORBA::PRIORITY_MODEL_POLICY_TYPE
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (-1);
RTCORBA::PriorityModelPolicy_var priority_policy =
RTCORBA::PriorityModelPolicy::_narrow (policy.in () ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (-1);
if (CORBA::is_nil (priority_policy.in ()))
ACE_ERROR_RETURN ((LM_ERROR,
"ERROR: Priority Model Policy not exposed!\n"),
-1);
RTCORBA::PriorityModel priority_model =
priority_policy->priority_model (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (-1);
if (priority_model != RTCORBA::CLIENT_PROPAGATED)
ACE_ERROR_RETURN ((LM_ERROR,
"ERROR: priority_model != "
"RTCORBA::CLIENT_PROPAGATED!\n"),
-1);
return priority_policy->server_priority (ACE_ENV_SINGLE_ARG_PARAMETER);
}
示例6:
void
Cached_Policies::update (TAO_POA_Policy_Set &policy_set
)
{
for (CORBA::ULong i = 0; i < policy_set.num_policies (); i++)
{
CORBA::Policy_var policy = policy_set.get_policy_by_index (i);
this->update_policy (policy.in ()
);
}
}
示例7:
CORBA::Policy_ptr
TAO_Stub::get_cached_policy (TAO_Cached_Policy_Type type)
{
// No need to lock, the stub only changes its policies at
// construction time...
CORBA::Policy_var result;
if (this->policies_ != 0)
{
result = this->policies_->get_cached_policy (type);
}
if (CORBA::is_nil (result.in ()))
{
result = this->orb_core_->get_cached_policy_including_current (type);
}
return result._retn ();
}
示例8:
CORBA::Policy_ptr
TAO_IORInfo::get_effective_policy (CORBA::PolicyType type)
{
this->check_validity ();
CORBA::Policy_var policy =
this->poa_->get_policy (type);
if (!CORBA::is_nil (policy.in ()))
{
return policy._retn ();
}
// TODO: Now check the global ORB policies.
// ........
// No policy matching the given PolicyType was found.
throw ::CORBA::INV_POLICY (CORBA::OMGVMCID | 3, CORBA::COMPLETED_NO);
}
示例9: register_with_proxy
CORBA::Object_ptr register_with_proxy (CORBA::Object_ptr native)
{
// Disable protection for this insecure invocation test.
Security::QOP qop = Security::SecQOPNoProtection;
CORBA::Any no_protection;
no_protection <<= qop;
// Create the Security::QOPPolicy.
CORBA::Policy_var policy =
orb->create_policy (Security::SecQOPPolicy,
no_protection);
CORBA::PolicyList policy_list (1);
policy_list.length (1);
policy_list[0] = CORBA::Policy::_duplicate (policy.in ());
// Create an object reference that uses plain IIOP (i.e. no
// protection).
CORBA::Object_var object =
mapper->_set_policy_overrides (policy_list,
CORBA::SET_OVERRIDE);
ACE_DEBUG ((LM_DEBUG,"Trying to narrow an insecure reference\n"));
Lorica::ReferenceMapper_var open_mapper =
Lorica::ReferenceMapper::_narrow(object.in());
ACE_DEBUG ((LM_DEBUG,"Using open mapper for registering\n"));
try
{
return open_mapper->as_server(native,"Hello",
Lorica::ServerAgent::_nil());
}
catch (CORBA::Exception &ex)
{
ACE_DEBUG ((LM_DEBUG,"open_mapper->as_server raised %s\n",ex._name()));
return CORBA::Object::_nil();
}
}
示例10:
CORBA::Short
Activity::get_server_priority (CORBA::Object_ptr server)
{
// Get the Priority Model Policy from the stub.
CORBA::Policy_var policy =
server->_get_policy (RTCORBA::PRIORITY_MODEL_POLICY_TYPE);
// Narrow down to correct type.
RTCORBA::PriorityModelPolicy_var priority_policy =
RTCORBA::PriorityModelPolicy::_narrow (policy.in ());
// Make sure that we have the SERVER_DECLARED priority model.
RTCORBA::PriorityModel priority_model =
priority_policy->priority_model ();
if (priority_model != RTCORBA::SERVER_DECLARED)
return -1;
// Return the server priority.
return priority_policy->server_priority ();
}
示例11:
CORBA::Short
check_policy (Test_ptr server)
{
CORBA::Policy_var policy =
server->_get_policy (RTCORBA::PRIORITY_MODEL_POLICY_TYPE);
RTCORBA::PriorityModelPolicy_var priority_policy =
RTCORBA::PriorityModelPolicy::_narrow (policy.in ());
if (check_for_nil (priority_policy.in (), "PriorityModelPolicy") == -1)
return -1;
RTCORBA::PriorityModel priority_model =
priority_policy->priority_model ();
if (priority_model != RTCORBA::SERVER_DECLARED)
ACE_ERROR_RETURN ((LM_ERROR,
"ERROR: priority_model != "
"RTCORBA::SERVER_DECLARED!\n"),
-1);
return priority_policy->server_priority ();
}
示例12: check_sd_policy
//Check if the policy of object is set to server declared
CORBA::Short check_sd_policy (Test_ptr server ACE_ENV_ARG_DECL)
{
CORBA::Policy_var policy =
server->_get_policy (RTCORBA::PRIORITY_MODEL_POLICY_TYPE
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (-1);
RTCORBA::PriorityModelPolicy_var priority_policy =
RTCORBA::PriorityModelPolicy::_narrow (policy.in () ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (-1);
if (check_for_nil (priority_policy.in (), "PriorityModelPolicy") == -1)
return -1;
RTCORBA::PriorityModel priority_model =
priority_policy->priority_model (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (-1);
if (priority_model != RTCORBA::SERVER_DECLARED)
ACE_ERROR_RETURN ((LM_ERROR,
"ERROR: priority_model != "
"RTCORBA::SERVER_DECLARED!\n"),
-1);
return priority_policy->server_priority (ACE_ENV_SINGLE_ARG_PARAMETER);
}
示例13: INTERNAL
/* static */
TAO_Thread_Pool *
TAO_POA_RT_Policy_Validator::extract_thread_pool (TAO_ORB_Core &orb_core,
TAO_Policy_Set &policies)
{
CORBA::Policy_var policy =
policies.get_cached_policy (TAO_CACHED_POLICY_THREADPOOL);
RTCORBA::ThreadpoolPolicy_var thread_pool_policy =
RTCORBA::ThreadpoolPolicy::_narrow (policy.in ());
if (CORBA::is_nil (thread_pool_policy.in ()))
return 0;
RTCORBA::ThreadpoolId thread_pool_id = thread_pool_policy->threadpool ();
// Get the RTORB.
CORBA::Object_var object = orb_core.resolve_rt_orb ();
RTCORBA::RTORB_var rt_orb = RTCORBA::RTORB::_narrow (object.in ());
TAO_RT_ORB * const tao_rt_orb =
dynamic_cast <TAO_RT_ORB *> (rt_orb.in ());
if (!tao_rt_orb)
throw CORBA::INTERNAL ();
TAO_Thread_Pool_Manager & tp_manager = tao_rt_orb->tp_manager ();
TAO_Thread_Pool * const thread_pool =
tp_manager.get_threadpool (thread_pool_id);
if (thread_pool == 0)
throw PortableServer::POA::InvalidPolicy ();
return thread_pool;
}
示例14: MARSHAL
int
TAO_DiffServ_Service_Context_Handler::generate_service_context (
TAO_Stub *stub,
TAO_Transport&,
TAO_Operation_Details &opdetails,
TAO_Target_Specification &,
TAO_OutputCDR &)
{
if (stub)
{
CORBA::Policy_var cnpp =
stub->get_cached_policy (TAO_CACHED_POLICY_CLIENT_NETWORK_PRIORITY);
TAO::NetworkPriorityPolicy_var cnp =
TAO::NetworkPriorityPolicy::_narrow (cnpp.in ());
if (!CORBA::is_nil (cnp.in ()))
{
TAO::DiffservCodepoint const reply_diffserv_codepoint =
cnp->reply_diffserv_codepoint ();
CORBA::Long const rep_dscp_codepoint = reply_diffserv_codepoint;
TAO_OutputCDR cdr;
if (!(cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))
|| !(cdr << rep_dscp_codepoint))
{
throw CORBA::MARSHAL ();
}
opdetails.request_service_context ().set_context (IOP::REP_NWPRIORITY, cdr);
}
}
return 0;
}
示例15:
void
TAO_DiffServ_Network_Priority_Hook::update_network_priority (
TAO_Root_POA &poa, TAO_POA_Policy_Set &policy_set)
{
for (CORBA::ULong i = 0; i < policy_set.num_policies (); i++)
{
CORBA::Policy_var policy = policy_set.get_policy_by_index (i);
if (policy->policy_type () == TAO::NETWORK_PRIORITY_TYPE)
{
::TAO::NetworkPriorityPolicy_var npp =
::TAO::NetworkPriorityPolicy::_narrow (policy.in ());
if (!CORBA::is_nil (npp.in ()))
{
TAO::NetworkPriorityModel network_priority_model =
npp->network_priority_model ();
poa.cached_policies ().network_priority_model (
TAO::Portable_Server::Cached_Policies::NetworkPriorityModel (
network_priority_model));
TAO::DiffservCodepoint request_diffserv_codepoint =
npp->request_diffserv_codepoint ();
TAO::DiffservCodepoint reply_diffserv_codepoint =
npp->reply_diffserv_codepoint ();
poa.cached_policies ().request_diffserv_codepoint (
request_diffserv_codepoint);
poa.cached_policies ().reply_diffserv_codepoint (
reply_diffserv_codepoint);
}
}
}
}