• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ corba::Policy_var类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中corba::Policy_var的典型用法代码示例。如果您正苦于以下问题:C++ Policy_var类的具体用法?C++ Policy_var怎么用?C++ Policy_var使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Policy_var类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1:

void
TAO_POA_Policy_Set::validate_policies (TAO_Policy_Validator &validator,
                                       TAO_ORB_Core &orb_core)
{
  // Just give a last chance for all the unloaded validators in other
  // libraries to be registered
  orb_core.load_policy_validators (validator);

  // Validate that all of the specified policies make sense.
  validator.validate (this->impl_ );

  // Verify that all policies are legal for the currently loaded
  // POA extensions.
  for (CORBA::ULong i = 0;
       i < this->impl_.num_policies ();
       i++)
    {
      CORBA::Policy_var policy = this->impl_.get_policy_by_index (i);

      CORBA::PolicyType type = policy->policy_type ();

      if (!(validator.legal_policy (type)))
        {
#if !defined (CORBA_E_MICRO)
          // An invalid policy was specified.  Let the user know about
          // it.
          throw PortableServer::POA::InvalidPolicy ();
#else
          TAOLIB_ERROR ((LM_ERROR, "Invalid policy\n"));
#endif
        }
    }
}
开发者ID:asdlei00,项目名称:ACE,代码行数:33,代码来源:POA_Policy_Set.cpp


示例2: 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);
    }
}
开发者ID:asdlei00,项目名称:ACE,代码行数:33,代码来源:IORInterceptor.cpp


示例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;
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:60,代码来源:client.cpp


示例4: 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);
}
开发者ID:kraman,项目名称:RTZen,代码行数:31,代码来源:client1.cpp


示例5:

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 ());
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:29,代码来源:RT_POA.cpp


示例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 ()
                              );
        }
    }
开发者ID:CCJY,项目名称:ATCD,代码行数:12,代码来源:POA_Cached_Policies.cpp


示例7:

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;
}
开发者ID:chenbk85,项目名称:ACE-Middleware,代码行数:15,代码来源:ZIOP_Policy_Validator.cpp


示例8:

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 ();
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:19,代码来源:Stub.cpp


示例9:

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);
}
开发者ID:asdlei00,项目名称:ACE,代码行数:19,代码来源:IORInfo.cpp


示例10: 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();
	}
}
开发者ID:snaewe,项目名称:lorica,代码行数:42,代码来源:server.cpp


示例11:

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 ();
}
开发者ID:INMarkus,项目名称:ATCD,代码行数:20,代码来源:Activity.cpp


示例12:

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 ();
}
开发者ID:asdlei00,项目名称:ACE,代码行数:22,代码来源:client.cpp


示例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;
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:37,代码来源:RT_Policy_Validator.cpp


示例14: 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);
}
开发者ID:kraman,项目名称:RTZen,代码行数:25,代码来源:client1.cpp


示例15: 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;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:36,代码来源:DiffServ_Service_Context_Handler.cpp


示例16:

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);
            }
        }
    }
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:36,代码来源:DiffServ_Network_Priority_Hook.cpp


示例17: policy_list

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 1;

    CORBA::Object_var obj =
      orb->string_to_object( ior );

    Messenger_var messenger =
      Messenger::_narrow( obj.in() );

    CORBA::String_var message =
      CORBA::string_dup( "Terminating messenger service!" );

    messenger->send_message( "Chief of Security",
                             "New Directive",
                             message.inout() );

    messenger->shutdown("Chief of Security");

    Security::QOP qop =
      Security::SecQOPIntegrityAndConfidentiality;

    CORBA::Any want_protection;
    want_protection <<= qop;

    CORBA::Policy_var policy =
      orb->create_policy (Security::SecQOPPolicy,
                          want_protection);

    Security::EstablishTrust establish_trust;
    establish_trust.trust_in_client = 0;
    establish_trust.trust_in_target = 1;

    CORBA::Any want_trust;
    want_trust <<= establish_trust;

    CORBA::Policy_var policy2 =
      orb->create_policy (Security::SecEstablishTrustPolicy,
                          want_trust);


    CORBA::PolicyList policy_list (2);
    policy_list.length (1);
    policy_list[0] =
      CORBA::Policy::_duplicate (policy.in ());
    policy_list.length (2);
    policy_list[1] =
      CORBA::Policy::_duplicate (policy2.in ());


    CORBA::Object_var object =
      obj->_set_policy_overrides (policy_list,
                                  CORBA::SET_OVERRIDE);

    Messenger_var messenger2 =
      Messenger::_narrow( object.in() );

    message =
      CORBA::string_dup( "Terminating messenger service!" );

    messenger2->send_message( "Chief of Security",
                             "New Directive",
                             message.inout() );

    messenger2->shutdown("Chief of Security");

    orb->destroy();
  }
  catch(const CORBA::Exception& ex)
  {
    ex._tao_print_exception("Client: main block");
    return 1;
  }

  return 0;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:83,代码来源:MessengerClient.cpp


示例18:

void
TAO_POA_RT_Policy_Validator::validate_priorities (TAO_Policy_Set &policies)
{
  // Initialize to the default priority/priority model.
  CORBA::Short priority =
    TAO_INVALID_PRIORITY;
  TAO::Portable_Server::Cached_Policies::PriorityModel rt_priority_model =
    TAO::Portable_Server::Cached_Policies::NOT_SPECIFIED;

  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 ()))
    {
      priority = priority_model->server_priority ();

      rt_priority_model =
        TAO::Portable_Server::Cached_Policies::PriorityModel (
          priority_model->priority_model ());

      // Check that the priority is in bounds.
      if (priority < RTCORBA::minPriority
               // The line below will always be false unless the value of
               // RTCORBA::maxPriority, which is now assigned the value of
               // 32767, is changed in RTCORBA.pidl.
//          || priority > RTCORBA::maxPriority
         )
        {
          throw PortableServer::POA::InvalidPolicy ();
        }
    }
  else
    // If priority model was not specified, then we better not have a
    // thread pool with lanes.
    {
      if (this->thread_pool_ != 0 &&
          this->thread_pool_->with_lanes ())
        throw PortableServer::POA::InvalidPolicy ();
    }

  policy =
    policies.get_cached_policy (TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION);

  RTCORBA::PriorityBandedConnectionPolicy_var priority_bands
    = RTCORBA::PriorityBandedConnectionPolicy::_narrow (policy.in ());

  TAO_PriorityBandedConnectionPolicy *bands_policy =
    dynamic_cast<TAO_PriorityBandedConnectionPolicy *> (priority_bands.in ());

  // If priority banded connections are set, make sure that:
  //  0. A priority model was specified.
  //  1. There is at least one band.
  //  2a. low is not < RTCORBA::minPriority
  //  2b. low <= high
  //  2c. high is not > RTCORBA::maxPriority
  //  3. If priority model is SERVER_DECLARED, server_priority must
  //  match one of the bands.
  //  4. If this POA has a thread pool with lanes, then for each band,
  //  there must be at least one thread lane that can service it,
  //  i.e., whose priority falls into the band's range.
  if (bands_policy != 0)
    {
      // Checks 0.
      if (rt_priority_model == TAO::Portable_Server::Cached_Policies::NOT_SPECIFIED)
        throw PortableServer::POA::InvalidPolicy ();

      RTCORBA::PriorityBands &bands =
        bands_policy->priority_bands_rep ();

      // Checks 1.
      if (bands.length () == 0)
        throw PortableServer::POA::InvalidPolicy ();

      // Checks 2.
      for (CORBA::ULong i = 0; i < bands.length (); ++i)
        {
          //  2a. low is not < RTCORBA::minPriority
          //  2b. low is not > high
          //  2c. high is not > RTCORBA::maxPriority
          if (bands[i].low < RTCORBA::minPriority
              || bands[i].low > bands[i].high
                   // The line below will always be false unless the value of
                   // RTCORBA::maxPriority, which is now assigned the value of
                   // 32767, is changed in RTCORBA.pidl.
//              || bands[i].high > RTCORBA::maxPriority
             )
            {
              throw PortableServer::POA::InvalidPolicy ();
            }
        }

      // Check 3.
      if (rt_priority_model == TAO::Portable_Server::Cached_Policies::SERVER_DECLARED)
        {
          int match = 0;
          for (CORBA::ULong i = 0; i < bands.length (); ++i)
            {
//.........这里部分代码省略.........
开发者ID:OspreyHub,项目名称:ATCD,代码行数:101,代码来源:RT_Policy_Validator.cpp


示例19:

void
TAO_POA_Default_Policy_Validator::validate_impl (TAO_Policy_Set &policies)
{
#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
  CORBA::Policy_var policy =
    policies.get_cached_policy (TAO_CACHED_POLICY_SERVANT_RETENTION);

  PortableServer::ServantRetentionPolicy_var srp =
    PortableServer::ServantRetentionPolicy::_narrow (policy.in ());
  PortableServer::ServantRetentionPolicyValue servant_retention =
    srp->value ();

  policy = policies.get_cached_policy (TAO_CACHED_POLICY_REQUEST_PROCESSING);

  PortableServer::RequestProcessingPolicy_var rpp =
    PortableServer::RequestProcessingPolicy::_narrow (policy.in ());
  PortableServer::RequestProcessingPolicyValue request_processing =
    rpp->value ();

  // The NON_RETAIN policy requires either the USE_DEFAULT_SERVANT or
  // USE_SERVANT_MANAGER policies.
  if (servant_retention == PortableServer::NON_RETAIN)
    if (request_processing != PortableServer::USE_SERVANT_MANAGER &&
        request_processing  != PortableServer::USE_DEFAULT_SERVANT)
      throw PortableServer::POA::InvalidPolicy ();

  // USE_ACTIVE_OBJECT_MAP_ONLY requires the RETAIN policy.
  if (request_processing == PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY)
    if (servant_retention != PortableServer::RETAIN)
      throw PortableServer::POA::InvalidPolicy ();

  policy = policies.get_cached_policy (TAO_CACHED_POLICY_ID_UNIQUENESS);

  PortableServer::IdUniquenessPolicy_var iup =
    PortableServer::IdUniquenessPolicy::_narrow (policy.in ());
  PortableServer::IdUniquenessPolicyValue id_uniqueness =
    iup->value ();

  policy =
    policies.get_cached_policy (TAO_CACHED_POLICY_IMPLICIT_ACTIVATION);

  PortableServer::ImplicitActivationPolicy_var iap =
    PortableServer::ImplicitActivationPolicy::_narrow (policy.in ());
  PortableServer::ImplicitActivationPolicyValue implicit_activation =
    iap->value ();

  policy = policies.get_cached_policy (TAO_CACHED_POLICY_ID_ASSIGNMENT);

  PortableServer::IdAssignmentPolicy_var idap =
    PortableServer::IdAssignmentPolicy::_narrow (policy.in ());
  PortableServer::IdAssignmentPolicyValue id_assignment =
    idap->value ();

  // USE_DEFAULT_SERVANT requires the MULTIPLE_ID policy.
  if (request_processing == PortableServer::USE_DEFAULT_SERVANT)
    if (id_uniqueness != PortableServer::MULTIPLE_ID)
      throw PortableServer::POA::InvalidPolicy ();

  // IMPLICIT_ACTIVATION requires the SYSTEM_ID and RETAIN policies.
  if (implicit_activation == PortableServer::IMPLICIT_ACTIVATION)
    if (servant_retention != PortableServer::RETAIN ||
        id_assignment != PortableServer::SYSTEM_ID)
      throw PortableServer::POA::InvalidPolicy ();
#else /* TAO_HAS_MINIMUM_POA == 0 */
  ACE_UNUSED_ARG (policies);
#endif /* TAO_HAS_MINIMUM_POA == 0 */
}
开发者ID:asdlei00,项目名称:ACE,代码行数:67,代码来源:Default_Policy_Validator.cpp


示例20: catch

int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{

  try
    {
      // Initialize the ORB first.
      CORBA::ORB_var orb =
        CORBA::ORB_init (argc, argv);

      CORBA::Object_var object =
        orb->resolve_initial_references ("RTORB");

      RTCORBA::RTORB_var rtorb =
        RTCORBA::RTORB::_narrow (object.in ());

      /*
       * The following code should be reenabled once the OMG spec has
       * been fixed such that a RTCORBA::PriorityModelPolicy can be
       * created by using the ORB::create_policy interface.
       *
      {
        RTCORBA::PriorityModelPolicy_var policy1 =
          rtorb->create_priority_model_policy (RTCORBA::CLIENT_PROPAGATED,
                                               RTCORBA::minPriority);

        CORBA::Any policy_value;
        policy_value <<= RTCORBA::CLIENT_PROPAGATED;
        policy_value <<= RTCORBA::minPriority;

        CORBA::Policy_var policy =
          orb->create_policy (RTCORBA::PRIORITY_MODEL_POLICY_TYPE,
                              policy_value);

        RTCORBA::PriorityModelPolicy_var policy2 =
          RTCORBA::PriorityModelPolicy::_narrow (policy.in ());

        ACE_ASSERT (policy1->priority_model () == policy2->priority_model ());
        ACE_ASSERT (policy1->server_priority () == policy2->server_priority ());
      }

      */

      {
        RTCORBA::ThreadpoolId poolid = 0;

        RTCORBA::ThreadpoolPolicy_var policy1 =
          rtorb->create_threadpool_policy (poolid);

        CORBA::Any policy_value;
        policy_value <<= poolid;

        CORBA::Policy_var policy =
          orb->create_policy (RTCORBA::THREADPOOL_POLICY_TYPE,
                              policy_value);

        RTCORBA::ThreadpoolPolicy_var policy2 =
          RTCORBA::ThreadpoolPolicy::_narrow (policy.in ());

        ACE_ASSERT (policy1->threadpool () == policy2->threadpool ());
      }

      {
        RTCORBA::ProtocolList empty_protocols;

        RTCORBA::ServerProtocolPolicy_var policy1 =
          rtorb->create_server_protocol_policy (empty_protocols);

        CORBA::Any policy_value;
        policy_value <<= empty_protocols;

        CORBA::Policy_var policy =
          orb->create_policy (RTCORBA::SERVER_PROTOCOL_POLICY_TYPE,
                              policy_value);

        RTCORBA::ServerProtocolPolicy_var policy2 =
          RTCORBA::ServerProtocolPolicy::_narrow (policy.in ());

        RTCORBA::ProtocolList_var protocols1 =
          policy1->protocols ();
        RTCORBA::ProtocolList_var protocols2 =
          policy2->protocols ();

        ACE_ASSERT (protocols1->length () == protocols2->length ());
      }

      {
        RTCORBA::ProtocolList empty_protocols;

        RTCORBA::ClientProtocolPolicy_var policy1 =
          rtorb->create_client_protocol_policy (empty_protocols);

        CORBA::Any policy_value;
        policy_value <<= empty_protocols;

        CORBA::Policy_var policy =
          orb->create_policy (RTCORBA::CLIENT_PROTOCOL_POLICY_TYPE,
                              policy_value);

        RTCORBA::ClientProtocolPolicy_var policy2 =
//.........这里部分代码省略.........
开发者ID:manut,项目名称:TAO,代码行数:101,代码来源:Policies.cpp



注:本文中的corba::Policy_var类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ corba::String_var类代码示例发布时间:2022-05-31
下一篇:
C++ corba::Policy_ptr类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap