?? eg2_clt.cc
字號:
// eg2_clt.cc - This is the source code of example 2 used in Chapter 2// "The Basics" of the omniORB2 user guide.//// This is the client. The object reference is given as a// stringified IOR on the command line.//// Usage: eg2_clt <object reference>//#include <becho.hh>#ifdef HAVE_STD# include <iostream> using namespace std;#else# include <iostream.h>#endifstatic void hello(Echo_ptr e){ if( CORBA::is_nil(e) ) { cerr << "hello: The object reference is nil!\n" << endl; return; } CORBA::String_var src = (const char*) "Hello!"; CORBA::String_var dest = e->echoString(src); cerr << "I said, \"" << (char*)src << "\"." << endl << "The Echo object replied, \"" << (char*)dest <<"\"." << endl;}//////////////////////////////////////////////////////////////////////int main(int argc, char** argv){ try { CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); if( argc != 2 ) { cerr << "usage: eg2_clt <object reference>" << endl; return 1; } { CORBA::Object_var obj = orb->string_to_object(argv[1]); Echo_var echoref = Echo::_narrow(obj); hello(echoref); } orb->destroy(); } catch(CORBA::COMM_FAILURE& ex) { cerr << "Caught system exception COMM_FAILURE -- unable to contact the " << "object." << endl; } catch(CORBA::SystemException&) { cerr << "Caught a CORBA::SystemException." << endl; } catch(CORBA::Exception&) { cerr << "Caught CORBA::Exception." << endl; } catch(omniORB::fatalException& fe) { cerr << "Caught omniORB::fatalException:" << endl; cerr << " file: " << fe.file() << endl; cerr << " line: " << fe.line() << endl; cerr << " mesg: " << fe.errmsg() << endl; } catch(...) { cerr << "Caught unknown exception." << endl; } return 0;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -