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

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

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

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



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

示例1: policies

PortableServer::POA_ptr
setup_poa (PortableServer::POA_ptr root_poa)
{
  // Policies for the childPOA to be created.
  CORBA::PolicyList policies (2);
  policies.length (2);

  // Tell the POA to use a servant manager.
  policies[0] =
    root_poa->create_request_processing_policy (PortableServer::USE_SERVANT_MANAGER);

  // Allow implicit activation.
  policies[1] =
    root_poa->create_implicit_activation_policy (PortableServer::IMPLICIT_ACTIVATION);

  PortableServer::POAManager_var poa_manager =
    root_poa->the_POAManager ();

  // Create POA as child of RootPOA with the above policies.  This POA
  // will use a SERVANT_ACTIVATOR because of RETAIN policy.
  PortableServer::POA_var child_poa =
    root_poa->create_POA ("childPOA",
                          poa_manager.in (),
                          policies);

  // Creation of childPOAs is over. Destroy the Policy objects.
  for (CORBA::ULong i = 0;
       i < policies.length ();
       ++i)
    {
      policies[i]->destroy ();
    }

  return child_poa._retn ();
}
开发者ID:asdlei00,项目名称:ACE,代码行数:35,代码来源:server.cpp


示例2:

PortableServer::POA_ptr
createPOA (PortableServer::POA_ptr root_poa,
           bool share_mgr,
           const char* poa_name)
{
  PortableServer::LifespanPolicy_var life =
    root_poa->create_lifespan_policy(PortableServer::PERSISTENT);

  PortableServer::IdAssignmentPolicy_var assign =
    root_poa->create_id_assignment_policy(PortableServer::USER_ID);

  CORBA::PolicyList pols;
  pols.length(2);
  pols[0] = PortableServer::LifespanPolicy::_duplicate(life.in());
  pols[1] = PortableServer::IdAssignmentPolicy::_duplicate(assign.in());

  PortableServer::POAManager_var mgr = PortableServer::POAManager::_nil();
  if (share_mgr)
    {
      mgr = root_poa->the_POAManager();
    }
  PortableServer::POA_var poa =
    root_poa->create_POA(poa_name, mgr.in(), pols);

  life->destroy();
  assign->destroy();

  return poa._retn();
}
开发者ID:asdlei00,项目名称:ACE,代码行数:29,代码来源:server.cpp


示例3: create_persistent_poa

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

PortableServer::POA_var create_persistent_poa(PortableServer::POA_var root_poa,
                                              PortableServer::POAManager_var mgr,
                                              const char* name,
                                              CORBA::PolicyList& policy_list)
{
  PortableServer::POA_var result;
    PortableServer::LifespanPolicy_var lifespan =
    root_poa->create_lifespan_policy(PortableServer::PERSISTENT);

  // create a USER_ID IdAssignmentPolicy object
  PortableServer::IdAssignmentPolicy_var assign =
    root_poa->create_id_assignment_policy(PortableServer::USER_ID);

  // create PolicyList.
  size_t orig_len =  policy_list.length();
  policy_list.length(orig_len+2);
  policy_list[orig_len+0]=
    PortableServer::LifespanPolicy::_duplicate(lifespan.in());
  policy_list[orig_len+1]=
    PortableServer::IdAssignmentPolicy::_duplicate(assign.in());

  // create the child POA
  result = root_poa->create_POA(name, mgr.in(), policy_list);


  return result;
}
开发者ID:binary42,项目名称:OCI,代码行数:29,代码来源:create_persistent_poa.cpp


示例4: set_request_timeout_thread

void Test_xyz_serverTAOLayer::set_request_timeout_thread(
    int timeout_ms)
{
    ACE_Guard<ACE_Recursive_Thread_Mutex> guard(shutting_down_mutex_, 0);
    if (!guard.locked())
    {
        ACE_DEBUG((LM_ERROR, "Acquiring shutting_down_mutex_ failed.\n"));
        return;
    }

    request_timeout_thread_ms_ = timeout_ms;

    // TimeT has 100 nanosecond resolution.
    int usec(10); // ==> usec
    int msec(1000); // ==> msec
    int timeout_ns = usec * msec * timeout_ms;

    TimeBase::TimeT relative_rt_timeout = timeout_ns;
    CORBA::Any relative_rt_timeout_as_any;
    relative_rt_timeout_as_any <<= relative_rt_timeout;

    // Create the policy and put it in a policy list.
    CORBA::PolicyList policies;
    policies.length(1);
    policies[0] = orb()->create_policy(Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE, relative_rt_timeout_as_any);

    // Apply the policy at the ORB level using the ORBPolicyManager.
    policy_current_->set_policy_overrides(policies, CORBA::SET_OVERRIDE);

    // Cleanup.
    policies[0]->destroy ();
}
开发者ID:htalbot,项目名称:DPOpp,代码行数:32,代码来源:test_xyz_serverTAOLayer.cpp


示例5: set_connection_timeout_orb

void Test_xyz_serverTAOLayer::set_connection_timeout_orb(
    int timeout_ms)
{
    ACE_Guard<ACE_Recursive_Thread_Mutex> guard(shutting_down_mutex_, 0);
    if (!guard.locked())
    {
        ACE_DEBUG((LM_ERROR, "Acquiring shutting_down_mutex_ failed.\n"));
        return;
    }

    // This method has effect on remote connection (server host different from client host)
    connection_timeout_orb_ms_ = timeout_ms;

    // TimeT has 100 nanosecond resolution.
    int usec(10); // ==> usec
    int msec(1000); // ==> msec
    int timeout_ns = usec * msec * timeout_ms;

    TimeBase::TimeT relative_rt_timeout = timeout_ns;
    CORBA::Any relative_rt_timeout_as_any;
    relative_rt_timeout_as_any <<= relative_rt_timeout;

    CORBA::PolicyList policies;
    policies.length(1);
    policies[0] = orb()->create_policy (TAO::CONNECTION_TIMEOUT_POLICY_TYPE, relative_rt_timeout_as_any);

    policy_manager_->set_policy_overrides (policies, CORBA::SET_OVERRIDE);

    // Cleanup.
    policies[0]->destroy ();
}
开发者ID:htalbot,项目名称:DPOpp,代码行数:31,代码来源:test_xyz_serverTAOLayer.cpp


示例6: policies

CORBA::Boolean
ImR_Adapter::unknown_adapter (PortableServer::POA_ptr parent,
                              const char *name)
{
  ACE_ASSERT (! CORBA::is_nil(parent));
  ACE_ASSERT (name != 0);
  CORBA::PolicyList policies (3);

  const char *exception_message = "Null Message";
  policies.length (3);
  try
    {
      // Servant Retention Policy
      exception_message = "While PortableServer::POA::create_servant_retention_policy";
      policies[0] =
        parent->create_servant_retention_policy (PortableServer::NON_RETAIN);

      // Request Processing Policy
      exception_message = "While PortableServer::POA::create_request_processing_policy";

      policies[1] =
        parent->create_request_processing_policy (PortableServer::USE_DEFAULT_SERVANT);
      policies[2] =
        parent->create_id_uniqueness_policy (PortableServer::MULTIPLE_ID);

      PortableServer::POAManager_var poa_manager =
        parent->the_POAManager ();

      exception_message = "While create_POA";
      PortableServer::POA_var child =
        parent->create_POA (name,
                            poa_manager.in (),
                            policies);

      exception_message = "While policy->destroy";
      for (CORBA::ULong i = 0; i < policies.length (); ++i)
        {
          CORBA::Policy_ptr policy = policies[i];
          policy->destroy ();
        }

      exception_message = "While child->the_activator";
      child->the_activator (this);

      exception_message = "While set_servant";
      child->set_servant (this->default_servant_);
    }
  catch (const CORBA::Exception& ex)
    {
      ORBSVCS_ERROR ((LM_ERROR,
                  "IMR_Adapter_Activator::unknown_adapter - %s\n",
                  exception_message));
      ex._tao_print_exception ("System Exception");
      return 0;
    }

  // Finally, now everything is fine
  return 1;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:59,代码来源:Adapter_Activator.cpp


示例7: policies

int
configure_policies (CORBA::ORB_ptr orb,
                    const TAO::BufferingConstraint &buffering_constraint,
                    Test::AMI_Buffering_ptr ami_buffering,
                    Test::AMI_Buffering_out flusher)
{
  CORBA::Object_var object =
    orb->resolve_initial_references ("PolicyCurrent");

  CORBA::PolicyCurrent_var policy_current =
    CORBA::PolicyCurrent::_narrow (object.in ());

  if (CORBA::is_nil (policy_current.in ()))
    {
      ACE_ERROR ((LM_ERROR, "ERROR: Nil policy current\n"));
      return 1;
    }
  CORBA::Any scope_as_any;
  scope_as_any <<= Messaging::SYNC_NONE;

  CORBA::Any buffering_as_any;
  buffering_as_any <<= buffering_constraint;

  CORBA::PolicyList policies (2); policies.length (2);
  policies[0] =
    orb->create_policy (Messaging::SYNC_SCOPE_POLICY_TYPE,
                        scope_as_any);
  policies[1] =
    orb->create_policy (TAO::BUFFERING_CONSTRAINT_POLICY_TYPE,
                        buffering_as_any);

  policy_current->set_policy_overrides (policies, CORBA::ADD_OVERRIDE);

  policies[0]->destroy ();
  policies[1]->destroy ();

  TAO::BufferingConstraint flush_constraint;
  flush_constraint.mode = TAO::BUFFER_FLUSH;
  flush_constraint.message_count = 0;
  flush_constraint.message_bytes = 0;
  flush_constraint.timeout = 0;

  buffering_as_any <<= flush_constraint;
  policies.length (1);
  policies[0] =
    orb->create_policy (TAO::BUFFERING_CONSTRAINT_POLICY_TYPE,
                        buffering_as_any);

  object =
    ami_buffering->_set_policy_overrides (policies,
                                             CORBA::ADD_OVERRIDE);

  policies[0]->destroy ();

  flusher =
    Test::AMI_Buffering::_narrow (object.in ());

  return 0;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:59,代码来源:client.cpp


示例8: policies

int
Manager::init (int argc, ACE_TCHAR *argv[])
{
  this->orb_ = CORBA::ORB_init (argc, argv);

  // Obtain the RootPOA.
  CORBA::Object_var obj_var =
    this->orb_->resolve_initial_references ("RootPOA");

  // Get the POA_var object from Object_var.
  PortableServer::POA_var root_poa_var =
    PortableServer::POA::_narrow (obj_var.in ());

  // Get the POAManager of the RootPOA.
  PortableServer::POAManager_var poa_manager_var =
    root_poa_var->the_POAManager ();

  poa_manager_var->activate ();

  // Policies for the childPOA to be created.
  CORBA::PolicyList policies (4);
  policies.length (4);

  // The next two policies are common to both
  // Id Assignment Policy
  policies[0] =
    root_poa_var->create_id_assignment_policy (PortableServer::USER_ID);

  // Lifespan policy
  policies[1] =
    root_poa_var->create_lifespan_policy (PortableServer::PERSISTENT);

  // Tell the POA to use a servant manager
  policies[2] =
    root_poa_var->create_request_processing_policy (PortableServer::USE_SERVANT_MANAGER);

  // Servant Retention Policy -> Use a locator
  policies[3] =
    root_poa_var->create_servant_retention_policy (PortableServer::NON_RETAIN);

  ACE_CString name = "newPOA";

  this->new_poa_var_ =
    root_poa_var->create_POA (name.c_str (),
                              poa_manager_var.in (),
                              policies);

  // Creation of childPOAs is over. Destroy the Policy objects.
  for (CORBA::ULong i = 0;
       i < policies.length ();
       ++i)
    {
      CORBA::Policy_ptr policy = policies[i];
      policy->destroy ();
    }

  return 0;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:58,代码来源:Manager.cpp


示例9: policies

RTPOA_Setup::RTPOA_Setup (CORBA::ORB_ptr orb,
                          const RTCORBA_Setup &rtcorba_setup)
{
  RTPortableServer::POA_var root_poa =
    RIR_Narrow<RTPortableServer::POA>::resolve (orb,
                                                "RootPOA");

  RTCORBA::RTORB_var rtorb =
    RIR_Narrow<RTCORBA::RTORB>::resolve (orb,
                                         "RTORB");

  const CORBA::ULong stacksize = 1024 * 1024; // 1 Mb
  const RTCORBA::ThreadpoolLanes &lanes = rtcorba_setup.lanes ();
  const CORBA::Boolean allow_borrowing = 0;
  const CORBA::Boolean allow_request_buffering = 0;
  const CORBA::ULong max_buffered_requests   = 0; // dummy value
  const CORBA::ULong max_request_buffer_size = 0; // dummy value

  RTCORBA::ThreadpoolId pool_id =
    rtorb->create_threadpool_with_lanes (stacksize,
                                         lanes,
                                         allow_borrowing,
                                         allow_request_buffering,
                                         max_buffered_requests,
                                         max_request_buffer_size);

  // @@ We need an 'auto_ptr for thread pools' here!
  CORBA::PolicyList policies (4); policies.length (4);
  policies[0] =
    rtorb->create_priority_model_policy (RTCORBA::CLIENT_PROPAGATED,
                                         rtcorba_setup.process_priority ());

  policies[1] =
    root_poa->create_id_assignment_policy (PortableServer::SYSTEM_ID);

  policies[2] =
    root_poa->create_implicit_activation_policy (PortableServer::IMPLICIT_ACTIVATION);

#if 0
  policies.length (3);
#else
  policies[3] =
    rtorb->create_threadpool_policy (pool_id);
#endif /* 0 */

  PortableServer::POAManager_var poa_manager =
    root_poa->the_POAManager ();

  this->poa_ =
    root_poa->create_POA ("RTEC_Perf",
                          poa_manager.in (),
                          policies);

  for (CORBA::ULong i = 0; i != policies.length (); ++i)
    {
      policies[i]->destroy ();
    }
}
开发者ID:asdlei00,项目名称:ACE,代码行数:58,代码来源:RTPOA_Setup.cpp


示例10: policies

int
create_POA_and_register_servant (CORBA::Policy_ptr threadpool_policy,
                                 const char *poa_name,
                                 PortableServer::POAManager_ptr poa_manager,
                                 PortableServer::POA_ptr root_poa,
                                 CORBA::ORB_ptr orb,
                                 RTCORBA::RTORB_ptr rt_orb)
{
  // Policies for the firstPOA to be created.
  CORBA::PolicyList policies (3); policies.length (3);

  // Implicit_activation policy.
  policies[0] =
    root_poa->create_implicit_activation_policy
    (PortableServer::IMPLICIT_ACTIVATION);

  // Thread pool policy.
  policies[1] =
    CORBA::Policy::_duplicate (threadpool_policy);

  // Priority Model policy.
  policies[2] =
    rt_orb->create_priority_model_policy (RTCORBA::CLIENT_PROPAGATED, 0);

  // Create the POA under the RootPOA.
  PortableServer::POA_var poa =
    root_poa->create_POA (poa_name,
                          poa_manager,
                          policies);

  // Creation of POAs is over. Destroy the Policy objects.
  for (CORBA::ULong i = 0;
       i < policies.length ();
       ++i)
    {
      policies[i]->destroy ();
    }

  test_i *servant =
    new test_i (orb,
                poa.in (),
                nap_time);

  PortableServer::ServantBase_var safe_servant (servant);
  ACE_UNUSED_ARG (safe_servant);

  PortableServer::ObjectId_var id =
    poa->activate_object (servant);

  CORBA::Object_var object = poa->id_to_reference (id.in ());

  test_var test = test::_narrow (object.in ());

  int const result = write_ior_to_file (orb, test.in ());

  return result;
}
开发者ID:manut,项目名称:TAO,代码行数:57,代码来源:server.cpp


示例11: createPersistPOA

POA_ptr createPersistPOA(const char* name, POA_ptr root_poa, POAManager_ptr poaman) {
  CORBA::PolicyList policies (2);
  policies.length (2);
  policies[0] = root_poa->create_id_assignment_policy(USER_ID);
  policies[1] = root_poa->create_lifespan_policy(PERSISTENT);
  POA_var poa = root_poa->create_POA(name, poaman, policies);
  policies[0]->destroy();
  policies[1]->destroy();
  return poa._retn();
}
开发者ID:asdlei00,项目名称:ACE,代码行数:10,代码来源:test_server.cpp


示例12: policies

int
init_callback (Worker &w)
{
  CORBA::Object_var obj =
    w.orb_->resolve_initial_references ("RootPOA");

  if (CORBA::is_nil (obj.in ()))
    ACE_ERROR_RETURN ((LM_ERROR,
                       " (%P|%t) Unable to initialize the POA.\n"),
                      1);

  PortableServer::POA_var root_poa =
    PortableServer::POA::_narrow (obj.in ());

  PortableServer::POAManager_var poa_manager =
    root_poa->the_POAManager ();

  // Policies for the childPOA to be created.
  CORBA::PolicyList policies (1);
  policies.length (1);

  CORBA::Any pol;
  pol <<= BiDirPolicy::BOTH;
  policies[0] =
    w.orb_->create_policy (BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE,
                        pol);

  // Create POA as child of RootPOA with the above policies.  This POA
  // will receive request in the same connection in which it sent
  // the request
  PortableServer::POA_var child_poa =
    root_poa->create_POA ("childPOA",
                          poa_manager.in (),
                          policies);


  Callback_i *servant = new Callback_i;
  PortableServer::ServantBase_var owner = servant;

  PortableServer::ObjectId_var id = child_poa->activate_object (servant);
  obj = child_poa->id_to_reference (id.in());
  w.callback_ = Test::CallBack::_narrow(obj.in());

  // Creation of childPOA is over. Destroy the Policy objects.
  for (CORBA::ULong i = 0;
       i < policies.length ();
       ++i)
    {
      policies[i]->destroy ();
    }

  poa_manager->activate ();

  return 0;
}
开发者ID:chenbk85,项目名称:ACE-Middleware,代码行数:55,代码来源:client.cpp


示例13:

void
Client::set_private_connection_policies (void)
{
  CORBA::PolicyList policies;
  policies.length (1);

  policies[0] =
    this->rt_orb_->create_private_connection_policy ();

  this->policy_manager_->set_policy_overrides (policies,
                                               CORBA::ADD_OVERRIDE);
}
开发者ID:manut,项目名称:TAO,代码行数:12,代码来源:client.cpp


示例14: srv

int
Echo_Client_i::run (const char *name,
                    int argc,
                    ACE_TCHAR *argv[])
{
  // Initialize the client.
  if (client_.init (name, argc, argv) == -1)
    return -1;

  if (this->parse_args (argc, argv) == -1)
    return -1;

  try
    {
      CORBA::PolicyList policyList;
      policyList.length(1);
      CORBA::Any objectTimeout;
      TimeBase::TimeT to = 50000;
      to *= 365 * 24 * 3600;
      to *= 100;
      objectTimeout <<= to;
      policyList[0] = client_.orb()->create_policy(
          Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE,
          objectTimeout);
      CORBA::Object_var object =
        client_->_set_policy_overrides(policyList, CORBA::ADD_OVERRIDE);

      Echo_var srv(Echo::_narrow(object.in ()));

      char* buf = new char [this->payload_length_+ 1];
      ACE_OS::memset (buf, 'a', this->payload_length_);
      buf[this->payload_length_] = '\0';
      ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Sending len: %d \n"), ACE_OS::strlen (buf)));

      CORBA::String_var s = srv->echo_string (buf);

      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("\nString echoed by client has len %d\n"),
                  ACE_OS::strlen(s.in ())));

      delete [] buf;

      if (client_.do_shutdown () == 1)
        client_->shutdown ();
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("\n Exception in RMI");
      return -1;
    }

  return 0;
}
开发者ID:chenbk85,项目名称:ACE-Middleware,代码行数:53,代码来源:Echo_Client_i.cpp


示例15: policies

void
Quoter_Stock_Factory_i::load_stock_objects (
      PortableServer::POA_ptr poa,
      PortableServer::POAManager_ptr poa_manager,
      RtecEventChannelAdmin::SupplierAdmin_ptr supplier_admin)
{
  if (!CORBA::is_nil (this->stock_factory_poa_.in ()))
    return;

  CORBA::PolicyList policies (2);
  policies.length (2);

  policies[0] =
    poa->create_id_assignment_policy (PortableServer::USER_ID);
  policies[1] =
    poa->create_implicit_activation_policy (PortableServer::NO_IMPLICIT_ACTIVATION);

  this->stock_factory_poa_ =
    poa->create_POA ("Stock_Factory_POA",
                     poa_manager,
                     policies);

  for (CORBA::ULong i = 0; i != policies.length (); ++i) {
    policies[i]->destroy ();
  }

  while (!cin.eof () && cin.peek () != EOF) {
    const int max_symbol_length = 8;
    char symbol[max_symbol_length];
    const int max_full_name_length = 64;
    char full_name[max_full_name_length];
    double price;

    cin.getline (symbol, max_symbol_length, '\n');
    cin.getline (full_name, max_full_name_length, '\n');
    cin >> price;
    cin.ignore (1, '\n');

    Quoter_Stock_i *stock =
      new Quoter_Stock_i (symbol, full_name, price);

    PortableServer::ServantBase_var servant = stock;

    PortableServer::ObjectId_var oid =
      PortableServer::string_to_ObjectId (symbol);

    this->stock_factory_poa_->activate_object_with_id (oid.in (),
                                                       servant.in ());
    stock->connect (supplier_admin);
  }
}
开发者ID:CCJY,项目名称:ATCD,代码行数:51,代码来源:Stock_Factory_i.cpp


示例16: InitOrb

    RTT_CORBA_API bool ApplicationServer::InitOrb(int argc, char* argv[], Seconds timeout ) {
      
        if ( !CORBA::is_nil(orb) ){
	  return false;
	}
        try {
            // First initialize the ORB, that will remove some arguments...
            orb =
                CORBA::ORB_init (argc, const_cast<char**>(argv),
                                 "omniORB4");
            if(timeout >= 0.1e-7)
            {
#if defined( CORBA_IS_TAO ) && defined( CORBA_TAO_HAS_MESSAGING )
                // Set the timeout value as a TimeBase::TimeT (100 nanosecond units)
                // and insert it into a CORBA::Any.
                TimeBase::TimeT relative_rt_timeout = timeout * 1.0e7;
                CORBA::Any relative_rt_timeout_as_any;
                relative_rt_timeout_as_any <<= relative_rt_timeout;

                // Create the policy and put it in a policy list.
                CORBA::PolicyList policies;
                policies.length(1);
                policies[0] = 
                orb->create_policy (Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE,
                                    relative_rt_timeout_as_any);

                // Apply the policy at the ORB level using the ORBPolicyManager.
                CORBA::Object_var obj = orb->resolve_initial_references ("ORBPolicyManager");
                CORBA::PolicyManager_var policy_manager = CORBA::PolicyManager::_narrow (obj.in());
                policy_manager->set_policy_overrides (policies, CORBA::SET_OVERRIDE);
#else
                log(Error) << "Ignoring ORB timeout setting in non-TAO/Messaging build." <<endlog();
#endif // CORBA_IS_TAO
            }
            // Also activate the POA Manager, since we may get call-backs !
            CORBA::Object_var poa_object =
                orb->resolve_initial_references ("RootPOA");
            rootPOA =
                PortableServer::POA::_narrow (poa_object.in ());
            PortableServer::POAManager_var poa_manager =
                rootPOA->the_POAManager ();
            poa_manager->activate ();
            return true;
        }
        catch (CORBA::Exception &e) {
            log(Error) << "Orb Init : CORBA exception raised!" << Logger::nl;
            Logger::log() << CORBA_EXCEPTION_INFO(e) << endlog();
	    std::cout << "ApplicationServer::InitOrb return false: ORBA exception raised\n";
        }
        return false;
    }
开发者ID:FynnGamadeyo,项目名称:rtt,代码行数:51,代码来源:ApplicationServer.cpp


示例17: init_QOS

void Test_xyz_serverTAOLayer::init_QOS()
{
    CORBA::Object_var object = orb()->resolve_initial_references("ORBPolicyManager");
    policy_manager_ = CORBA::PolicyManager::_narrow(object.in());

    object = orb()->resolve_initial_references("PolicyCurrent");
    policy_current_ = CORBA::PolicyCurrent::_narrow(object.in());

    // Disable all default policies.
    CORBA::PolicyList policies;
    policies.length(0);
    policy_manager_->set_policy_overrides(policies, CORBA::SET_OVERRIDE);
    policy_current_->set_policy_overrides(policies, CORBA::SET_OVERRIDE);
}
开发者ID:htalbot,项目名称:DPOpp,代码行数:14,代码来源:test_xyz_serverTAOLayer.cpp


示例18: policies

int
Client_Task::svc (void)
{
  ACE_DEBUG ((LM_DEBUG, "(%P|%t) Starting client task\n"));

  try
    {
      // Apply sync_none policy
      CORBA::Object_var object =
        orb_->resolve_initial_references ("PolicyCurrent");

      CORBA::PolicyCurrent_var policy_current =
        CORBA::PolicyCurrent::_narrow (object.in ());

      if (CORBA::is_nil (policy_current.in ()))
        {
          ACE_ERROR ((LM_ERROR, "ERROR: Nil policy current\n"));
          return 1;
        }
      CORBA::Any scope_as_any;
      scope_as_any <<= Messaging::SYNC_NONE;

      CORBA::PolicyList policies (1); policies.length (1);
      policies[0] =
        orb_->create_policy (Messaging::SYNC_SCOPE_POLICY_TYPE,
                            scope_as_any);
      policy_current->set_policy_overrides (policies, CORBA::ADD_OVERRIDE);

      policies[0]->destroy ();

      for (int i = 0; i != number_; ++i)
        {
          ACE_DEBUG ((LM_DEBUG,
                      "TAO (%P|%t) sending oneway invocation %d...\n", i));

          this->sender_->send_ready_message ();

          // Do it slowly.
          ACE_OS::sleep(ACE_Time_Value(0,250000));
         }
       }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Caught Exception");
      return -1;
    }
  ACE_DEBUG ((LM_DEBUG, "(%P|%t) Client task finished\n"));
  return 0;
}
开发者ID:chenbk85,项目名称:ACE-Middleware,代码行数:49,代码来源:Client_Task.cpp


示例19: policies

int
TAO_IFR_Server::create_poa (void)
{
  PortableServer::POAManager_var poa_manager =
    this->root_poa_->the_POAManager ();

  poa_manager->activate ();

  CORBA::PolicyList policies (5);
  policies.length (5);

  // ID Assignment Policy.
  policies[0] =
    this->root_poa_->create_id_assignment_policy (PortableServer::USER_ID);

  // Lifespan Policy.
  policies[1] =
    this->root_poa_->create_lifespan_policy (PortableServer::PERSISTENT);

  // Request Processing Policy.
  policies[2] =
    this->root_poa_->create_request_processing_policy (
        PortableServer::USE_DEFAULT_SERVANT
      );

  // Servant Retention Policy.
  policies[3] =
    this->root_poa_->create_servant_retention_policy (
        PortableServer::NON_RETAIN
      );

  // Id Uniqueness Policy.
  policies[4] =
    this->root_poa_->create_id_uniqueness_policy (
        PortableServer::MULTIPLE_ID
      );

  this->repo_poa_ =
    this->root_poa_->create_POA ("repoPOA",
                                 poa_manager.in (),
                                 policies);

  policies[0]->destroy ();

  return 0;
}
开发者ID:esohns,项目名称:ATCD,代码行数:46,代码来源:IFR_Service_Utils.cpp


示例20: catch

int
ORB_Task::svc (void)
{
  try
  {
    CORBA::Object_var ncRef =
        orb_->string_to_object(
            "corbaloc:iiop:10.175.12.99:15025/NameService" );

    CORBA::PolicyList policies;

    TimeBase::TimeT timeout = 5000 * 10000;

    CORBA::Any timeoutAny;
    timeoutAny <<= timeout;

    policies.length(1);
    policies[0] = orb_->create_policy(
      Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE,
      timeoutAny );

    CORBA::Object_var object = ncRef->_set_policy_overrides(
      policies, CORBA::SET_OVERRIDE );

    policies[0]->destroy();

    CosNaming::NamingContext_var namingContext =
      CosNaming::NamingContext::_narrow( object.in() );
    namingContext->_non_existent();
  }
  catch ( const CORBA::TRANSIENT&)
  {
    ACE_DEBUG ((LM_DEBUG, "Caught transient\n"));
  }
  catch ( const CORBA::TIMEOUT&)
  {
    ACE_DEBUG ((LM_DEBUG, "Caught timeout\n"));
  }
  catch ( const CORBA::Exception& e )
  {
      e._tao_print_exception ("Exception caught");
  }

  return 0;
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:45,代码来源:ORB_Task.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ corba::Policy_ptr类代码示例发布时间:2022-05-31
下一篇:
C++ corba::Object_var类代码示例发布时间: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