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


C++ POA_ptr::reference_to_servant方法代码示例

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


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

示例1:

void
test_reference_to_servant_active_object(PortableServer::POA_ptr root_poa)
{
  test_i test;
  CORBA::ULong expected_refcount = 1;

  PortableServer::ObjectId_var id =
    root_poa->activate_object (&test);
  expected_refcount++;

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

  PortableServer::ServantBase_var servant =
    root_poa->reference_to_servant (object.in ());
  ++expected_refcount;

  root_poa->deactivate_object (id.in ());
  --expected_refcount;

  CORBA::ULong refcount =
    test._refcount_value ();

  ACE_UNUSED_ARG (refcount);
  ACE_UNUSED_ARG (expected_refcount);
  ACE_ASSERT (expected_refcount == refcount);
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:27,代码来源:Default_Servant.cpp

示例2: servant

void
test_poas (CORBA::ORB_ptr orb,
           PortableServer::POA_ptr root_poa,
           PortableServer::POA_ptr first_poa,
           PortableServer::POA_ptr second_poa,
           PortableServer::POA_ptr third_poa,
           PortableServer::POA_ptr forth_poa,
           int perform_deactivation_test)
{
  {
    test_i servant (root_poa);

    CORBA::Object_var obj = root_poa->create_reference ("IDL:test:1.0");

    CORBA::String_var string = orb->object_to_string (obj.in ());

    ACE_DEBUG ((LM_DEBUG, "%C\n", string.in ()));

    PortableServer::ObjectId_var id = root_poa->reference_to_id (obj.in ());

    root_poa->activate_object_with_id (id.in (),
                                       &servant);

    obj = root_poa->id_to_reference (id.in ());

    string = orb->object_to_string (obj.in ());

    ACE_DEBUG ((LM_DEBUG, "%C\n", string.in ()));

    PortableServer::ServantBase_var servant_from_reference =
      root_poa->reference_to_servant (obj.in ());

    PortableServer::ServantBase_var servant_from_id =
      root_poa->id_to_servant (id.in ());

    if (servant_from_reference.in () != servant_from_id.in ()
        || servant_from_reference.in () != &servant)
      {
        ACE_ERROR ((LM_ERROR,
                    "Mismatched servant_from_reference, "
                    "servant_from_id and &servant\n"));
      }

    obj = root_poa->servant_to_reference (&servant);

    string = orb->object_to_string (obj.in ());

    ACE_DEBUG ((LM_DEBUG, "%C\n", string.in ()));

    obj = servant._this ();

    string = orb->object_to_string (obj.in ());

    ACE_DEBUG ((LM_DEBUG, "%C\n", string.in ()));

    PortableServer::ObjectId_var id_from_servant = root_poa->servant_to_id (&servant);

    ACE_ASSERT (id_from_servant.in () == id.in ());

    root_poa->deactivate_object (id.in ());

    if (perform_deactivation_test)
      {
        root_poa->activate_object_with_id (id.in (),
                                           &servant);

        servant_from_reference = root_poa->reference_to_servant (obj.in ());

        ACE_ASSERT (servant_from_reference.in () == &servant);

        root_poa->deactivate_object (id.in ());
      }
  }

  {
    test_i servant (root_poa);

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

    CORBA::Object_var obj = root_poa->id_to_reference (id.in ());

    CORBA::String_var string = orb->object_to_string (obj.in ());

    ACE_DEBUG ((LM_DEBUG, "%C\n", string.in ()));

    obj = root_poa->create_reference_with_id (id.in (),
                                              "IDL:test:1.0");

    string = orb->object_to_string (obj.in ());

    ACE_DEBUG ((LM_DEBUG, "%C\n", string.in ()));

    root_poa->deactivate_object (id.in ());
  }

  {
    test_i servant (first_poa);

    CORBA::Object_var obj = first_poa->create_reference ("IDL:test:1.0");

//.........这里部分代码省略.........
开发者ID:chenbk85,项目名称:ACE-Middleware,代码行数:101,代码来源:Identity.cpp


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