4 #include "ObjRef_omniORB4.hh"
8 class ObjRef_i : public POA_ObjRef_omniORB4::ObjRef {
13 virtual ~ObjRef_i() {} ;
15 virtual ObjRef_omniORB4::ObjRef_ptr getObjRef( const ObjRef_omniORB4::ObjRef_ptr anObjRef ) ;
22 ObjRef_omniORB4::ObjRef_ptr ObjRef_i::getObjRef( const ObjRef_omniORB4::ObjRef_ptr anObjRef ) {
24 cout << "ObjRef_i::getObjRef" << endl ;
26 cout << "ObjRef_i::getObjRef will return the same object reference" << endl ;
27 return ObjRef_omniORB4::ObjRef::_duplicate( anObjRef ) ;
31 bool ObjRef_i::ping() {
32 cout << "ping" << endl ;
36 int main( int argc , char ** argv ) {
39 CORBA::ORB_var orb = CORBA::ORB_init( argc , argv , "omniORB4" ) ;
40 CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ) ;
41 PortableServer::POA_var poa = PortableServer::POA::_narrow( obj ) ;
42 ObjRef_i * myObjRef = new ObjRef_i() ;
43 PortableServer::ObjectId_var myObjectId = poa->activate_object( myObjRef ) ;
44 obj = myObjRef->_this() ;
45 CORBA::String_var myIOR = orb->object_to_string( obj ) ;
46 cout << "myIOR : '" << (char * ) myIOR << "'" << endl ;
47 myObjRef->_remove_ref() ;
48 PortableServer::POAManager_var pman = poa->the_POAManager() ;
53 catch(CORBA::SystemException & ) {
54 cout << "Caught CORBA::SystemException" << endl ;
56 catch(CORBA::Exception & ) {
57 cout << "Caught CORBA::Exception" << endl ;
59 catch(omniORB::fatalException & fe ) {
60 cout << "Caught omniORB::fatalException" << endl ;
61 cout << " file " << fe.file() << endl ;
62 cout << " line " << fe.line() << endl ;
63 cout << " errmsg " << fe.errmsg() << endl ;
66 cout << "Caught unknown exception" << endl ;