本文整理汇总了C++中corba::String_var::out方法的典型用法代码示例。如果您正苦于以下问题:C++ String_var::out方法的具体用法?C++ String_var::out怎么用?C++ String_var::out使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corba::String_var
的用法示例。
在下文中一共展示了String_var::out方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runTests
int runTests(CORBA::ORB_var orb, First::IHello_ptr hello)
{
result = 0;
try
{
std::cout << " AddValue: ";
check(5 == hello->AddValue(2, 3));
}
catch (...)
{
check(false);
}
try
{
std::cout << " SayHello: ";
check(std::wstring(L"Hello, Andy. It's Bob.") == (wchar_t*)CORBA::WString_var(hello->SayHello(L"Andy")));
}
catch (...)
{
check(false);
}
try
{
std::cout << " SayHello2: ";
CORBA::String_var greeting;
hello->SayHello2("Andy", greeting.out());
check(std::string("Hello, Andy. It's Bob.") == (char*)greeting);
}
catch (...)
{
check(false);
}
try
{
std::cout << " Message: ";
CORBA::String_var message = "Hello, Bob";
hello->Message(message.inout());
check(std::string("Hello, Andy.") == (char*)message);
}
catch (...)
{
check(false);
}
try
{
std::cout << " MulComplex: ";
First::MyComplexNumber x, y;
x.re = 2, x.im = 3;
y.re = 5, y.im = 6;
First::MyComplexNumber expected;
expected.re = x.re * y.re - x.im * y.im;
expected.im = x.re * y.im + x.im - y.re;
First::MyComplexNumber result = hello->MulComplex(x, y);
check(equal(result, expected) && equal(result, y));
}
catch (...)
{
check(false);
}
try
{
std::cout << " MulComplexAsAny: ";
First::MyComplexNumber x, y;
x.re = 2, x.im = 3;
y.re = 5, y.im = 6;
First::MyComplexNumber expected;
expected.re = x.re * y.re - x.im * y.im;
expected.im = x.re * y.im + x.im - y.re;
CORBA::Any _x, _y;
_x <<= x;
_y <<= y;
CORBA::Any_var _result;
bool success = hello->MulComplexAsAny(_x, _y, _result.out());
First::MyComplexNumber* result;
_result >>= result;
check(success && result && equal(*result, expected));
}
catch (...)
{
check(false);
}
try
{
std::cout << " DataTimeTransfer: ";
SYSTEMTIME initial_systemtime = {};
initial_systemtime.wMilliseconds = 0;
initial_systemtime.wSecond = 0;
initial_systemtime.wMinute = 0;
//.........这里部分代码省略.........
示例2: svc
int synch_foo_generator::svc ()
{
::AsynchT::MyFoo_var my_foo_ami_ =
context_->get_connection_run_my_foo ();
ACE_OS::sleep(1);
CORBA::Boolean wait = false;
for (int i = 0; i < 3; ++i)
{
// Run some synch calls, answer has to come before the next step.
CORBA::String_var answer;
try
{
if( wait==true)
{
ACE_ERROR ((LM_ERROR,
"ERROR: NOT RECEIVED SYNCHRONOUS answer.\n"));
}
wait = true;
ACE_DEBUG ((LM_DEBUG, "OK: SEND SYNCHRONOUS CALL foo.\n"));
CORBA::Long result = my_foo_ami_->foo ("Do something synchronous",
2 ,
answer.out ());
if ( result == 2)
{
ACE_DEBUG ((LM_DEBUG, "OK: RECEIVED SYNCHRONOUS answer <%C>\n",
answer.in ()));
wait = false;
}
if ( wait==true)
{
ACE_ERROR ((LM_ERROR,
"ERROR: NOT RECEIVED SYNCHRONOUS answer.\n"));
}
wait = true;
CORBA::Long l_cmd = 0;
ACE_DEBUG ((LM_DEBUG, "OK: SEND SYNCHRONOUS CALL bar.\n"));
my_foo_ami_->bar (2,l_cmd);
if ( l_cmd == 2)
{
ACE_DEBUG ((LM_DEBUG, "OK: RECEIVED SYNCHRONOUS answer <%C>\n",
answer.in ()));
wait = false;
}
}
catch (const AsynchT::InternalError&)
{
ACE_ERROR ((LM_ERROR, "ERROR: synch_foo_generator::foo: "
"Unexpected exception.\n"));
}
}
return 0;
}
示例3: validate_name
CORBA::Boolean DynExceptImpl::validate_name()
throw(CORBA::SystemException)
{
try
{
CORBA::String_var str;
_next_value->read_string(str.out());
return (!strcmp(str, _base_type->id()));
}
catch(CORBA::TypeCode::BadKind)
{
throw CORBA::BAD_TYPECODE();
}
}
示例4: no_such_member
char *
Object_Group_i::resolve_with_id (const char * id)
{
CORBA::String_var ior;
if (this->members_->find (const_cast<char *> (id),
ior.out (), this->allocator_) == -1)
throw Load_Balancer::no_such_member ();
char *retn_ptr = CORBA::string_dup (ior.in ());
return retn_ptr;
}
示例5: svc
int synch_foo_generator::svc ()
{
::UsesMulti::Sender::run_my_um_oneConnections_var my_one_ami_ =
context_->get_connections_run_my_um_one ();
for(CORBA::ULong i = 0; i < my_one_ami_->length(); ++i)
{
CORBA::String_var test;
switch (i)
{
case 0:
test = CORBA::string_dup ("Synch. call 0.");
break;
case 1:
test = CORBA::string_dup ("Synch. call 1");
break;
case 2:
test = CORBA::string_dup ("Synch. call 2");
break;
default:
break;
}
ACE_DEBUG ((LM_DEBUG,"Sender (SYNCH) : send <%C> !\n",
test.in ()));
CORBA::String_var answer;
CORBA::ULong result = my_one_ami_[i].objref->foo( test,
i,
answer.out ());
if (result != i)
{
ACE_ERROR ((LM_ERROR,
"ERROR Sender (SYNCH) : CLASS One foo !\n"));
}
else
{
++this->nr_of_received_;
ACE_DEBUG ((LM_DEBUG,
"Sender (SYNCH) : received answer = <%C> !\n",
answer.in ()));
}
}
return 0;
}
示例6: svc
int synch_foo_generator::svc ()
{
::ThreeComp::Sender::run_my_fooConnections_var my_foo_ami_ =
context_->get_connections_run_my_foo ();
CORBA::Boolean wait = false;
for(CORBA::ULong i = 0; i < my_foo_ami_->length(); ++i)
{
CORBA::String_var answer;
try
{
if ( wait==true)
{
ACE_ERROR ((LM_ERROR,
"ERROR: Sender didn't receive SYNCHRONOUS answer"
" from Receiver.\n"));
}
wait = true;
ACE_DEBUG ((LM_DEBUG, "OK Sender send SYNCHRONOUS CALL to Receiver.\n"));
CORBA::ULong result = my_foo_ami_[i].objref->foo( 20,
answer.out ());
if (result == 2)
{
ACE_DEBUG ((LM_DEBUG, "OK Sender received SYNCHRONOUS answer "
"from Receiver <%C>\n",
answer.in ()));
++this->nr_of_rec_;
wait = false;
}
}
catch (const ThreeComp::InternalError&)
{
ACE_ERROR ((LM_ERROR, "ERROR: synch_foo_generator::foo: "
"Unexpected exception.\n"));
}
}
return 0;
}
示例7: svc
int synch_foo_generator::svc ()
{
ACE_OS::sleep (3);
::DelReplyH::MyFoo_var my_foo_ami_ =
this->context_->get_connection_run_my_foo ();
//run some synch calls
try
{
CORBA::String_var answer;
my_foo_ami_->foo("synchronous call", answer.out ());
ACE_DEBUG ((LM_DEBUG, "OK: SYNCH foo returns <%C>.\n",
answer.in ()));
}
catch (const DelReplyH::InternalError& )
{
ACE_ERROR ((LM_ERROR, "ERROR: SYNCH foo(): "
"Unexpected return.\n"));
}
return 0;
}
示例8: svc
int synch_foo_generator::svc ()
{
ACE_OS::sleep(3);
::OneProcess::MyFoo_var my_foo_ami_ =
this->context_->get_connection_run_my_foo ();
CORBA::Boolean wait = false;
for (int i = 0; i < 3; ++i)
{
//run some synch calls
try
{
CORBA::String_var answer;
if( wait==true)
{
ACE_ERROR ((LM_ERROR,
"ERROR: NOT RECEIVED SYNCHRONOUS answer.\n"));
}
wait = true;
CORBA::Long result = my_foo_ami_->foo ("Do something synchronous",
2 ,
answer.out ());
if ( result == 2)
{
ACE_DEBUG ((LM_DEBUG, "OK: RECEIVED SYNCHRONOUS answer <%C>\n",
answer.in ()));
wait = false;
}
}
catch (const OneProcess::InternalError&)
{
ACE_ERROR ((LM_ERROR, "ERROR: synch_foo_generator::foo: "
"Unexpected exception.\n"));
}
ACE_OS::sleep(1);
}
return 0;
}
示例9: svc
int synch_state_generator::svc ()
{
::ThreeComp::State_var my_state_ami_ =
context_->get_connection_run_my_state ();
ACE_OS::sleep(1);
CORBA::Boolean wait = false;
for (int i = 0; i < 3; ++i)
{
// Run some synch calls, answer has to come before the next step.
CORBA::String_var answer;
::CORBA::Long ret = 0;
try
{
if ( wait==true)
{
ACE_ERROR ((LM_ERROR,
"ERROR: NOT RECEIVED SYNCHRONOUS answer.\n"));
}
wait = true;
ACE_DEBUG ((LM_DEBUG, "OK: Master send SYNCHRONOUS call to Sender.\n"));
ret = my_state_ami_->bar (2,answer.out());
if (ret == 2)
{
ACE_DEBUG ((LM_DEBUG, "OK: Master received SYNCHRONOUS answer from Sender <%C>\n",
answer.in ()));
wait = false;
}
}
catch (const ThreeComp::InternalError&)
{
ACE_ERROR ((LM_ERROR, "ERROR: synch_state_generator::state: "
"Unexpected exception.\n"));
}
}
return 0;
}
示例10: out_str
int
Service::call_are_you_there (Test::Callback_ptr callback)
{
ACE_DEBUG ((LM_DEBUG, "(%P|%t) - Service, calling are_you_there\n"));
const int iterations = 10;
int exception_count = 0;
for (int i = 0; i != iterations; ++i)
{
CORBA::String_var outstr;
CORBA::String_out out_str (outstr.out ());
try
{
(void) callback->are_you_there (out_str);
}
catch (const CORBA::Exception&)
{
exception_count++;
}
ACE_DEBUG ((LM_DEBUG, "(%P|%t) - Service, answer = %C\n", outstr.in ()));
}
return exception_count;
}
示例11: defined
//.........这里部分代码省略.........
const char *group_name;
if (this->use_random_)
group_name = "Random group";
else
group_name = "Round Robin group";
Load_Balancer::Object_Group_var object_group;
// We have this for the measurement that was done.
#if defined (DOORS_MEASURE_STATS)
// Performance measurements start here
ACE_High_Res_Timer::calibrate ();
ACE_hrtime_t throughput_base = ACE_OS::gethrtime ();
ACE_Throughput_Stats throughput;
ACE_High_Res_Timer::global_scale_factor_type gsf =
ACE_High_Res_Timer::global_scale_factor ();
for (int i = 0; i < this->iterations_; i++)
{
// Record current time.
ACE_hrtime_t latency_base = ACE_OS::gethrtime ();
#endif /*TAO_MEASURE_STATS*/
// Remote call
object_group =
factory->resolve (group_name);
CORBA::String_var iorstring =
orb->object_to_string (object_group.in ());
ACE_DEBUG ((LM_DEBUG,
"The ior string is %s\n", iorstring.in ()));
#if defined (DOORS_MEASURE_STATS)
// Grab timestamp again.
ACE_hrtime_t now = ACE_OS::gethrtime ();
// Record statistics.
throughput.sample (now - throughput_base,
now - latency_base);
}
ACE_OS::printf ("*=*=*=*=Aggregated result *=*=*=*=*=\n");
throughput.dump_results (ACE_TEXT("Aggregated"), gsf);
#endif /*TAO_MEASURE_STATS */
if (CORBA::is_nil (object_group.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%l|%d)The narrowed object is NUL:"),
-1);
}
// List <Object_Group>'s id.
CORBA::String_var id = object_group->id ();
ACE_DEBUG ((LM_DEBUG, "Object Group's id is: %s\n\n", id.in ()));
// List all <Object_Group>s members.
Load_Balancer::Member_ID_List_var id_list =
object_group->members ();
ACE_DEBUG ((LM_DEBUG,
"The group contains %d members:\n",
id_list->length ()));
for (CORBA::ULong i = 0; i < id_list->length (); ++i)
ACE_DEBUG ((LM_DEBUG, "%s\n", static_cast<char const*>(id_list[i])));
// Perform <number_of_invocations_> method calls on <Identity>
// objects, which are members of the <Object_Group>. Before each
// invocations, we get an <Identity> reference to use for that
// invocation from our <Object_Group>.
Identity_var identity_object;
CORBA::String_var identity;
CORBA::String_var objref;
for (size_t ind = 0; ind < this->number_of_invocations_; ++ind)
{
objref = object_group->resolve ();
obj = orb->string_to_object (objref.in ());
identity_object = Identity::_narrow (obj.in ());
if (CORBA::is_nil (identity_object.in ()))
ACE_ERROR_RETURN ((LM_ERROR,
"Identity_Client: cannot narrow an object received from"
"<Object_Group::resolve> to <Identity>\n"),
-1);
identity_object->get_name (identity.out ());
ACE_DEBUG ((LM_DEBUG,
"Invocation %s\n",
identity.in ()));
}
return 0;
}