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


C++ ORB_ptr::resolve_initial_references方法代码示例

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


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

示例1:

void
TAO_RT_Notify_Service::init_i (CORBA::ORB_ptr orb)
{
  //Init the base class.
  TAO_CosNotify_Service::init_i (orb);

  TAO_Notify_RT_Properties* properties = TAO_Notify_RT_PROPERTIES::instance();

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

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

  // Resolve RTCurrent
  object =
    orb->resolve_initial_references ("RTCurrent");

  RTCORBA::Current_var current =
    RTCORBA::Current::_narrow (object.in ());

 /// Set the properties
  properties->rt_orb (rt_orb.in ());
  properties->current (current.in ());
}
开发者ID:asdlei00,项目名称:ACE,代码行数:26,代码来源:RT_Notify_Service.cpp

示例2: policies

Test::Hello_var
prepare_tests (CORBA::ORB_ptr orb, PortableServer::POA_ptr root_poa)
{
  register_factories(orb);

  CORBA::Object_var objectman =
    orb->resolve_initial_references ("ORBPolicyManager");

  CORBA::PolicyManager_var policy_manager =
    CORBA::PolicyManager::_narrow (objectman.in ());

  PortableServer::POA_var my_compress_poa = 0;
  CORBA::PolicyList policies(4);
  policies.length(4);

  try
    {
      policies[0] = create_compressor_id_level_list_policy (orb);
      policies[1] = create_low_value_policy (orb);
      policies[2] = create_compression_enabled_policy (orb);
      policies[3] = create_min_ratio_policy (orb);

      my_compress_poa = root_poa->create_POA("My_Compress_Poa", 0, policies);
    }
  catch(const CORBA::PolicyError&)
    {
      policies.length(0);
      my_compress_poa = root_poa->create_POA("My_Compress_Poa", 0, policies);
    }

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

  CORBA::Object_var pcobject =
    orb->resolve_initial_references ("PolicyCurrent");

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

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

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

  Hello *hello_impl = 0;
  ACE_NEW_RETURN (hello_impl,
                  Hello (orb),
                  0);
  PortableServer::ServantBase_var owner_transfer(hello_impl);

  PortableServer::ObjectId_var id =
    my_compress_poa->activate_object (hello_impl);

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

  Test::Hello_var hello = Test::Hello::_narrow (object.in ());

  poa_manager->activate ();

  return hello._retn ();
}
开发者ID:jiaoyk,项目名称:ATCD,代码行数:59,代码来源:server.cpp

示例3: main

int main(int argc, char ** argv)
{
    try {
        // init ORB
        CORBA::ORB_ptr orb = CORBA::ORB_init(argc, argv);
 
        // init POA
        CORBA::Object_var poa_obj = orb->resolve_initial_references("RootPOA");
        PortableServer::POA_var poa = PortableServer::POA::_narrow(poa_obj);
        PortableServer::POAManager_var manager = poa->the_POAManager();
 
        // create service
        Math_operation * service = new Math_operation;
 
        // register within the naming service
        try {
            CORBA::Object_var ns_obj = orb->resolve_initial_references("NameService");
            if (!CORBA::is_nil(ns_obj)) {
                CosNaming::NamingContext_ptr nc = CosNaming::NamingContext::_narrow(ns_obj);
                CosNaming::Name name;
                name.length(1);
                name[0].id = CORBA::string_dup("TestServer");
                name[0].kind = CORBA::string_dup("");
                nc->rebind(name, service->_this());
                cout << argv[0] << ": server 'TestServer' bound" << endl;
            }
        } catch (CosNaming::NamingContext::NotFound &) {
            cerr << "not found" << endl;
        } catch (CosNaming::NamingContext::InvalidName &) {
            cerr << "invalid name" << endl;
        } catch (CosNaming::NamingContext::CannotProceed &) {
            cerr << "cannot proceed" << endl;
        }
 
        // run
        manager->activate();
        orb->run();
 
        // clean up
        delete service;
 
        // quit
        orb->destroy();
    } catch (CORBA::UNKNOWN) {
        cerr << "unknown exception" << endl;
    } catch (CORBA::SystemException &) {
        cerr << "system exception" << endl;
    }
}
开发者ID:jrupal16,项目名称:Practice-Repository,代码行数:49,代码来源:server.cpp

示例4: tmp

EDF_Scheduler::EDF_Scheduler (CORBA::ORB_ptr orb,
                              Kokyu::DSRT_Dispatcher_Impl_t disp_impl_type,
                              int ace_sched_policy,
                              int ace_sched_scope)
  : orb_ (CORBA::ORB::_duplicate (orb)),
    disp_impl_type_ (disp_impl_type),
    ace_sched_policy_ (ace_sched_policy),
    ace_sched_scope_ (ace_sched_scope)
{

  Kokyu::DSRT_ConfigInfo config;

  config.impl_type_ = this->disp_impl_type_;
  config.sched_policy_ = ace_sched_policy_;
  config.sched_scope_ = ace_sched_scope_;

  Kokyu::DSRT_Dispatcher_Factory<EDF_Scheduler_Traits>::DSRT_Dispatcher_Auto_Ptr
    tmp( Kokyu::DSRT_Dispatcher_Factory<EDF_Scheduler_Traits>::
         create_DSRT_dispatcher (config) );
  DSUI_EVENT_LOG (EDF_SCHED_FAM, CONSTRUCTOR, 0, 0, 0);

  kokyu_dispatcher_ = tmp;

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

  this->current_ =
    RTScheduling::Current::_narrow (object.in ());

  IOP::CodecFactory_var codec_factory;
  CORBA::Object_var obj =
    orb->resolve_initial_references ("CodecFactory");

  if (CORBA::is_nil(obj.in ()))
    {
      ACE_ERROR ((LM_ERROR, "Nil Codec factory\n"));
    }
  else
    {
      codec_factory = IOP::CodecFactory::_narrow (obj.in ());
    }

  IOP::Encoding encoding;
  encoding.format = IOP::ENCODING_CDR_ENCAPS;
  encoding.major_version = 1;
  encoding.minor_version = 2;

  codec_ = codec_factory->create_codec (encoding);
}
开发者ID:CCJY,项目名称:ATCD,代码行数:49,代码来源:EDF_Scheduler.cpp

示例5: catch

int
TAO_IFR_Server::init_with_orb (int argc,
                               ACE_TCHAR *argv [],
                               CORBA::ORB_ptr orb,
                               int use_multicast_server)
{
  try
    {
      // Get the POA from the ORB.
      CORBA::Object_var poa_object =
        orb->resolve_initial_references ("RootPOA");

      if (CORBA::is_nil (poa_object.in ()))
        {
          ORBSVCS_ERROR_RETURN ((LM_ERROR,
                             ACE_TEXT ("(%P|%t) IFR_Service::init_with_orb ")
                             ACE_TEXT ("Unable to initialize the POA.\n")),
                            -1);
        }
      PortableServer::POA_var rp =
        PortableServer::POA::_narrow (poa_object.in ());
      return this->init_with_poa (argc, argv, orb, rp.in(), use_multicast_server);
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("IFR_Service::init_with_orb");

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

示例6: INTERNAL

void
TAO_Notify_Service_Driver::apply_timeout (CORBA::ORB_ptr orb)
{
#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
  if (this->timeout_ != 0)
    {
      // convert from msec to "TimeT"
      CORBA::Any timeout;
      TimeBase::TimeT value = 10000 * this->timeout_;
      timeout <<= value;

      CORBA::Object_var object =
        orb->resolve_initial_references ("ORBPolicyManager");
      CORBA::PolicyManager_var policy_manager =
        CORBA::PolicyManager::_narrow (object.in ());
      if (CORBA::is_nil (policy_manager.in ()))
        throw CORBA::INTERNAL ();

      CORBA::PolicyList policy_list (1);
      policy_list.length (1);
      policy_list[0] = orb->create_policy (
                              Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE,
                              timeout);
      policy_manager->set_policy_overrides (policy_list, CORBA::SET_OVERRIDE);
      policy_list[0]->destroy ();
  }
#else
  ACE_UNUSED_ARG (orb);
#endif /* TAO_HAS_CORBA_MESSAGING != 0 */
}
开发者ID:esohns,项目名称:ATCD,代码行数:30,代码来源:Notify_Service.cpp

示例7: catch

int
TAO_Naming_Server::init (CORBA::ORB_ptr orb,
                         PortableServer::POA_ptr poa,
                         size_t context_size,
                         ACE_Time_Value *timeout,
                         bool resolve_for_existing_naming_service,
                         const ACE_TCHAR *persistence_location,
                         void *base_addr,
                         int enable_multicast,
                         int use_storable_context,
                         int round_trip_timeout,
                         int use_round_trip_timeout)
{
  if (resolve_for_existing_naming_service)
    {
      try
        {
          // Try to find an existing Naming Service.
          CORBA::Object_var naming_obj =
            orb->resolve_initial_references ("NameService", timeout);

          if (!CORBA::is_nil (naming_obj.in ()))
            {
              //
              // Success in finding a Naming Service.
              //
              if (TAO_debug_level > 0)
                ORBSVCS_DEBUG ((LM_DEBUG,
                            "\nNameService found!\n"));

              this->naming_context_ =
                CosNaming::NamingContext::_narrow (naming_obj.in ());

              this->naming_service_ior_ =
                orb->object_to_string (naming_obj.in ());

              return 0;
            }
        }
      catch (const CORBA::Exception& ex)
        {
          ex._tao_print_exception ("TAO_Naming_Server::init");
        }
    }

  if (TAO_debug_level > 0)
    ORBSVCS_DEBUG ((LM_DEBUG,
                "\nWe'll become a NameService\n"));

  // Become a Naming Service.
  return this->init_new_naming (orb,
                                poa,
                                persistence_location,
                                base_addr,
                                context_size,
                                enable_multicast,
                                use_storable_context,
                                round_trip_timeout,
                                use_round_trip_timeout);
}
开发者ID:CCJY,项目名称:ATCD,代码行数:60,代码来源:Naming_Server.cpp

示例8:

void
TAO_CosNotify_Service::init_i2 (CORBA::ORB_ptr orb, CORBA::ORB_ptr dispatching_orb)
{
  // Obtain the Root POA
  CORBA::Object_var object  =
    orb->resolve_initial_references("RootPOA");

  if (CORBA::is_nil (object.in ()))
    ORBSVCS_ERROR ((LM_ERROR, " (%P|%t) Unable to resolve the RootPOA.\n"));

  PortableServer::POA_var default_poa = PortableServer::POA::_narrow (object.in ());

  // Set the properties
  TAO_Notify_Properties* properties = TAO_Notify_PROPERTIES::instance();

  properties->orb (orb);
  properties->dispatching_orb (dispatching_orb);
  properties->separate_dispatching_orb (true);

  properties->default_poa (default_poa.in ());

  // Init the factory and builder
  this->factory_.reset (this->create_factory ());
  ACE_ASSERT( this->factory_.get() != 0 );
  TAO_Notify_PROPERTIES::instance()->factory (this->factory_.get());

  this->builder_.reset (this->create_builder ());
  ACE_ASSERT( this->builder_.get() != 0 );
  TAO_Notify_PROPERTIES::instance()->builder (this->builder_.get());
}
开发者ID:CCJY,项目名称:ATCD,代码行数:30,代码来源:CosNotify_Service.cpp

示例9: init_compressor

static int init_compressor(::CORBA::ORB_ptr orb)
{
    try {

        ::CORBA::Object_var compression_manager =
            orb->resolve_initial_references(TAO_OBJID_COMPRESSIONMANAGER);

        ::Compression::CompressionManager_var manager =
            ::Compression::CompressionManager::_narrow(compression_manager.in());

        if (::CORBA::is_nil(manager.in())) {
            ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("ERROR: nil compression manager.\n")),-1);
        }

        Compression::CompressorFactory_ptr compressor_factory;
        ACE_NEW_RETURN (compressor_factory, TAO::RLE_CompressorFactory (), 1);
        Compression::CompressorFactory_var compr_fact = compressor_factory;

        manager->register_factory (compr_fact.in ());

    } catch (...) {
        ACE_ERROR_RETURN((LM_ERROR,
            ACE_TEXT("ERROR: Unable to initialise RLE compressor manager.\n")),-1);
    }

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

示例10:

CORBA::InterfaceDef_ptr
TAO_IFR_Client_Adapter_Impl::get_interface (
    CORBA::ORB_ptr orb,
    const char *repo_id)
{
    CORBA::Object_var obj =
        orb->resolve_initial_references ("InterfaceRepository");

    if (CORBA::is_nil (obj.in ()))
    {
        throw ::CORBA::INTF_REPOS ();
    }

    CORBA::Repository_var repo =
        CORBA::Repository::_narrow (obj.in ()
                                   );

    if (CORBA::is_nil (repo.in ()))
    {
        throw ::CORBA::INTF_REPOS ();
    }

    CORBA::Contained_var result = repo->lookup_id (repo_id);

    if (CORBA::is_nil (result.in ()))
    {
        return CORBA::InterfaceDef::_nil ();
    }
    else
    {
        return CORBA::InterfaceDef::_narrow (result.in ());
    }
}
开发者ID:svn2github,项目名称:ACE-Middleware,代码行数:33,代码来源:IFR_Client_Adapter_Impl.cpp

示例11:

TAO_Scheduler::TAO_Scheduler (CORBA::ORB_ptr orb)
{
  CORBA::Object_var current_obj =
    orb->resolve_initial_references ("RTScheduler_Current");

  current_ = RTScheduling::Current::_narrow (current_obj.in ());
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:7,代码来源:Scheduler.cpp

示例12:

int
register_factories (CORBA::ORB_ptr orb)
{
  CORBA::Object_var compression_manager_obj =
    orb->resolve_initial_references("CompressionManager");

  compression_manager = ::Compression::CompressionManager::_narrow (
            compression_manager_obj.in ());

  if (CORBA::is_nil(compression_manager.in ()))
    ACE_ERROR_RETURN ((LM_ERROR,
                       " (%P|%t) Panic: nil compression manager\n"),
                      1);
  //register Zlib compressor
  ::Compression::CompressorFactory_ptr compressor_factory;
  ACE_NEW_RETURN (compressor_factory, TAO::Zlib_CompressorFactory (), 1);
  ::Compression::CompressorFactory_var compr_fact = compressor_factory;
  compression_manager->register_factory(compr_fact.in ());

  // register bzip2 compressor
  ACE_NEW_RETURN (compressor_factory, TAO::Bzip2_CompressorFactory (), 1);
  compr_fact = compressor_factory;
  compression_manager->register_factory(compr_fact.in ());

  // register test compressor
  ACE_NEW_RETURN (compressor_factory, TAO::Test_CompressorFactory (), 1);
  compr_fact = compressor_factory;
  compression_manager->register_factory(compr_fact.in ());
  return 0;
}
开发者ID:manut,项目名称:TAO,代码行数:30,代码来源:client.cpp

示例13: 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

示例14: getObjectReference

static CORBA::Object_ptr getObjectReference(CORBA::ORB_ptr orb) {
  CosNaming::NamingContext_var rootContext;
  
  try {
    // Obtain a reference to the root context of the Name service:
    CORBA::Object_var obj;
    obj = orb->resolve_initial_references("NameService");

    // Narrow the reference returned.
    rootContext = CosNaming::NamingContext::_narrow(obj);
    if( CORBA::is_nil(rootContext) ) {
      cerr << "Failed to narrow the root naming context." << endl;
      return CORBA::Object::_nil();
    }
  } catch (CORBA::NO_RESOURCES&) {
    cerr << "Caught NO_RESOURCES exception. You must configure omniORB "
	 << "with the location" << endl
	 << "of the naming service." << endl;
    return 0;
  } catch(CORBA::ORB::InvalidName& ex) {
    // This should not happen!
    cerr << "Service required is invalid [does not exist]." << endl;
    return CORBA::Object::_nil();
  }

  // Create a name object, containing the name test/context:
  CosNaming::Name name;
  name.length(2);

  name[0].id   = (const char*) "test";       // string copied
  name[0].kind = (const char*) "my_context"; // string copied
  name[1].id   = (const char*) "IdServer";
  name[1].kind = (const char*) "Object";
  // Note on kind: The kind field is used to indicate the type
  // of the object. This is to avoid conventions such as that used
  // by files (name.type -- e.g. test.ps = postscript etc.)

  try {
    // Resolve the name to an object reference.
    return rootContext->resolve(name);
  } catch(CosNaming::NamingContext::NotFound& ex) {
    // This exception is thrown if any of the components of the
    // path [contexts or the object] aren't found:
    cerr << "Context not found." << endl;
  } catch(CORBA::TRANSIENT& ex) {
    cerr << "Caught system exception TRANSIENT -- unable to contact the "
         << "naming service." << endl
	 << "Make sure the naming server is running and that omniORB is "
	 << "configured correctly." << endl;

  } catch(CORBA::SystemException& ex) {
    cerr << "Caught a CORBA::" << ex._name()
	 << " while using the naming service." << endl;
    return 0;
  }

  return CORBA::Object::_nil();
}
开发者ID:vibonadia,项目名称:CORBAIDServer,代码行数:58,代码来源:idserver_clt.cpp

示例15: OrganizationProxyTests

 /*!
  * @brief Constructor
  */
 OrganizationProxyTests()
 {
   int argc = 0;
   char** argv = NULL;
   m_pORB = CORBA::ORB_init(argc, argv);
   m_pPOA = PortableServer::POA::_narrow(
                    m_pORB->resolve_initial_references("RootPOA"));
   m_pPOA->the_POAManager()->activate();
 }
开发者ID:yosuke,项目名称:OpenRTM-aist-portable,代码行数:12,代码来源:OrganizationProxyTests.cpp


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