server.cc

来自「支持组件模型CCM的开源中间件-mico」· CC 代码 · 共 64 行

CC
64
字号
#include <CORBA.h>#include "simple.h"PortableServer::Current_var current;// Implementation for interface simpleclass simple_impl : virtual public POA_simple{  public:    void func( CORBA::Char id ) throw( ::CORBA::SystemException);    void flush() throw( ::CORBA::SystemException);};// Implementation for interface simplevoidsimple_impl::func( CORBA::Char id ) throw( ::CORBA::SystemException) {  //  cout << "(implementation) is in method: simple_impl::func( " << id << " )" << endl;  cout << "Current=" << current->get_object_id() << id << endl;}voidsimple_impl::flush() throw( ::CORBA::SystemException) {  cout << endl;}int main (int argc, char **argv);int main (int argc, char **argv) {   CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "mico-local-orb");   CORBA::Object_var o;   o = orb->resolve_initial_references ("RootPOA");   PortableServer::POA_var rootpoa = PortableServer::POA::_narrow (o);   if (CORBA::is_nil (rootpoa))      {	cerr << "server: resolve_initial_references (): couldn't resolve RootPOA"	     << endl;	exit (-1);      }      o = orb->resolve_initial_references ("POACurrent");   current = PortableServer::Current::_narrow (o);   PortableServer::POAManager_var mgr = rootpoa->the_POAManager ();   simple_impl *s = new simple_impl;      rootpoa->activate_object (s);      cout << "server: activating POA manager" << endl;   mgr->activate ();      cout << "server: running" << endl;      orb->run ();   return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?