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


C++ Simple_Server_var::any_test方法代码示例

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


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

示例1: if

void
do_primary_test (CORBA::ORB_var &orb, Simple_Server_var &server)
{
	try
	{
		CORBA::Object_var nilobj = CORBA::Object::_nil();

		CORBA::Object_var object =
			orb->string_to_object (ior);

		server =
			Simple_Server::_narrow (object.in ());

		if (CORBA::is_nil (server.in ()))
		{
			ACE_ERROR ((LM_ERROR,
				    "Object reference <%s> is nil\n",
				    ior));
			return;
		}

		CORBA::Short x = server->s();
		ACE_ERROR ((LM_ERROR,"Server->s() returned %d\n", x));
		server->s(510);
		Structure the_in_structure;
		the_in_structure.i = x;
		the_in_structure.seq.length (10);
		the_in_structure.obj = CORBA::Object::_duplicate(server.in());
		Structure_var out_struct;
		CORBA::String_var name = CORBA::string_dup ("test");
		server->struct_test (12345,
				     the_in_structure,
				     out_struct.out(),
				     name.inout());
		CORBA::String_var outior =
			orb->object_to_string(out_struct->obj);
		ACE_DEBUG ((LM_DEBUG,"Got outior:\n%s\n", outior.in()));

		if (test_user_exception == 1)
		{
			server->raise_user_exception ();
		}
		else if (test_system_exception == 1)
		{
			server->raise_system_exception ();
		}
		if (test_user_exception != 0 ||
		    test_system_exception != 0)
		{
			ACE_DEBUG ((LM_DEBUG,"Expected exception not caught!\n"));
			return;
		}

		ACE_DEBUG ((LM_DEBUG,"Sending main ref\n"));
		CORBA::Object_var echo = server->echo_object (server.in());
		ACE_DEBUG ((LM_DEBUG,"Sending nil ref\n"));
		echo = server->echo_object (nilobj.in());

		CORBA::Any a;
		a <<= "String through Any";
		CORBA::Boolean success = server->any_test (a);
		ACE_DEBUG ((LM_DEBUG,"any_test(string) returned %d\n",success));

		a <<= server.in();
		success = server->any_test (a);
		ACE_DEBUG ((LM_DEBUG,"any_test(objref) returned %d\n",success));

		for (int i = 0; i != niterations; ++i)
		{
			the_in_structure.i = i;
			CORBA::String_var name = CORBA::string_dup ("the name");

			Structure_var the_out_structure;

			CORBA::Long r =
				server->struct_test (i,
						     the_in_structure,
						     the_out_structure.out (),
						     name.inout ());

			ACE_DEBUG ((LM_DEBUG,
				    "DSI_Simpler_Server ====\n"
				    "    x = %d\n"
				    "    i = %d\n"
				    "    length = %d\n"
				    "    name = <%s>\n",
				    r,
				    the_out_structure->i,
				    the_out_structure->seq.length (),
				    name.in ()));

			if (r != i)
			{
				ACE_DEBUG ((LM_DEBUG,
					    "(%P|%t) unexpected result = %d for %d",
					    r, i));
			}
		}
	}
	catch (const test_exception& ex)
//.........这里部分代码省略.........
开发者ID:colding,项目名称:lorica,代码行数:101,代码来源:client.cpp


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