#include "Repository.h"
#include "IdentifierUtil.h"
#include <string.h>
Include dependency graph for Dependency.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Namespaces | |
namespace | Omniifr |
Functions | |
IRObject_impl * | referenceToServant (Object_ptr obj) |
Helper method. |
|
Helper method. Converts an object reference into a IRObject_impl pointer. If the conversion succeeds, then the result's servant ref count has been incremented (_add_ref() has been called). It is the caller's responsibility to call _remove_ref() once they are finished with the servant. Deals with all CORBA exceptions that may arise. Definition at line 38 of file Dependency.h. References DB, and IFELSE_OMNIORB4. Referenced by Omniifr::Dependency3< StructMemberSeq >::set(), Omniifr::Dependency2< InterfaceDefSeq >::set(), and Omniifr::Dependency1< CORBA::IDLType >::set(). 00039 { 00040 IRObject_impl* result =NULL; 00041 PortableServer::Servant servant =NULL; 00042 00043 try 00044 { 00045 servant=Repository_impl::inst()._poa->reference_to_servant(obj); 00046 // servant's reference count has been incremented for us. 00047 result=dynamic_cast<IRObject_impl*>(servant); 00048 } 00049 catch(PortableServer::POA::ObjectNotActive& ex) 00050 { 00051 // _poa does not contain irobject. 00052 servant=NULL; 00053 // ?? Temporary diagnostic - help to debug reincarnation: 00054 // ?? remove this when reincarnation works. 00055 DB(1,"?? Reference to object that doesn't exist yet. ??") 00056 } 00057 catch(PortableServer::POA::WrongAdapter& ex) 00058 { 00059 cerr<<"POA has wrong adapter for reference_to_servant()."<<endl; 00060 exit(1); // Programming error - so quit. 00061 } 00062 catch(PortableServer::POA::WrongPolicy& ex) 00063 { 00064 cerr<<"POA has wrong policy for reference_to_servant()."<<endl; 00065 exit(1); // Programming error - so quit. 00066 } 00067 catch(Exception& ex) 00068 { 00069 DB(1,"Failed to get reference_to_servant" 00070 IFELSE_OMNIORB4(" ("<<ex._name()<<")",)) // but press on... 00071 } 00072 00073 if(servant && !result) 00074 servant->_remove_ref();// Balances the implicit _add_ref in ref'_to_servant() 00075 return result; 00076 }
|