📄 server.cc
字号:
#include "hello.h"#ifdef HAVE_ANSI_CPLUSPLUS_HEADERS#include <fstream>#else // HAVE_ANSI_CPLUSPLUS_HEADERS#include <fstream.h>#endif // HAVE_ANSI_CPLUSPLUS_HEADERSusing namespace std;using namespace PortableInterceptor;class HelloWorld_impl : virtual public POA_HelloWorld{public: void hello();};voidHelloWorld_impl::hello(){ cout << "server: Hello World" << endl;}intmain (int argc, char *argv[]){ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); CORBA::Object_var poaobj = orb->resolve_initial_references ("RootPOA"); PortableServer::POA_var poa = PortableServer::POA::_narrow (poaobj); PortableServer::POAManager_var mgr = poa->the_POAManager(); HelloWorld_impl * hello = new HelloWorld_impl; PortableServer::ObjectId_var oid = poa->activate_object (hello); CORBA::Object_var ref = poa->id_to_reference (oid.in()); CORBA::String_var str = orb->object_to_string (ref.in()); ofstream of ("hello.ref"); of << str.in() << endl; of.close (); cout << "Running." << endl; mgr->activate (); orb->run(); poa->destroy (TRUE, TRUE); delete hello; return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -