Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

string_to.h

Go to the documentation of this file.
00001 //                            Package   : omniIFR
00002 //  string_to.h               Created   : 2005/02/20
00003 //                            Author    : Alex Tingle
00004 //
00005 //    Copyright (C) 2005 Alex Tingle.
00006 //
00007 //    This file is part of the omniIFR application.
00008 //
00009 //    omniIFR is free software; you can redistribute it and/or
00010 //    modify it under the terms of the GNU Lesser General Public
00011 //    License as published by the Free Software Foundation; either
00012 //    version 2.1 of the License, or (at your option) any later version.
00013 //
00014 //    omniIFR is distributed in the hope that it will be useful,
00015 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 //    Lesser General Public License for more details.
00018 //
00019 //    You should have received a copy of the GNU Lesser General Public
00020 //    License along with this library; if not, write to the Free Software
00021 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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 } // end namespace Omniifr
00064 
00065 #endif // OMNIIFR__STRING_TO_H

Generated on Fri Mar 4 13:03:23 2005 for OmniIFR by  doxygen 1.4.1