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


C++ Test_var::get_server_num方法代码示例

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


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

示例1: catch

int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
  try {
    // Initialize orb
    CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );

    if (parse_args (argc, argv) != 0)
      return 1;

    CORBA::Object_var obj = orb->resolve_initial_references("Test");
    ACE_ASSERT (!CORBA::is_nil(obj.in()));
    Test_var test = Test::_narrow( obj.in() );
    ACE_ASSERT (!CORBA::is_nil(test.in()));

    CORBA::Short n = test->get_server_num ();
    ACE_DEBUG ((LM_DEBUG,
                "Client received reply from server %d\n",
                n));
    if (expect_transient)
      return -1;
    return 0;

  }
  catch(const CORBA::TRANSIENT& ex) {
    if (expect_transient)
      return 0;

    ex._tao_print_exception ("client:");
  }
  catch(const CORBA::Exception& ex) {
    ex._tao_print_exception ("client:");
  }
  return -1;
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:35,代码来源:client.cpp

示例2: catch

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;

      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("(%P|%t|%T) Client %d sending request to %C\n"),
                  client_num, server_ior));
      try
        {
          CORBA::Object_var obj =
            orb->string_to_object (server_ior);
          ACE_ASSERT (!CORBA::is_nil (obj.in ()));
          Test_var test = Test::_narrow (obj.in());
          ACE_ASSERT (!CORBA::is_nil (test.in()));
          CORBA::Short n = test->get_server_num ();
          ACE_DEBUG ((LM_DEBUG,
                      ACE_TEXT ("(%P|%t|%T) Client %d received reply from server %d\n"),
                      client_num, n));
        }
      catch (CORBA::TRANSIENT &)
        {
          if (expect_transient)
            {
              ACE_DEBUG ((LM_DEBUG,
                          ACE_TEXT ("(%P|%t|%T) Client %d got expected transient exception\n"),
                          client_num));
            }
          else
            {
              ACE_DEBUG ((LM_DEBUG,
                          ACE_TEXT ("(%P|%t|%T) Client %d caught unexpected transent\n"),
                          client_num));
              return -1;
            }
        }
      return 0;

    }
  catch(const CORBA::Exception& ex)
    {
      ex._tao_print_exception (ACE_TEXT ("client:"));
    }

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

示例3: catch

int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
  try {
    // Initialize orb
    CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );

    if (parse_args (argc, argv) != 0)
      return 1;

    CORBA::Object_var obj = orb->resolve_initial_references("Test");
    Test_var test;

    try
      {
        test = Test::_narrow( obj.in() );
        if (killit)
          {
            test->terminate ();
          }
        else
          {
            CORBA::Short n = test->get_server_num ();
            ACE_DEBUG ((LM_DEBUG,
                        "Client received reply from server %d on first attempt\n",
                        n));
          }
      }
    catch (const CORBA::Exception &ex)
      {
        ex._tao_print_exception ("Client caught: ");
#if 0
        try
          {
            if (CORBA::is_nil (test.in()))
              {
                test = Test::_narrow( obj.in() );
              }
            CORBA::Short n = test->get_server_num ();
            ACE_DEBUG ((LM_DEBUG,
                        "Client received reply from server %d on second attempt\n",
                        n));
          }
        catch (const CORBA::Exception &ex)
          {
            ex._tao_print_exception ("Client second attempt: ");
          }
#endif
      }

    orb->destroy ();

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

  return -1;
}
开发者ID:,项目名称:,代码行数:61,代码来源:


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