00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef OMNIIFR__STRING_TO_H
00024 #define OMNIIFR__STRING_TO_H
00025
00026 #ifdef HAVE_CONFIG_H
00027 # include "config.h"
00028 #endif
00029
00030 #ifdef HAVE_OMNIORB3
00031 # include <omniORB3/CORBA.h>
00032 #endif
00033
00034 #ifdef HAVE_OMNIORB4
00035 # include <omniORB4/CORBA.h>
00036 #endif
00037
00038 #include "Repository.h"
00039
00040 namespace Omniifr {
00041
00043 template<class T>
00044 typename T::_ptr_type string_to_(const char* oidStr)
00045 {
00046 CORBA::Object_var obj =Repository_impl::inst()._orb->string_to_object(oidStr);
00047
00048 if(CORBA::is_nil(obj.in()))
00049 throw CORBA::BAD_PARAM();
00050
00051 #ifdef HAVE_OMNIORB4
00052 typename T::_var_type result =T::_unchecked_narrow(obj);
00053 #else
00054 typename T::_var_type result =T::_narrow(obj);
00055 #endif
00056
00057 if(CORBA::is_nil(result.in()))
00058 throw CORBA::BAD_PARAM();
00059
00060 return result._retn();
00061 }
00062
00063 }
00064
00065 #endif // OMNIIFR__STRING_TO_H