当前位置: 首页>>代码示例>>C++>>正文


C++ ORBInitInfo_ptr::register_initial_reference方法代码示例

本文整理汇总了C++中portableinterceptor::ORBInitInfo_ptr::register_initial_reference方法的典型用法代码示例。如果您正苦于以下问题:C++ ORBInitInfo_ptr::register_initial_reference方法的具体用法?C++ ORBInitInfo_ptr::register_initial_reference怎么用?C++ ORBInitInfo_ptr::register_initial_reference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在portableinterceptor::ORBInitInfo_ptr的用法示例。


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

示例1: current

    void
    Current_ORBInitializer_Base::pre_init (
      PortableInterceptor::ORBInitInfo_ptr info)
    {
      // Narrow to a TAO_ORBInitInfo object to get access to the
      // allocate_tss_slot_id() TAO extension.
      TAO_ORBInitInfo_var tao_info =
        TAO_ORBInitInfo::_narrow (info);

      if (CORBA::is_nil (tao_info.in ()))
        {
          if (TAO_debug_level > 0)
            TAOLIB_ERROR ((LM_ERROR,
                        "TAO (%P|%t) TAO::Transport::ORBInitializer::pre_init - "
                        "Panic: unable to narrow the ORBInitInfo_ptr\n"));

          throw ::CORBA::INTERNAL ();
        }

      // Reserve a TSS slot in the ORB core internal TSS resources for the
      // thread-specific portion of the Current object.
      size_t tss_slot = tao_info->allocate_tss_slot_id (0);

      // Create the Current
      Current_var current (this->make_current_instance (tao_info->orb_core (),
                                                        tss_slot));

      info->register_initial_reference (ACE_TEXT_ALWAYS_CHAR (this->id_.fast_rep ()),
                                        current.in ());
    }
开发者ID:OspreyHub,项目名称:ATCD,代码行数:30,代码来源:Current_ORBInitializer_Base.cpp

示例2: INV_OBJREF

void
TAO::SSLIOP::ORBInitializer::pre_init (
    PortableInterceptor::ORBInitInfo_ptr info)
{
  TAO_ORBInitInfo_var tao_info = TAO_ORBInitInfo::_narrow (info);

  if (CORBA::is_nil (tao_info.in ()))
    throw CORBA::INV_OBJREF ();

  // SSLIOP doesn't use the ORB Core until a request invocation occurs
  // so there is no problem in retrieving the ORB Core pointer in this
  // pre_init() method.
  TAO_ORB_Core *orb_core = tao_info->orb_core ();

  // Create the SSLIOP::Current object.
  // Note that a new SSLIOP::Current object is created for each ORB.
  // It wouldn't be very useful to share security context information
  // with another ORB that isn't configured with security, for
  // example.
  SSLIOP::Current_ptr current;
  ACE_NEW_THROW_EX (current,
                    TAO::SSLIOP::Current (orb_core),
                    CORBA::NO_MEMORY (
                      CORBA::SystemException::_tao_minor_code (
                        TAO::VMCID,
                        ENOMEM),
                      CORBA::COMPLETED_NO));

  SSLIOP::Current_var ssliop_current = current;

  // Register the SSLIOP::Current object reference with the ORB.
  info->register_initial_reference ("SSLIOPCurrent", ssliop_current.in ());
}
开发者ID:asdlei00,项目名称:ACE,代码行数:33,代码来源:SSLIOP_ORBInitializer.cpp

示例3:

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

void
TAO_RTScheduler_ORB_Initializer::pre_init (
    PortableInterceptor::ORBInitInfo_ptr info)
{
  //
  // Register all of the RT related services.
  //

  // Create the RT_Current.

  // Narrow to a TAO_ORBInitInfo object to get access to the
  // orb_core() TAO extension.

  if (TAO_debug_level > 0)
    TAOLIB_DEBUG ((LM_DEBUG,
                "In pre_init\n"));

  TAO_ORBInitInfo_var tao_info = TAO_ORBInitInfo::_narrow (info);

  if (CORBA::is_nil (tao_info.in ()))
    {
      if (TAO_debug_level > 0)
        TAOLIB_ERROR ((LM_ERROR,
                    "(%P|%t) Security_ORBInitializer::pre_init:\n"
                    "(%P|%t)    Unable to narrow "
                    "\"PortableInterceptor::ORBInitInfo_ptr\" to\n"
                    "(%P|%t)   \"TAO_ORBInitInfo *.\"\n"));

      throw ::CORBA::INTERNAL ();
    }

  TAO_RTScheduler_Current *tmp_current = 0;
  ACE_NEW_THROW_EX (tmp_current,
                    TAO_RTScheduler_Current,
                    CORBA::NO_MEMORY (
                      CORBA::SystemException::_tao_minor_code (
                        TAO::VMCID,
                        ENOMEM),
                      CORBA::COMPLETED_NO));
  this->current_ = tmp_current;

  this->current_->init (tao_info->orb_core ());

  CORBA::Object_var current_obj =
    RTScheduling::Current::_narrow (this->current_.in ());

  info->register_initial_reference ("RTScheduler_Current", current_obj.in ());

  Client_Interceptor *client_interceptor = 0;
  ACE_NEW_THROW_EX (client_interceptor,
                    Client_Interceptor,
                    CORBA::NO_MEMORY (
                        CORBA::SystemException::_tao_minor_code (
                        TAO::VMCID,
                        ENOMEM),
                        CORBA::COMPLETED_NO));

  PortableInterceptor::ClientRequestInterceptor_var safe_client =
    client_interceptor;

  info->add_client_request_interceptor (client_interceptor);

  Server_Interceptor *server_interceptor = 0;
  ACE_NEW_THROW_EX (server_interceptor,
                    Server_Interceptor (this->current_.in ()),
                    CORBA::NO_MEMORY (
                        CORBA::SystemException::_tao_minor_code (
                        TAO::VMCID,
                        ENOMEM),
                        CORBA::COMPLETED_NO));

  PortableInterceptor::ServerRequestInterceptor_var safe_server =
    server_interceptor;

  info->add_server_request_interceptor (server_interceptor);

  // Set the RTScheduler_Manager
  TAO_RTScheduler_Manager *manager = 0;

  ACE_NEW_THROW_EX (manager,
                    TAO_RTScheduler_Manager (tao_info->orb_core ()),
                    CORBA::NO_MEMORY (
                      CORBA::SystemException::_tao_minor_code (
                        TAO::VMCID,
                        ENOMEM),
                      CORBA::COMPLETED_NO));


  TAO_RTScheduler_Manager_var safe_manager = manager;

  info->register_initial_reference ("RTSchedulerManager", manager);
}
开发者ID:asdlei00,项目名称:ACE,代码行数:94,代码来源:RTScheduler_Initializer.cpp

示例4: catch

void 
ORBInitializerImpl::post_init (PortableInterceptor::ORBInitInfo_ptr info)
{
    //
	// First resolve the Name Service
	//
    CORBA::Object_var obj;

	try
    {
        obj = info->resolve_initial_references("NameService");
    }
    catch (const CORBA::ORB::InvalidName&)
    {
		std::cerr << "ORBInitializerImpl: Can't resolve NameService" << std::endl;
		return;
    }

    if (CORBA::is_nil(obj.in()))
    {
		std::cerr << "ORBInitializerImpl: NameService is a nil object reference" << std::endl;
		return;
    }

	try
	{
		nameService_ = CosNaming::NamingContext::_narrow(obj.in());
	}
	catch (const CORBA::Exception&)
	{
		std::cerr << "ORBInitializerImpl: NameService is not running" << std::endl;
		return;
	}

    if (CORBA::is_nil(nameService_.in()))
    {
		std::cerr << "ORBInitializerImpl: NameService is not a NamingContext object reference" << std::endl;
		return;
    }

    //
	// Resolve the HomeFinder
	//
	Qedo_Components::HomeFinder_var home_finder;
	obj = resolveName("Qedo/HomeFinder");

	if (CORBA::is_nil(obj.in()))
    {
		std::cerr << "ORBInitializerImpl: HomeFinder not found" << std::endl;
		return;
    }

    try
    {
        home_finder = Qedo_Components::HomeFinder::_narrow(obj);
    }
    catch (CORBA::SystemException&)
    {
        std::cerr << "ORBInitializerImpl: HomeFinder is not running" << std::endl;
		return;
    }

	if (CORBA::is_nil(home_finder.in()))
    {
		std::cerr << "ORBInitializerImpl: HomeFinder is not running" << std::endl;
		return;
    }

	//
	// register HomeFinder
	//
	info->register_initial_reference ("ComponentHomeFinder", home_finder);

	//
	// Allocate a slot id to communicate data towards our components
	//
	slot_id_ = info->allocate_slot_id();
}
开发者ID:BackupTheBerlios,项目名称:qedo-svn,代码行数:78,代码来源:ORBInitializerImpl.cpp

示例5: INTERNAL

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

void
TAO::Security::ORBInitializer::pre_init (
    PortableInterceptor::ORBInitInfo_ptr info)
{
  // Narrow to a TAO_ORBInitInfo object to get access to the
  // allocate_tss_slot_id() TAO extension.
  TAO_ORBInitInfo_var tao_info =
    TAO_ORBInitInfo::_narrow (info);

  if (CORBA::is_nil (tao_info.in ()))
    {
      if (TAO_debug_level > 0)
        ORBSVCS_ERROR ((LM_ERROR,
                    "(%P|%t) Security_ORBInitializer::pre_init:\n"
                    "(%P|%t)    Unable to narrow "
                    "\"PortableInterceptor::ORBInitInfo_ptr\" to\n"
                    "(%P|%t)   \"TAO_ORBInitInfo_ptr.\"\n"));

      throw CORBA::INTERNAL ();
    }

  // Reserve a TSS slot in the ORB core internal TSS resources for the
  // thread-specific portion of Security::Current.
  size_t tss_slot = tao_info->allocate_tss_slot_id (0 /* no cleanup function */);

#if 1

#if 0 // why am I getting a BAD_OPERATION from no SSL context?!
  CORBA::String_var orb_id = info->orb_id ();

  // Create the SecurityLevel2::Current object.
  SecurityLevel2::Current_ptr current = SecurityLevel2::Current::_nil ();
  ACE_NEW_THROW_EX (current,
                    TAO_Security_Current (tss_slot, orb_id.in ()),
                    CORBA::NO_MEMORY (
                                      CORBA::SystemException::_tao_minor_code (
                         TAO::VMCID,
                         ENOMEM),
                       CORBA::COMPLETED_NO));

  SecurityLevel2::Current_var security_current = current;

  // Register the SecurityLevel2::Current object reference with the
  // ORB.
  info->register_initial_reference ("SecurityCurrent",
                                    security_current.in ());
#endif
  /*
   * Instantiate and register the SecurityLevel2::SecurityManager
   */
  SecurityLevel2::SecurityManager_ptr manager2;
  ACE_NEW_THROW_EX (manager2,
                    TAO::Security::SecurityManager (/*need args*/),
                    CORBA::NO_MEMORY (
                      CORBA::SystemException::_tao_minor_code (
                        TAO::VMCID,
                        ENOMEM),
                      CORBA::COMPLETED_NO));

  SecurityLevel2::SecurityManager_var security_manager2 = manager2;

  // Register the SecurityLevel2::SecurityManager object reference
  // with the ORB.
  info->register_initial_reference ("SecurityLevel2:SecurityManager",
                                    security_manager2.in ());

#endif

  // Rather than reserve another TSS slot in the ORB core internal TSS
  // resources for the thread-specific portion of
  // SecurityLevel3::SecurityCurrent object, we will re-use the slot
  // allocated earlier.

  // Create the SecurityLevel3::Current object.
  SecurityLevel3::SecurityCurrent_ptr current3;
  ACE_NEW_THROW_EX (current3,
                    TAO::SL3::SecurityCurrent (tss_slot,
                                               tao_info->orb_core ()),
                    CORBA::NO_MEMORY (
                      CORBA::SystemException::_tao_minor_code (
                        TAO::VMCID,
                        ENOMEM),
                      CORBA::COMPLETED_NO));

  SecurityLevel3::SecurityCurrent_var security_current3 = current3;

  // Register the SecurityLevel2::Current object reference with the
  // ORB.
  info->register_initial_reference ("SecurityLevel3:SecurityCurrent",
                                    security_current3.in ());

  // Create the SecurityLevel3::CredentialsCurator object.
  SecurityLevel3::CredentialsCurator_ptr curator;
  ACE_NEW_THROW_EX (curator,
                    TAO::SL3::CredentialsCurator,
                    CORBA::NO_MEMORY (
                      CORBA::SystemException::_tao_minor_code (
                        TAO::VMCID,
//.........这里部分代码省略.........
开发者ID:asdlei00,项目名称:ACE,代码行数:101,代码来源:Security_ORBInitializer.cpp

示例6: switch

void
TAO_RT_ORBInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr info)
{
  //
  // Register all of the RT related services.
  //

  // Narrow to a TAO_ORBInitInfo object to get access to the
  // orb_core() TAO extension.
  TAO_ORBInitInfo_var tao_info = TAO_ORBInitInfo::_narrow (info);

  if (CORBA::is_nil (tao_info.in ()))
    {
      if (TAO_debug_level > 0)
        TAOLIB_ERROR ((LM_ERROR,
                    "(%P|%t) TAO_RT_ORBInitializer::pre_init:\n"
                    "(%P|%t)    Unable to narrow "
                    "\"PortableInterceptor::ORBInitInfo_ptr\" to\n"
                    "(%P|%t)   \"TAO_ORBInitInfo *.\"\n"));

      throw ::CORBA::INTERNAL ();
    }

  // Bind the service context handler for RTCORBA
  TAO_RT_Service_Context_Handler* h = 0;
  ACE_NEW (h,
           TAO_RT_Service_Context_Handler());
  tao_info->orb_core ()->service_context_registry ().bind (IOP::RTCorbaPriority, h);

  // Set the name of the Protocol_Hooks to be RT_Protocols_Hooks.
  tao_info->orb_core ()->orb_params ()->protocols_hooks_name ("RT_Protocols_Hooks");
  ACE_Service_Config::process_directive (ace_svc_desc_TAO_RT_Protocols_Hooks);

  // Set the name of the stub factory to be RT_Stub_Factory.
  tao_info->orb_core ()->orb_params ()->stub_factory_name ("RT_Stub_Factory");
  ACE_Service_Config::process_directive (ace_svc_desc_TAO_RT_Stub_Factory);

  // Set the name of the endpoint selector factory to be RT_Endpoint_Selector_Factory.
  tao_info->orb_core ()->orb_params ()->endpoint_selector_factory_name ("RT_Endpoint_Selector_Factory");
  ACE_Service_Config::process_directive (ace_svc_desc_RT_Endpoint_Selector_Factory);

  // Set the name of the thread lane resources manager to be RT_Thread_Lane_Resources_Manager.
  tao_info->orb_core ()->orb_params ()->thread_lane_resources_manager_factory_name ("RT_Thread_Lane_Resources_Manager_Factory");
  ACE_Service_Config::process_directive (ace_svc_desc_TAO_RT_Thread_Lane_Resources_Manager_Factory);

  // If the application resolves the root POA, make sure we load the RT POA.
  tao_info->orb_core ()->orb_params ()->poa_factory_name (rt_poa_factory_name);
  tao_info->orb_core ()->orb_params ()->poa_factory_directive (rt_poa_factory_directive);

  // Create the initial priority mapping instance.
  TAO_Priority_Mapping *pm = 0;
  switch (this->priority_mapping_type_)
    {
    case TAO_PRIORITY_MAPPING_CONTINUOUS:
      ACE_NEW (pm,
               TAO_Continuous_Priority_Mapping (this->ace_sched_policy_));
      break;
    case TAO_PRIORITY_MAPPING_LINEAR:
      ACE_NEW (pm,
               TAO_Linear_Priority_Mapping (this->ace_sched_policy_));
      break;
    default:
    case TAO_PRIORITY_MAPPING_DIRECT:
      ACE_NEW (pm,
               TAO_Direct_Priority_Mapping (this->ace_sched_policy_));
      break;
    }

  // Set the Priority_Mapping_Manager
  TAO_Priority_Mapping_Manager *manager = 0;

  ACE_NEW_THROW_EX (manager,
                    TAO_Priority_Mapping_Manager (pm),
                    CORBA::NO_MEMORY (
                      CORBA::SystemException::_tao_minor_code (
                        TAO::VMCID,
                        ENOMEM),
                      CORBA::COMPLETED_NO));

  TAO_Priority_Mapping_Manager_var safe_manager = manager;

  info->register_initial_reference ("PriorityMappingManager", manager);

  // Create the initial priority mapping instance.
  TAO_Network_Priority_Mapping *npm = 0;
  switch (this->network_priority_mapping_type_)
    {
    default:
    case TAO_NETWORK_PRIORITY_MAPPING_LINEAR:
      ACE_NEW (npm,
               TAO_Linear_Network_Priority_Mapping (this->ace_sched_policy_));
      break;
    }

  // Set the Priority_Mapping_Manager
  TAO_Network_Priority_Mapping_Manager * network_manager = 0;

  // @@ There is a potential memory leak here.  If the new() below
  //    throws an exception, the memory for the network priority
  //    mapping allocated above will be leaked.  Use an auto_ptr<> or
//.........这里部分代码省略.........
开发者ID:OspreyHub,项目名称:ATCD,代码行数:101,代码来源:RT_ORBInitializer.cpp

示例7: safe

void
Server_ORBInitializer::pre_init (
    PortableInterceptor::ORBInitInfo_ptr orbinitinfo)
{
    POA_TestModule::test* test = 0;
    ACE_NEW (test,
             test_i);
    PortableServer::ServantBase_var safe (test);

    CORBA::Object_var object = test->_this ();

    orbinitinfo->register_initial_reference ("MyService",
            object.in ());

    bool invalid_name = false;
    try
    {
        // Registering with an empty string should give an exception
        orbinitinfo->register_initial_reference ("",
                object.in ());
    }
    catch (const PortableInterceptor::ORBInitInfo::InvalidName&)
    {
        invalid_name = true;
    }
    catch (const CORBA::Exception&)
    {
    }

    if (!invalid_name)
        ACE_ERROR ((LM_ERROR, "ERROR: Registering with an empty string doesn't "
                    "throw an exception\n"));

    bool duplicate_name = false;
    try
    {
        // Registering with an duplicate string should give an exception
        orbinitinfo->register_initial_reference ("MyService",
                object.in ());
    }
    catch (const PortableInterceptor::ORBInitInfo::InvalidName&)
    {
        duplicate_name = true;
    }
    catch (const CORBA::Exception&)
    {
    }

    if (!duplicate_name)
        ACE_ERROR ((LM_ERROR, "ERROR: Registering with a duplicate with ORBInitInfo "
                    "doesn't throw the expected exception\n"));

    bool invalid_object = false;
    try
    {
        // Registering with a nil object
        orbinitinfo->register_initial_reference ("NilServer",
                CORBA::Object::_nil());
    }
    catch (const CORBA::BAD_PARAM& ex)
    {
        if (ex.minor () == (CORBA::OMGVMCID | 27))
        {
            invalid_object = true;
        }
    }
    catch (const CORBA::Exception&)
    {
    }

    if (!invalid_object)
        ACE_ERROR ((LM_ERROR, "ERROR: Registering with a nil object to ORBInitInfo "
                    "doesn't throw bad param with OMG minor code 27\n"));
}
开发者ID:akostrikov,项目名称:ATCD,代码行数:74,代码来源:Server_ORBInitializer.cpp


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