Go to the documentation of this file.00001
00002
00003 #include "tao/IORManipulation/IORManip_Filter.h"
00004 #include "tao/IORManipulation/IORManip_Loader.h"
00005 #include "tao/MProfile.h"
00006 #include "tao/ORB_Core.h"
00007 #include "tao/Stub.h"
00008
00009 ACE_RCSID (IORManip_Filter, IORManip_Filter, "$Id: IORManip_Filter.cpp 78278 2007-05-07 11:46:18Z elliott_c $")
00010
00011 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00012
00013 TAO_IORManip_Filter::TAO_IORManip_Filter (void)
00014 {
00015 }
00016
00017
00018 TAO_IORManip_Filter::~TAO_IORManip_Filter (void)
00019 {
00020 }
00021
00022
00023 CORBA::Object_ptr
00024 TAO_IORManip_Filter::sanitize_profiles (CORBA::Object_ptr object,
00025 TAO_Profile* profile)
00026 {
00027 return this->sanitize (object, profile);
00028 }
00029
00030
00031 CORBA::Object_ptr
00032 TAO_IORManip_Filter::sanitize (CORBA::Object_ptr object,
00033 TAO_Profile* guideline)
00034 {
00035 TAO_MProfile profiles = object->_stubobj ()->base_profiles ();
00036 TAO_MProfile new_profiles (profiles.profile_count ());
00037 TAO_Profile* profile = 0;
00038
00039 while ((profile = profiles.get_next ()) != 0)
00040 {
00041
00042 this->filter_and_add (profile, new_profiles, guideline);
00043 }
00044
00045
00046 CORBA::String_var id =
00047 CORBA::string_dup (object->_stubobj ()->type_id.in ());
00048
00049 TAO_ORB_Core *orb_core = object->_stubobj ()->orb_core ();
00050 if (orb_core == 0)
00051 orb_core = TAO_ORB_Core_instance ();
00052
00053 TAO_Stub *stub = orb_core->create_stub (id.in (),
00054 new_profiles);
00055
00056
00057
00058 TAO_Stub_Auto_Ptr safe_stub (stub);
00059
00060
00061 CORBA::Object_ptr temp_obj = CORBA::Object::_nil ();
00062 ACE_NEW_THROW_EX (temp_obj,
00063 CORBA::Object (safe_stub.get ()),
00064 CORBA::NO_MEMORY ());
00065
00066 CORBA::Object_var new_obj = temp_obj;
00067
00068
00069
00070 if (CORBA::is_nil (new_obj.in ()))
00071 {
00072 throw TAO_IOP::Invalid_IOR ();
00073 }
00074
00075
00076
00077 stub = safe_stub.release ();
00078
00079 return new_obj._retn ();
00080 }
00081
00082 TAO_END_VERSIONED_NAMESPACE_DECL